Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. ESP8266Wifi Gateway won't connect

ESP8266Wifi Gateway won't connect

Scheduled Pinned Locked Moved Troubleshooting
33 Posts 6 Posters 3.4k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OldSurferDudeO OldSurferDude

    @hard-shovel My MQTT broker does not require them. Should I uncomment and leave them blank?

    H Offline
    H Offline
    hard-shovel
    wrote on last edited by
    #24

    @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?

    1 Reply Last reply
    0
    • H hard-shovel

      @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 Broker

      10: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:0100
      

      This 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
      
      OldSurferDudeO Offline
      OldSurferDudeO Offline
      OldSurferDude
      wrote on last edited by OldSurferDude
      #25

      @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 0
      

      And 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
      
      H 1 Reply Last reply
      0
      • P Offline
        P Offline
        paqor
        wrote on last edited by paqor
        #26

        Hello have with the gateway constantly disconnects after a few days and I can only reactivate it by resetting on the gateway.

        Have now inserted a separate power supply with a large electrolytic capacitor 5000 µF-let's see....

        1 Reply Last reply
        0
        • OldSurferDudeO OldSurferDude

          @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 0
          

          And 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
          
          H Offline
          H Offline
          hard-shovel
          wrote on last edited by hard-shovel
          #27

          @OldSurferDude You are getting regular GWT:TSA:ETH OK message which i do not and you have no
          MSG SENT lines

          Which 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 1883

          MQTT Broker
          Mosquitto 2.0.15 running as a service on a windows 10 machine
          listener 1883 anonymous access
          URL MQTT-TEST-W10

          When 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 SENT
          

          if 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
          
          OldSurferDudeO 1 Reply Last reply
          1
          • H hard-shovel

            @OldSurferDude You are getting regular GWT:TSA:ETH OK message which i do not and you have no
            MSG SENT lines

            Which 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 1883

            MQTT Broker
            Mosquitto 2.0.15 running as a service on a windows 10 machine
            listener 1883 anonymous access
            URL MQTT-TEST-W10

            When 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 SENT
            

            if 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
            
            OldSurferDudeO Offline
            OldSurferDudeO Offline
            OldSurferDude
            wrote on last edited by
            #28

            @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 OK
            

            The 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 OK
            

            Nothing 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

            mfalkviddM 1 Reply Last reply
            0
            • OldSurferDudeO OldSurferDude

              @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 OK
              

              The 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 OK
              

              Nothing 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

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #29

              @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

              OldSurferDudeO 2 Replies Last reply
              0
              • mfalkviddM mfalkvidd

                @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

                OldSurferDudeO Offline
                OldSurferDudeO Offline
                OldSurferDude
                wrote on last edited by
                #30

                @mfalkvidd said in ESP8266Wifi Gateway won't connect:

                #define MY_GATEWAY_MQTT_CLIENT

                That was it! Thank you!

                OSD

                1 Reply Last reply
                0
                • mfalkviddM mfalkvidd

                  @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

                  OldSurferDudeO Offline
                  OldSurferDudeO Offline
                  OldSurferDude
                  wrote on last edited by
                  #31

                  @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?

                  mfalkviddM 1 Reply Last reply
                  0
                  • OldSurferDudeO OldSurferDude

                    @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?

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #32

                    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 ?

                    OldSurferDudeO 1 Reply Last reply
                    0
                    • mfalkviddM mfalkvidd

                      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 ?

                      OldSurferDudeO Offline
                      OldSurferDudeO Offline
                      OldSurferDude
                      wrote on last edited by
                      #33

                      @mfalkvidd Yes, totally forgot about that link you put there. Thanks for reminding me. :)

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      9

                      Online

                      12.0k

                      Users

                      11.2k

                      Topics

                      113.4k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular