Troubleshoot Nano temp/humidity to ESP8266-MQTT gateway issue



  • Everyone,

    I am new to MySensors but have experience with Arduino, ESP8266, and MQTT. Trying to debug my "starter" MySensors setup and am having a hard time.

    My set up is as follows:

    • Sensor node: Arduino Nano clone with a DHT22 attached (DHT22 and Nano clone tested and working fine in non-MySensors applications). An NRF24L01 is attached, with a 10-uF cap across VCC-GND. It is running a variant of the humidity / temperature script described at https://www.mysensors.org/build/humidity. I made changes to make the script compatible with the standard DHT library.
    • Gateway: A Wemos D1 Mini with an NRF24L01 attached (also with a 10-uF cap). It is running the ESP8266 variant of the MQTT gateway script described at https://www.mysensors.org/build/mqtt_gateway#mqttgateway-example

    When I run the gateway script, the following appears in the serial monitor:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGE--,VER=2.1.1
    0;255;3;0;9;TSF:LRT:OK
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 4
    cnt 
    
    connected with Frog Station Alpha, channel 4
    dhcp client start...
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    f r0, scandone
    ip:192.168.1.189,mask:255.255.255.0,gw:192.168.1.1
    .IP: 192.168.1.189
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    IP: 192.168.1.189
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
    pm open,type:2 0
    
    

    I see nothing after this, though my MQTT broker does indeed successfully receive the message "2.1.1" on topic mygateway1-out/0/255/0/0/18.

    On the sensor node side, the serial output looks like this:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    11 TSM:INIT:TSP OK
    13 TSM:FPAR
    15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2022 !TSM:FPAR:NO REPLY
    2024 TSM:FPAR
    2026 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4034 !TSM:FPAR:NO REPLY
    4036 TSM:FPAR
    4038 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6046 !TSM:FPAR:NO REPLY
    6048 TSM:FPAR
    6050 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8058 !TSM:FPAR:FAIL
    8059 TSM:FAIL:CNT=1
    8061 TSM:FAIL:PDT
    

    This type of output continues on and on.

    Obviously there is a "failure" but is it possible to diagnose where the problem lies, based on this output?

    Many thanks! I'm hoping I can get this working.



  • Any ideas from the crowd? I tried swapping in a NRF24L01 on the gateway side, which had no effect.



  • Triple check wires (and change them, sometimes dupont câble are bad) on Gateway side.



  • Thanks for the tip. I changed to a new ESP8266 unit (now a NodeMCU board) and may be getting somewhere.

    I can see what looks like the node and the gateway talking to each other, but the node never gets to the part where it actually reads a temperature! It seems to be stuck at some kind of "handshake" stage.

    The log on the sensor node side reads as follows:

    2503067 TSM:FAIL:RE-INIT
    2503069 TSM:INIT
    2503076 TSM:INIT:TSP OK
    2503078 TSM:FPAR
    2503081 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2503468 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    2503473 TSF:MSG:FPAR OK,ID=0,D=1
    2505090 TSM:FPAR:OK
    2505091 TSM:ID
    2505093 TSM:ID:REQ
    2505096 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2507103 TSM:ID
    2507104 TSM:ID:REQ
    2507107 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2509115 TSM:ID
    2509116 TSM:ID:REQ
    2509119 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2511127 TSM:ID
    2511128 TSM:ID:REQ
    2511131 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2513139 !TSM:ID:FAIL
    2513141 TSM:FAIL:CNT=7
    2513143 TSM:FAIL:PDT
    

    On the gateway side, I see publish events to my MQTT broker on the topic mygateway1-out/255/255/3/0/3 with no content in the message (timed corresponding to the TSF:MSG:SEND events in the sensor node log) so I assume the radios are actually talking to one another. I just don't know why the temperature isn't being read.


  • Mod

    The node is requesting an ID from your controller (see the log parser for more info)

    I don't think handing out dynamic IDs works with mqtt. Define a node ID manually by adding

    #define MY_NODE_ID 123
    

    before including MySensors.h



  • Thanks for the tip, I'll give it a try. It occurs to me that I have no "controller" here and so that may be why I'm getting errors.



  • @mfalkvidd said in Troubleshoot Nano temp/humidity to ESP8266-MQTT gateway issue:

    I don't think handing out dynamic IDs works with mqtt. Define a node ID manually by adding

    #define MY_NODE_ID 123
    

    before including MySensors.h

    It worked. Data is coming through now. Thanks again!


  • Mod

    @jwosnick great! Thanks for reporting back.



  • @mfalkvidd said in Troubleshoot Nano temp/humidity to ESP8266-MQTT gateway issue:

    I don't think handing out dynamic IDs works with mqtt.

    It took me some time to find out that dynamic IDs don't work (yet?) with MQTT. Is there some documentation about this? Perhaps a note about this could be added here or a feature request could be opened here?


  • Mod

    @mpp I've added a note to the MQTT gateway page, thanks for suggesting.


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 1
  • 6
  • 5

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts