Mysensors 2.2.0: need to force restart of nodes if controller or gateway are not available. How to do?


  • Hardware Contributor

    Hi to all! My environment: Domoticz on RPI3 + Battery LIfePo4 nodes (temp/hum, baro etc). Preamble: all nodes with RFM69W and HW on the gateway. All is very stable from +3 months, no restart, all works as charme.

    From a couple of week I have issues with domoticz that hangs (I will need to solve, but this is another story).

    I need, absolutely, to force the nodes to check if uplink (gateway/domoticz) is "alive", if not, sleep and repeat for infinite, until I can restart Domoticz.

    In effect my nodes for the moment have this logic: try send for 30 times, if cannot receive an ACK delay 5000. I have watchdog at 2 sec, so of course the node restart. For same strange obscure reason, node hangs instead when Domoticz off.

    TL;DR:

    Currently, this is my sketch: https://pastebin.com/raw/0qWBn6iQ

    I found this instructions:

    https://www.mysensors.org/apidocs/group__RoutingNodeSettingGrpPub.html#ga7117d6c2ab335ad8a03caae3ef2c46e7

    If I did understand right, can I at the start of the sketch for node add simply:

    #define MY_TRANSPORT_SANITY_CHECK true
    #define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS 10 * 60 * 1000ul

    To check every 10 minutes the transport?

    1. What will be happening if transport is not ready? It will go to sleep? Eg. Node sleeping. Awaking after 10 minutes, tryng to transmit and No uplink available. It will be restart continuously? Is it possible to put in sleep for example 10 minutes and retry and go on?
    1. I cannot understand the purpose of:

    MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 10000 Timeout (in ms) to re-establish link if node is put to sleep and transport is not ready.

    (got here https://www.mysensors.org/download/sensor_api_20 )

    Thank you



  • Hi,
    Are you sure about node hang ?
    i've read your sketch but i don't see wdt_reset().
    I'm not sure but for canceling watchdog timer shouldn't you call wdt_reset() ?
    that can't explain node hang but take a look.
    Eric.


  • Mod

    I usually enable wdt at beginning of loop and disable it before sleep


  • Hardware Contributor

    @eric007 Yes, Im sure at 100%. No more transmit. Also if I heat sensors with my Hands (and After 6h the temp surely changed a bit). I think that wd reset is called internally by MyS. If controller and gateway are live, I have no issues. So I think (also answering to @gohan ) that It is not an issues....


  • Mod

    What boards definitions are you using for arduino?


  • Hardware Contributor

    @gohan do u mean bootloader? Optiboot with BOD @1.8 with AA and @2.7 with LifePo4


  • Mod

    In arduino IDE, boards manager

    0_1529873291107_f4bc9c8e-0716-46a1-8264-54b05d8aa6ff-image.png


 

336
Online

7.5k
Users

8.4k
Topics

90.4k
Posts