Mysensors 2.2.0: need to force restart of nodes if controller or gateway are not available. How to do?
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.
Currently, this is my sketch: https://pastebin.com/raw/0qWBn6iQ
I found this instructions:
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?
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?
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 )
eric007 last edited by
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.
I usually enable wdt at beginning of loop and disable it before sleep
@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....
What boards definitions are you using for arduino?
@gohan do u mean bootloader? Optiboot with BOD @1.8 with AA and @2.7 with LifePo4
In arduino IDE, boards manager