ESP8266Wifi Gateway won't connect
-
@OldSurferDude @dpcons Hi all,
The sample sketch could also be found using (File -> Examples -> MySensors -> Esp8266GatewayAs MySensors version 2.3.2 and ESP8266 core 3.0.2 combination does not work you need to change one or the other versions.
The simplest is to roll back the ESP8266 Core version to 2.7.4 and keep the MySensors 2.3.2 version
(Tools -> Board -> Board Manager)
Enter ESP8266 in search bar, then click within the ESP8266 data info box, click the select version pulldown.
Select 2.7.4 and then click Install.
Other option is to update the MySensors library to the development version 2.4.0-Alpha but that has to be done manually.
@hard-shovel Thanks! Now I'm getting output to the monitor. I think I need to set up the IP address and the port 1883 for the MQTT broker. How is that done? I am also getting data from my Arduino node sensors :) I see "controller" but when I change that to my broker's address I get streaming ETH FAIL
-
@hard-shovel Thanks! Now I'm getting output to the monitor. I think I need to set up the IP address and the port 1883 for the MQTT broker. How is that done? I am also getting data from my Arduino node sensors :) I see "controller" but when I change that to my broker's address I get streaming ETH FAIL
The port was set to 5003 and setting it to 1883 (the default MQTT broker port) it now seems to work
-
The port was set to 5003 and setting it to 1883 (the default MQTT broker port) it now seems to work
@OldSurferDude If connecting to a MQTT Broker i would have expected you to use the GatewayESP8266MQTTClient sketch.
as this is already setup with correct Port 1883 for MQTT and the publishing and subscription topics.I did a quick test of a GatewayESP8266MQTTClient sketch with mosquitto and it works fine for me.
-
@OldSurferDude @dpcons Hi all,
The sample sketch could also be found using (File -> Examples -> MySensors -> Esp8266GatewayAs MySensors version 2.3.2 and ESP8266 core 3.0.2 combination does not work you need to change one or the other versions.
The simplest is to roll back the ESP8266 Core version to 2.7.4 and keep the MySensors 2.3.2 version
(Tools -> Board -> Board Manager)
Enter ESP8266 in search bar, then click within the ESP8266 data info box, click the select version pulldown.
Select 2.7.4 and then click Install.
Other option is to update the MySensors library to the development version 2.4.0-Alpha but that has to be done manually.
@hard-shovel While it all seemed to be working, it appears that the ESP8266 MySensors Gateway was not passing the data onto the MQTT broker. Working, meaning that data from the Arduino sensors were getting to the Gateway, but that data was not getting to the broker. Here are some lines of the debug output:
6217818 TSF:MSG:READ,133-133-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 6217883 TSF:MSG:BC 6217903 TSF:MSG:FPAR REQ,ID=133 6217936 TSF:CKU:OK,FCTRL 6217962 TSF:MSG:GWL OK 6218281 !TSF:MSG:SEND,0-0-133-133,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0Also, as an indication that data was not being passed from the Gateway to the broker, I had reset my MQTT Broker and subsequently monitored it with MQTT explorer. The topic "mysensors-out" was not created.
I shut down the ESP8266 MySensors Gateway and restarted the my original one that is running on an RPi. Everything started running as expected.
Thus, my conclusion.
OK, so why isn't the ESP8266 MySensors Gateway passing on the data?
-
@OldSurferDude If connecting to a MQTT Broker i would have expected you to use the GatewayESP8266MQTTClient sketch.
as this is already setup with correct Port 1883 for MQTT and the publishing and subscription topics.I did a quick test of a GatewayESP8266MQTTClient sketch with mosquitto and it works fine for me.
@hard-shovel I try the client
-
@OldSurferDude If connecting to a MQTT Broker i would have expected you to use the GatewayESP8266MQTTClient sketch.
as this is already setup with correct Port 1883 for MQTT and the publishing and subscription topics.I did a quick test of a GatewayESP8266MQTTClient sketch with mosquitto and it works fine for me.
@hard-shovel client worked for me, too. That is, it sent the message "2.3.2" to topic "mygateway1-outx/0/255/0/0/18"
-
@OldSurferDude If connecting to a MQTT Broker i would have expected you to use the GatewayESP8266MQTTClient sketch.
as this is already setup with correct Port 1883 for MQTT and the publishing and subscription topics.I did a quick test of a GatewayESP8266MQTTClient sketch with mosquitto and it works fine for me.
@hard-shovel I tried the client and it did indeed send the MySensors version message. But it does not pass along the messages from the Arduino nodes.
-
@hard-shovel I tried the client and it did indeed send the MySensors version message. But it does not pass along the messages from the Arduino nodes.
@OldSurferDude have you set the MQTT user and MQTT passwords in the sketch and uncommented them as well?
// Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password"// Enable these if your MQTT broker requires usenrame/password #define MY_MQTT_USER "MQTTusername2022" #define MY_MQTT_PASSWORD "MQTTpassword2022"what does your debug log look like?
This sample is not connected correctly to the MQTT Broker10:33:26.151 -> dhcp client start... 10:33:26.151 -> 341 TSM:INIT:GW MODE 10:33:26.199 -> 364 TSM:READY:ID=0,PAR=0,DIS=0 10:33:26.199 -> 396 MCO:REG:NOT NEEDED 10:33:26.339 -> 505 GWT:TPC:CONNECTING... 10:33:27.365 -> 1533 MCO:BGN:STP 10:33:27.365 -> 1551 MCO:BGN:INIT OK,TSP=1 10:33:27.412 -> 1579 TSM:READY:NWD REQ 10:33:27.412 -> 1606 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 10:33:28.671 -> scandone 10:33:35.993 -> pm open,type:2 0 10:33:44.664 -> 18861 TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 10:33:44.758 -> 18924 TSF:MSG:BC 10:33:44.758 -> 18942 TSF:MSG:FPAR REQ,ID=254 10:33:44.804 -> 18973 TSF:PNG:SEND,TO=0 10:33:44.804 -> 18998 TSF:CKU:OK 10:33:44.851 -> 19016 TSF:MSG:GWL OK 10:33:45.459 -> 19646 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 10:33:46.671 -> 20876 TSF:MSG:READ,254-254-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 10:33:46.766 -> 20939 TSF:MSG:PINGED,ID=254,HP=1 10:33:46.813 -> 20980 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 10:33:46.860 -> 21057 TSF:MSG:READ,254-254-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100This is working correctly
10:36:34.908 -> dhcp client start... 10:36:37.655 -> ip:192.168.1.202,mask:255.255.255.0,gw:192.168.1.254 10:36:37.702 -> 7014 GWT:TPC:IP=192.168.1.202 10:36:37.702 -> 7100 GWT:RMQ:CONNECTING... 10:36:37.749 -> 7144 GWT:RMQ:OK 10:36:37.795 -> 7161 GWT:TPS:TOPIC=mygateway4-out/0/255/0/0/18,MSG SENT 10:36:44.792 -> pm open,type:2 0 10:38:56.629 -> 146027 TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 10:38:56.723 -> 146091 TSF:MSG:BC 10:38:56.723 -> 146109 TSF:MSG:FPAR REQ,ID=254 10:38:56.770 -> 146142 TSF:PNG:SEND,TO=0 10:38:56.770 -> 146168 TSF:CKU:OK 10:38:56.816 -> 146187 TSF:MSG:GWL OK 10:38:57.655 -> 147013 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 10:38:58.683 -> 148042 TSF:MSG:READ,254-254-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 10:38:58.730 -> 148105 TSF:MSG:PINGED,ID=254,HP=1 10:38:58.776 -> 148148 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 10:38:58.869 -> 148226 TSF:MSG:READ,254-254-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 10:38:58.916 -> 148294 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 10:38:59.010 -> 148375 TSF:MSG:READ,254-254-0,s=255,c=0,t=17,pt=0,l=11,sg=0:2.4.0-alpha 10:38:59.058 -> 148450 GWT:TPS:TOPIC=mygateway4-out/254/255/0/0/17,MSG SENT 10:38:59.151 -> 148515 TSF:MSG:READ,254-254-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 10:38:59.197 -> 148578 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/6,MSG SENT 10:39:00.923 -> 150319 TSF:MSG:READ,254-254-0,s=255,c=3,t=11,pt=0,l=14,sg=0:MockMySensors 10:39:01.017 -> 150398 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/11,MSG SENT 10:39:01.064 -> 150462 TSF:MSG:READ,254-254-0,s=255,c=3,t=12,pt=0,l=4,sg=0:v0.5 10:39:01.157 -> 150529 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/12,MSG SENT 10:39:01.949 -> 151337 TSF:MSG:READ,254-254-0,s=1,c=0,t=0,pt=0,l=12,sg=0:Outside Door 10:39:02.044 -> 151410 GWT:TPS:TOPIC=mygateway4-out/254/1/0/0/0,MSG SENT 10:39:02.091 -> 151471 TSF:MSG:READ,254-254-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 10:39:02.184 -> 151542 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 10:39:02.699 -> 152055 TSF:MSG:READ,254-254-0,s=255,c=3,t=0,pt=1,l=1,sg=0:83 -
@OldSurferDude have you set the MQTT user and MQTT passwords in the sketch and uncommented them as well?
// Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password"// Enable these if your MQTT broker requires usenrame/password #define MY_MQTT_USER "MQTTusername2022" #define MY_MQTT_PASSWORD "MQTTpassword2022"what does your debug log look like?
This sample is not connected correctly to the MQTT Broker10:33:26.151 -> dhcp client start... 10:33:26.151 -> 341 TSM:INIT:GW MODE 10:33:26.199 -> 364 TSM:READY:ID=0,PAR=0,DIS=0 10:33:26.199 -> 396 MCO:REG:NOT NEEDED 10:33:26.339 -> 505 GWT:TPC:CONNECTING... 10:33:27.365 -> 1533 MCO:BGN:STP 10:33:27.365 -> 1551 MCO:BGN:INIT OK,TSP=1 10:33:27.412 -> 1579 TSM:READY:NWD REQ 10:33:27.412 -> 1606 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 10:33:28.671 -> scandone 10:33:35.993 -> pm open,type:2 0 10:33:44.664 -> 18861 TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 10:33:44.758 -> 18924 TSF:MSG:BC 10:33:44.758 -> 18942 TSF:MSG:FPAR REQ,ID=254 10:33:44.804 -> 18973 TSF:PNG:SEND,TO=0 10:33:44.804 -> 18998 TSF:CKU:OK 10:33:44.851 -> 19016 TSF:MSG:GWL OK 10:33:45.459 -> 19646 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 10:33:46.671 -> 20876 TSF:MSG:READ,254-254-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 10:33:46.766 -> 20939 TSF:MSG:PINGED,ID=254,HP=1 10:33:46.813 -> 20980 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 10:33:46.860 -> 21057 TSF:MSG:READ,254-254-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100This is working correctly
10:36:34.908 -> dhcp client start... 10:36:37.655 -> ip:192.168.1.202,mask:255.255.255.0,gw:192.168.1.254 10:36:37.702 -> 7014 GWT:TPC:IP=192.168.1.202 10:36:37.702 -> 7100 GWT:RMQ:CONNECTING... 10:36:37.749 -> 7144 GWT:RMQ:OK 10:36:37.795 -> 7161 GWT:TPS:TOPIC=mygateway4-out/0/255/0/0/18,MSG SENT 10:36:44.792 -> pm open,type:2 0 10:38:56.629 -> 146027 TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 10:38:56.723 -> 146091 TSF:MSG:BC 10:38:56.723 -> 146109 TSF:MSG:FPAR REQ,ID=254 10:38:56.770 -> 146142 TSF:PNG:SEND,TO=0 10:38:56.770 -> 146168 TSF:CKU:OK 10:38:56.816 -> 146187 TSF:MSG:GWL OK 10:38:57.655 -> 147013 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 10:38:58.683 -> 148042 TSF:MSG:READ,254-254-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 10:38:58.730 -> 148105 TSF:MSG:PINGED,ID=254,HP=1 10:38:58.776 -> 148148 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 10:38:58.869 -> 148226 TSF:MSG:READ,254-254-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 10:38:58.916 -> 148294 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 10:38:59.010 -> 148375 TSF:MSG:READ,254-254-0,s=255,c=0,t=17,pt=0,l=11,sg=0:2.4.0-alpha 10:38:59.058 -> 148450 GWT:TPS:TOPIC=mygateway4-out/254/255/0/0/17,MSG SENT 10:38:59.151 -> 148515 TSF:MSG:READ,254-254-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 10:38:59.197 -> 148578 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/6,MSG SENT 10:39:00.923 -> 150319 TSF:MSG:READ,254-254-0,s=255,c=3,t=11,pt=0,l=14,sg=0:MockMySensors 10:39:01.017 -> 150398 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/11,MSG SENT 10:39:01.064 -> 150462 TSF:MSG:READ,254-254-0,s=255,c=3,t=12,pt=0,l=4,sg=0:v0.5 10:39:01.157 -> 150529 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/12,MSG SENT 10:39:01.949 -> 151337 TSF:MSG:READ,254-254-0,s=1,c=0,t=0,pt=0,l=12,sg=0:Outside Door 10:39:02.044 -> 151410 GWT:TPS:TOPIC=mygateway4-out/254/1/0/0/0,MSG SENT 10:39:02.091 -> 151471 TSF:MSG:READ,254-254-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 10:39:02.184 -> 151542 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 10:39:02.699 -> 152055 TSF:MSG:READ,254-254-0,s=255,c=3,t=0,pt=1,l=1,sg=0:83@hard-shovel My MQTT broker does not require them. Should I uncomment and leave them blank?
-
@hard-shovel My MQTT broker does not require them. Should I uncomment and leave them blank?
@OldSurferDude You should leave them commented if not required.
I have just tested with a new install on windows of mosquitto with config file for anonymous access and it is working fine with them commented out.
what do your gateway debug logs look like?
-
@OldSurferDude have you set the MQTT user and MQTT passwords in the sketch and uncommented them as well?
// Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password"// Enable these if your MQTT broker requires usenrame/password #define MY_MQTT_USER "MQTTusername2022" #define MY_MQTT_PASSWORD "MQTTpassword2022"what does your debug log look like?
This sample is not connected correctly to the MQTT Broker10:33:26.151 -> dhcp client start... 10:33:26.151 -> 341 TSM:INIT:GW MODE 10:33:26.199 -> 364 TSM:READY:ID=0,PAR=0,DIS=0 10:33:26.199 -> 396 MCO:REG:NOT NEEDED 10:33:26.339 -> 505 GWT:TPC:CONNECTING... 10:33:27.365 -> 1533 MCO:BGN:STP 10:33:27.365 -> 1551 MCO:BGN:INIT OK,TSP=1 10:33:27.412 -> 1579 TSM:READY:NWD REQ 10:33:27.412 -> 1606 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 10:33:28.671 -> scandone 10:33:35.993 -> pm open,type:2 0 10:33:44.664 -> 18861 TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 10:33:44.758 -> 18924 TSF:MSG:BC 10:33:44.758 -> 18942 TSF:MSG:FPAR REQ,ID=254 10:33:44.804 -> 18973 TSF:PNG:SEND,TO=0 10:33:44.804 -> 18998 TSF:CKU:OK 10:33:44.851 -> 19016 TSF:MSG:GWL OK 10:33:45.459 -> 19646 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 10:33:46.671 -> 20876 TSF:MSG:READ,254-254-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 10:33:46.766 -> 20939 TSF:MSG:PINGED,ID=254,HP=1 10:33:46.813 -> 20980 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 10:33:46.860 -> 21057 TSF:MSG:READ,254-254-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100This is working correctly
10:36:34.908 -> dhcp client start... 10:36:37.655 -> ip:192.168.1.202,mask:255.255.255.0,gw:192.168.1.254 10:36:37.702 -> 7014 GWT:TPC:IP=192.168.1.202 10:36:37.702 -> 7100 GWT:RMQ:CONNECTING... 10:36:37.749 -> 7144 GWT:RMQ:OK 10:36:37.795 -> 7161 GWT:TPS:TOPIC=mygateway4-out/0/255/0/0/18,MSG SENT 10:36:44.792 -> pm open,type:2 0 10:38:56.629 -> 146027 TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 10:38:56.723 -> 146091 TSF:MSG:BC 10:38:56.723 -> 146109 TSF:MSG:FPAR REQ,ID=254 10:38:56.770 -> 146142 TSF:PNG:SEND,TO=0 10:38:56.770 -> 146168 TSF:CKU:OK 10:38:56.816 -> 146187 TSF:MSG:GWL OK 10:38:57.655 -> 147013 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 10:38:58.683 -> 148042 TSF:MSG:READ,254-254-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 10:38:58.730 -> 148105 TSF:MSG:PINGED,ID=254,HP=1 10:38:58.776 -> 148148 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 10:38:58.869 -> 148226 TSF:MSG:READ,254-254-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 10:38:58.916 -> 148294 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 10:38:59.010 -> 148375 TSF:MSG:READ,254-254-0,s=255,c=0,t=17,pt=0,l=11,sg=0:2.4.0-alpha 10:38:59.058 -> 148450 GWT:TPS:TOPIC=mygateway4-out/254/255/0/0/17,MSG SENT 10:38:59.151 -> 148515 TSF:MSG:READ,254-254-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 10:38:59.197 -> 148578 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/6,MSG SENT 10:39:00.923 -> 150319 TSF:MSG:READ,254-254-0,s=255,c=3,t=11,pt=0,l=14,sg=0:MockMySensors 10:39:01.017 -> 150398 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/11,MSG SENT 10:39:01.064 -> 150462 TSF:MSG:READ,254-254-0,s=255,c=3,t=12,pt=0,l=4,sg=0:v0.5 10:39:01.157 -> 150529 GWT:TPS:TOPIC=mygateway4-out/254/255/3/0/12,MSG SENT 10:39:01.949 -> 151337 TSF:MSG:READ,254-254-0,s=1,c=0,t=0,pt=0,l=12,sg=0:Outside Door 10:39:02.044 -> 151410 GWT:TPS:TOPIC=mygateway4-out/254/1/0/0/0,MSG SENT 10:39:02.091 -> 151471 TSF:MSG:READ,254-254-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 10:39:02.184 -> 151542 TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 10:39:02.699 -> 152055 TSF:MSG:READ,254-254-0,s=255,c=3,t=0,pt=1,l=1,sg=0:83@hard-shovel This is what I'm getting (with no nodes connecting to gateway)
MCO:BGN:INIT GW,CP=RNNGE---,FQ=80,REL=255,VER=2.3.2 117 TSF:LRT:OK 133 TSM:INIT 147 TSF:WUR:MS=0 170 TSM:INIT:TSP OK 191 TSM:INIT:GW MODE 213 TSM:READY:ID=0,PAR=0,DIS=0 245 MCO:REG:NOT NEEDED scandone 1322 GWT:TIN:CONNECTING... 2351 GWT:TIN:CONNECTING... scandone state: 0 -> 2 (b0) 4097 GWT:TIN:CONNECTING... state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Automation, channel 9 dhcp client start... ip:192.168.1.30,mask:255.255.255.0,gw:192.168.1.193 4316 GWT:TIN:IP: 192.168.1.30 4355 GWT:TIN:ETH OK 4378 MCO:BGN:STP 4396 MCO:BGN:INIT OK,TSP=1 4424 TSM:READY:NWD REQ 4451 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: pm open,type:2 0And this comes when a node connects:
197868 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 197928 TSF:MSG:BC 197947 TSF:MSG:FPAR REQ,ID=2 197977 TSF:PNG:SEND,TO=0 198003 TSF:CKU:OK 198022 TSF:MSG:GWL OK 198460 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 200006 TSF:MSG:READ,2-2-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 200065 TSF:MSG:PINGED,ID=2,HP=1 200106 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 200244 TSF:MSG:READ,2-2-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 200309 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 200385 TSF:MSG:READ,2-2-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.3.2 200456 GWT:TSA:ETH OK 200481 TSF:MSG:READ,2-2-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 200545 GWT:TSA:ETH OK 202529 TSF:MSG:READ,2-2-0,s=255,c=3,t=11,pt=0,l=15,sg=0:BatMoistHumTemp 202611 GWT:TSA:ETH OK 202636 TSF:MSG:READ,2-2-0,s=255,c=3,t=12,pt=0,l=9,sg=0: 0.01 202710 GWT:TSA:ETH OK 202885 TSF:MSG:READ,2-2-0,s=0,c=0,t=35,pt=0,l=0,sg=0: 202948 GWT:TSA:ETH OK 203141 TSF:MSG:READ,2-2-0,s=1,c=0,t=7,pt=0,l=0,sg=0: 203203 GWT:TSA:ETH OK 203396 TSF:MSG:READ,2-2-0,s=2,c=0,t=6,pt=0,l=0,sg=0: 203458 GWT:TSA:ETH OK 203651 TSF:MSG:READ,2-2-0,s=3,c=0,t=30,pt=0,l=0,sg=0: 203713 GWT:TSA:ETH OK 203925 TSF:MSG:READ,2-2-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 203992 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 204128 TSF:MSG:READ,2-2-0,s=255,c=3,t=0,pt=1,l=1,sg=0:100 204199 GWT:TSA:ETH OK 204407 TSF:MSG:READ,2-2-0,s=3,c=1,t=38,pt=7,l=5,sg=0:6.52 204475 GWT:TSA:ETH OK 204542 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:1023 204610 GWT:TSA:ETH OK -
@hard-shovel This is what I'm getting (with no nodes connecting to gateway)
MCO:BGN:INIT GW,CP=RNNGE---,FQ=80,REL=255,VER=2.3.2 117 TSF:LRT:OK 133 TSM:INIT 147 TSF:WUR:MS=0 170 TSM:INIT:TSP OK 191 TSM:INIT:GW MODE 213 TSM:READY:ID=0,PAR=0,DIS=0 245 MCO:REG:NOT NEEDED scandone 1322 GWT:TIN:CONNECTING... 2351 GWT:TIN:CONNECTING... scandone state: 0 -> 2 (b0) 4097 GWT:TIN:CONNECTING... state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Automation, channel 9 dhcp client start... ip:192.168.1.30,mask:255.255.255.0,gw:192.168.1.193 4316 GWT:TIN:IP: 192.168.1.30 4355 GWT:TIN:ETH OK 4378 MCO:BGN:STP 4396 MCO:BGN:INIT OK,TSP=1 4424 TSM:READY:NWD REQ 4451 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: pm open,type:2 0And this comes when a node connects:
197868 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 197928 TSF:MSG:BC 197947 TSF:MSG:FPAR REQ,ID=2 197977 TSF:PNG:SEND,TO=0 198003 TSF:CKU:OK 198022 TSF:MSG:GWL OK 198460 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 200006 TSF:MSG:READ,2-2-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 200065 TSF:MSG:PINGED,ID=2,HP=1 200106 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 200244 TSF:MSG:READ,2-2-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 200309 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 200385 TSF:MSG:READ,2-2-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.3.2 200456 GWT:TSA:ETH OK 200481 TSF:MSG:READ,2-2-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 200545 GWT:TSA:ETH OK 202529 TSF:MSG:READ,2-2-0,s=255,c=3,t=11,pt=0,l=15,sg=0:BatMoistHumTemp 202611 GWT:TSA:ETH OK 202636 TSF:MSG:READ,2-2-0,s=255,c=3,t=12,pt=0,l=9,sg=0: 0.01 202710 GWT:TSA:ETH OK 202885 TSF:MSG:READ,2-2-0,s=0,c=0,t=35,pt=0,l=0,sg=0: 202948 GWT:TSA:ETH OK 203141 TSF:MSG:READ,2-2-0,s=1,c=0,t=7,pt=0,l=0,sg=0: 203203 GWT:TSA:ETH OK 203396 TSF:MSG:READ,2-2-0,s=2,c=0,t=6,pt=0,l=0,sg=0: 203458 GWT:TSA:ETH OK 203651 TSF:MSG:READ,2-2-0,s=3,c=0,t=30,pt=0,l=0,sg=0: 203713 GWT:TSA:ETH OK 203925 TSF:MSG:READ,2-2-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 203992 TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 204128 TSF:MSG:READ,2-2-0,s=255,c=3,t=0,pt=1,l=1,sg=0:100 204199 GWT:TSA:ETH OK 204407 TSF:MSG:READ,2-2-0,s=3,c=1,t=38,pt=7,l=5,sg=0:6.52 204475 GWT:TSA:ETH OK 204542 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:1023 204610 GWT:TSA:ETH OK@OldSurferDude You are getting regular GWT:TSA:ETH OK message which i do not and you have no
MSG SENT linesWhich MQTT broker are you using?
my test setup which i hope matches yours is:
MySensors 2.3.2 & ESP8266 core 2.7.4
ESP8266 Node MCU with sketch GatewayESP8266MQTTClient
MY_BAUD_RATE 9600
MY_MQTT_USER & MQTT_PASSWORD commented out
MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 195 address of the MQTT broker
MY_CONTROLLER_URL_ADDRESS "MQTT-TEST-W10" commented out Use IP or URL not Both
MY_PORT 1883MQTT Broker
Mosquitto 2.0.15 running as a service on a windows 10 machine
listener 1883 anonymous access
URL MQTT-TEST-W10When connected to the MQTT Broker and receiving messages from a node the gateway shows
09:48:18.962 -> 718935 TSF:MSG:READ,254-254-0,s=1,c=1,t=16,pt=2,l=2,sg=0:0 09:48:19.010 -> 718997 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/16,MSG SENT 09:48:19.104 -> 719059 TSF:MSG:READ,254-254-0,s=1,c=1,t=15,pt=1,l=1,sg=0:1 09:48:19.149 -> 719121 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/15,MSG SENT 09:48:19.198 -> 719182 TSF:MSG:READ,254-254-0,s=255,c=3,t=0,pt=1,l=1,sg=0:83 09:48:19.292 -> 719246 GWT:TPS:TOPIC=mygateway5-out/254/255/3/0/0,MSG SENTif a message is sent to the broker the gateway shows
10:03:54.285 -> 1654209 GWT:IMQ:TOPIC=mygateway5-in/254/255/1/0/15, MSG RECEIVED 10:03:54.331 -> 1654279 TSF:MSG:SEND,0-0-254-254,s=255,c=1,t=15,pt=0,l=1,sg=0,ft=0,st=OK:1 10:03:54.423 -> 1654358 TSF:MSG:READ,254-254-0,s=1,c=1,t=16,pt=2,l=2,sg=0:1 10:03:54.471 -> 1654421 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/16,MSG SENT 10:03:54.565 -> 1654483 TSF:MSG:READ,254-254-0,s=1,c=1,t=15,pt=1,l=1,sg=0:1 10:03:54.611 -> 1654546 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/15,MSG SENT -
@OldSurferDude You are getting regular GWT:TSA:ETH OK message which i do not and you have no
MSG SENT linesWhich MQTT broker are you using?
my test setup which i hope matches yours is:
MySensors 2.3.2 & ESP8266 core 2.7.4
ESP8266 Node MCU with sketch GatewayESP8266MQTTClient
MY_BAUD_RATE 9600
MY_MQTT_USER & MQTT_PASSWORD commented out
MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 195 address of the MQTT broker
MY_CONTROLLER_URL_ADDRESS "MQTT-TEST-W10" commented out Use IP or URL not Both
MY_PORT 1883MQTT Broker
Mosquitto 2.0.15 running as a service on a windows 10 machine
listener 1883 anonymous access
URL MQTT-TEST-W10When connected to the MQTT Broker and receiving messages from a node the gateway shows
09:48:18.962 -> 718935 TSF:MSG:READ,254-254-0,s=1,c=1,t=16,pt=2,l=2,sg=0:0 09:48:19.010 -> 718997 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/16,MSG SENT 09:48:19.104 -> 719059 TSF:MSG:READ,254-254-0,s=1,c=1,t=15,pt=1,l=1,sg=0:1 09:48:19.149 -> 719121 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/15,MSG SENT 09:48:19.198 -> 719182 TSF:MSG:READ,254-254-0,s=255,c=3,t=0,pt=1,l=1,sg=0:83 09:48:19.292 -> 719246 GWT:TPS:TOPIC=mygateway5-out/254/255/3/0/0,MSG SENTif a message is sent to the broker the gateway shows
10:03:54.285 -> 1654209 GWT:IMQ:TOPIC=mygateway5-in/254/255/1/0/15, MSG RECEIVED 10:03:54.331 -> 1654279 TSF:MSG:SEND,0-0-254-254,s=255,c=1,t=15,pt=0,l=1,sg=0,ft=0,st=OK:1 10:03:54.423 -> 1654358 TSF:MSG:READ,254-254-0,s=1,c=1,t=16,pt=2,l=2,sg=0:1 10:03:54.471 -> 1654421 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/16,MSG SENT 10:03:54.565 -> 1654483 TSF:MSG:READ,254-254-0,s=1,c=1,t=15,pt=1,l=1,sg=0:1 10:03:54.611 -> 1654546 GWT:TPS:TOPIC=mygateway5-out/254/1/1/0/15,MSG SENT@hard-shovel I created a faux nano sensor and used nRF24L01 channel 121 to communicate to the gateway. Here is my NodeMCU ESP8266 code with all comments taken out:
#define VER 0.4 #define MY_DEBUG true #define MY_BAUD_RATE 9600 #define MY_RADIO_RF24 #define MY_RF24_CHANNEL 121 #define MY_GATEWAY_ESP8266 "Test" #define MY_WIFI_SSID "SSID" #define MY_WIFI_PASSWORD "pass" #define MY_HOSTNAME "ESP8266_GW" #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mysensors-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mysensors-in" #define MY_PORT 1883 #define MY_GATEWAY_MAX_CLIENTS 8 #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 142 #include <MySensors.h> void setup() {Serial.print("ESP8266MySensorsGateway version: ");Serial.println(VER); } void presentation(){} void loop(){}On boot, the gateway generates the following debug output:
60 MCO:BGN:INIT GW,CP=RNNGE---,FQ=80,REL=255,VER=2.3.2 118 TSF:LRT:OK 133 TSM:INIT 147 TSF:WUR:MS=0 170 TSM:INIT:TSP OK 191 TSM:INIT:GW MODE 213 TSM:READY:ID=0,PAR=0,DIS=0 246 MCO:REG:NOT NEEDED scandone 1322 GWT:TIN:CONNECTING... 2350 GWT:TIN:CONNECTING... scandone state: 0 -> 2 (b0) 4097 GWT:TIN:CONNECTING... state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Automation, channel 9 dhcp client start... ip:192.168.1.30,mask:255.255.255.0,gw:192.168.1.193 4316 GWT:TIN:IP: 192.168.1.30 4354 GWT:TIN:ETH OK 4376 MCO:BGN:STP ESP8266MySensorsGateway version: 0.40 4394 MCO:BGN:INIT OK,TSP=1 4463 TSM:READY:NWD REQ 4490 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 6865 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:208 6933 GWT:TSA:ETH OKThe faux node connects to the gateway indicated by this debug code from the gateway (which is repeated for each "reading" (eg. 204):
1047590 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:204 1047656 GWT:TSA:ETH OKNothing arrives at the MQTT broker. From another machine, I can publish to the broker:
mosquitto_pub -h 192.168.1.139 -t test/mztake -m "did it arrive?"and it does arrive at the broker.
What am I missing?
OSD
-
@hard-shovel I created a faux nano sensor and used nRF24L01 channel 121 to communicate to the gateway. Here is my NodeMCU ESP8266 code with all comments taken out:
#define VER 0.4 #define MY_DEBUG true #define MY_BAUD_RATE 9600 #define MY_RADIO_RF24 #define MY_RF24_CHANNEL 121 #define MY_GATEWAY_ESP8266 "Test" #define MY_WIFI_SSID "SSID" #define MY_WIFI_PASSWORD "pass" #define MY_HOSTNAME "ESP8266_GW" #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mysensors-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mysensors-in" #define MY_PORT 1883 #define MY_GATEWAY_MAX_CLIENTS 8 #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 142 #include <MySensors.h> void setup() {Serial.print("ESP8266MySensorsGateway version: ");Serial.println(VER); } void presentation(){} void loop(){}On boot, the gateway generates the following debug output:
60 MCO:BGN:INIT GW,CP=RNNGE---,FQ=80,REL=255,VER=2.3.2 118 TSF:LRT:OK 133 TSM:INIT 147 TSF:WUR:MS=0 170 TSM:INIT:TSP OK 191 TSM:INIT:GW MODE 213 TSM:READY:ID=0,PAR=0,DIS=0 246 MCO:REG:NOT NEEDED scandone 1322 GWT:TIN:CONNECTING... 2350 GWT:TIN:CONNECTING... scandone state: 0 -> 2 (b0) 4097 GWT:TIN:CONNECTING... state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Automation, channel 9 dhcp client start... ip:192.168.1.30,mask:255.255.255.0,gw:192.168.1.193 4316 GWT:TIN:IP: 192.168.1.30 4354 GWT:TIN:ETH OK 4376 MCO:BGN:STP ESP8266MySensorsGateway version: 0.40 4394 MCO:BGN:INIT OK,TSP=1 4463 TSM:READY:NWD REQ 4490 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: 6865 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:208 6933 GWT:TSA:ETH OKThe faux node connects to the gateway indicated by this debug code from the gateway (which is repeated for each "reading" (eg. 204):
1047590 TSF:MSG:READ,2-2-0,s=0,c=1,t=37,pt=2,l=2,sg=0:204 1047656 GWT:TSA:ETH OKNothing arrives at the MQTT broker. From another machine, I can publish to the broker:
mosquitto_pub -h 192.168.1.139 -t test/mztake -m "did it arrive?"and it does arrive at the broker.
What am I missing?
OSD
@OldSurferDude you are (at least) missing
#define MY_GATEWAY_MQTT_CLIENT.The sketch you are using is instructing MySensors to create an ethernet gateway.
Example sketch for esp8266 mqtt: https://github.com/mysensors/MySensors/blob/master/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino
-
@OldSurferDude you are (at least) missing
#define MY_GATEWAY_MQTT_CLIENT.The sketch you are using is instructing MySensors to create an ethernet gateway.
Example sketch for esp8266 mqtt: https://github.com/mysensors/MySensors/blob/master/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino
@mfalkvidd said in ESP8266Wifi Gateway won't connect:
#define MY_GATEWAY_MQTT_CLIENT
That was it! Thank you!
OSD
-
@OldSurferDude you are (at least) missing
#define MY_GATEWAY_MQTT_CLIENT.The sketch you are using is instructing MySensors to create an ethernet gateway.
Example sketch for esp8266 mqtt: https://github.com/mysensors/MySensors/blob/master/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino
@mfalkvidd Because I see that the example has a presentation() routine with the comment "// Present locally attached sensors here" I made the assumption that the gateway could have local sensors. I described a local sensor
// local sensor information #define MY_NODE_ID 3 #define CHILD_ID_GATEWAY_FAUX_SENSOR 0 MyMessage msgFauxSensor(CHILD_ID_GATEWAY_FAUX_SENSOR, V_LEVEL); int fauxSensorValue = 0;and put the data acquisition code in the loop:
// Send locally attached sensors data here send(msgFauxSensor.set(fauxSensorValue++)); Serial.print("Value sent: ");Serial.println(fauxSensorValue); delay(30000);Lo and Behold! This data was being found on the MQTT broker! Albeit the NODE_ID was not 3 as defined, but 0. This makes sense because the NODE_ID of the gateway is zero.
Previously, I had my gateway running on an RPi. My question is, can I put a presentation() routine and data acquisition of the gateway running on my RPi?
-
@mfalkvidd Because I see that the example has a presentation() routine with the comment "// Present locally attached sensors here" I made the assumption that the gateway could have local sensors. I described a local sensor
// local sensor information #define MY_NODE_ID 3 #define CHILD_ID_GATEWAY_FAUX_SENSOR 0 MyMessage msgFauxSensor(CHILD_ID_GATEWAY_FAUX_SENSOR, V_LEVEL); int fauxSensorValue = 0;and put the data acquisition code in the loop:
// Send locally attached sensors data here send(msgFauxSensor.set(fauxSensorValue++)); Serial.print("Value sent: ");Serial.println(fauxSensorValue); delay(30000);Lo and Behold! This data was being found on the MQTT broker! Albeit the NODE_ID was not 3 as defined, but 0. This makes sense because the NODE_ID of the gateway is zero.
Previously, I had my gateway running on an RPi. My question is, can I put a presentation() routine and data acquisition of the gateway running on my RPi?
delay(30000);
A delay in the gateway will make the gateway freeze. It will not handle incoming messages (not from the mqtt broker, not for any nodes). Use wait() instead.
Previously, I had my gateway running on an RPi. My question is, can I put a presentation() routine and data acquisition of the gateway running on my RPi?
Yes, it should work. The file to edit is https://github.com/mysensors/MySensors/blob/development/examples_linux/mysgw.cpp
Have you forgotten about https://forum.mysensors.org/post/111806 ?
-
delay(30000);
A delay in the gateway will make the gateway freeze. It will not handle incoming messages (not from the mqtt broker, not for any nodes). Use wait() instead.
Previously, I had my gateway running on an RPi. My question is, can I put a presentation() routine and data acquisition of the gateway running on my RPi?
Yes, it should work. The file to edit is https://github.com/mysensors/MySensors/blob/development/examples_linux/mysgw.cpp
Have you forgotten about https://forum.mysensors.org/post/111806 ?
@mfalkvidd Yes, totally forgot about that link you put there. Thanks for reminding me. :)