Presentation of 3rd sensor for a node fails....

  • Hi:

    I've got a remote sensor with 3 child sensors....temp, humidity and battery voltage.

    Gateway is a ESP6266 running the MQTT sketch.

    Both sensor and GW are running the latest 2.0.0 stable code base.

    When the sensor node powers up it registers fine....but only successfully sends the first two presentation requests. The 3rd request (for multimeter voltage) fails for some reason.

    If I put a 500 ms delay between the presentation of the 2nd and 3rd sensors, it succeeds.

    Any idea what might be causing this? Is the gateway just not responding fast enough to the first two requests?

    Here is the debug log from the sensor node startup, without delays, so the 3rd presentation fails. Interesting that the first registration request also fails.

    Starting sensor (RNNNA-, 2.0.0)
    TSP:MSG:SEND 104-104-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-104 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:CHKID:OK (ID=104)
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 104-104-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-104 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:MSG:SEND 104-104-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
    TSP:MSG:SEND 104-104-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
    TSP:MSG:SEND 104-104-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
    TSP:MSG:READ 0-0-104 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    TSP:MSG:SEND 104-104-0-0 s=255,c=3,t=11,pt=0,l=20,sg=0,ft=0,st=ok:DHT-22 Humidity-Temp
    TSP:MSG:SEND 104-104-0-0 s=255,c=3,t=12,pt=0,l=4,sg=0,ft=0,st=ok:1.04
    TSP:MSG:SEND 104-104-0-0 s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 104-104-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=ok:
    !TSP:MSG:SEND 104-104-0-0 s=200,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=fail:
    Request registration...
    !TSP:MSG:SEND 104-104-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=fail:2
    TSP:MSG:SEND 104-104-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=2,st=ok:2
    TSP:MSG:READ 0-0-104 s=255,c=3,t=27,pt=1,l=1,sg=0:1
    Node registration=1
    Init complete, id=104, parent=0, distance=1, registration=1


  • Mod

    @chaeron assuming you're using nrf24 as radio, I guess messages get lost during presentation as the gateway is not able to handle all incoming packets. The nRF has a 3 message buffer which is too small to handle all the incoming packets. Introducing a small delay will give the gw time to process the messages.
    Not much else you can do, apart from enable queuing of incoming messages, but this isn't supported for esp (yet)...

  • Yes....I"m using NRF24 radios at both ends.

    Didn't realize they had a 3 message buffer only. That might explain it. Delays seem to help out, and since the sensors only send stuff intermittently, don't affect anything.

    Sensor nodes are all based on Pro Mini's running at 3.3v, 8mhz.

    I found that sending two messages consecutively, with no code between (battery % and voltage in my case) could have similar symptoms....2nd send fails. Adding a short delay seems to help this.


  • Mod

    This is a common symptom. Using a delay seems to be the most common solution/workaround.

  • Is there a recommendation how long the delay should be?

    I tried 50ms and it was working but I think the shorter the time, the better it would be for a batterie based sensor node.

  • Mod

    @gloob for the presentation it doesn't matter. The presentation is done when the node boots. If your node reboots often you have other problems 🙂

    For other messages, nobody knows. A delay shouldn't be needed at all, but seems to help, so you'll have to experiment.

  • we talking about "gw.wait()" or "delay()"?

  • I was just about to post a similar conclusion after a hard night trying to figure out why one of my three presentations didn't work (was it my code, HASS, the mqtt-gateway Mys2.1.0 etc..).
    Introducing a short gw.wait(X) between each presentation did indeed help. In my case it has been quite random if the second or third presentation fails to register. 20ms was to short but 100ms seems to work
    Is there anywhere this could be saved for later, e.g. in the TempHumidity sketch?

  • Maybe someone tried slightly more smart way of sending presentation messages instead of using delay? Can we use bool ack param of present() function to check delivery and send next (or resend current) only after we have received delivery report?

  • @robosensor
    I have tried the bool in the present() function but it doesn't help setting it to true...

Log in to reply

Suggested Topics

  • 1
  • 3
  • 20
  • 8
  • 2
  • 10
  • 5
  • 1