Mysensors - Keep alive / LWT (last will, testament)?
-
Hi,
i am evaluating mysensors and it's quite interesting and easy to understand! Just, what i was looking for!:) But i am missing a feature, which enables the gateway/controller to detect node-failures. At the moment i have a mqtt-client-gateway running very nicely. But i dont know how to configure /implement a feature, that i get a mail/info/note (red LED blink) when a node dies, goes "offline" or does not send sensor-values any more.
In mqtt this is called LWT (last will, testament). Is there something comparable in mysensors?
Any ideas howto get this?Sry for my english, i am native german
greetings
Andreas
-
@ahhk you could have the sensor send a value update at regular, known intervals. Track the arrival of these updated values from some client that subscribes to the mqtt topics. When no new value arrives within a certain time (e.g. 3 times the sensor update interval) you can consider the sensor to be off-line. When a new value does come in again from an offline sensor, the sensor is online again.
This logic can easily be accomplished by e.g. node-red.
-
Added a dedicated heartbeat message in the development branch a while ago. But you must actively send it from your node. So any "smart" gateway/controller implementation (with LWT functionality) should take normal messages into account also... as sending heartbeats should really only be needed when node doesn't have anything "real" to transmit.
https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/MySensor.h#L226
-
Hi,
sending a "heartbeat" or other value regularly is not a problem. The processing of this on gateway/controller-side is missing. I hoped to find a feature like:
- Node presents sensor to controller/gateway WITH time-intervall-value
- The controller /gateway sends alert-message if node doesnt send for >presented time-intervall-value...
(-perhaps a manual "offline-switch"-function to disable alarm/node/sensor)
This would be really great...does anybody know if something like this is on the roadmap for mysensors?
I will take a look into scripting (mqtt+python?) to realise my alert-function...
GreetingsAndreas
-
The gateway is stateless today and there is good reasons for keeping it that way.
So it is really up to the controller plugin developer (or in your case using some scripting) to implement a "offline" feature when sensor hasn't reported any values in due time. What is a valid interval should probably be configurable per node.
-
Although i like the idea, it will force you to send a value even if it has not changed. Defeats a bit a battery optimized sensor node.
Suggested Topics
-
MQTT-SN
General Discussion • 29 Nov 2014, 10:00 • binladin 30 Nov 2014, 17:42 -
Energy Pulse Meter strange behaviour
Troubleshooting • 13 Dec 2014, 14:00 • mbj 3 Jan 2015, 20:44 -
Need help with Turning a LED On/Off with OpenHab and MQTT.
Troubleshooting • 24 Mar 2015, 19:19 • kunall 29 Mar 2016, 14:33 -
Incoming MQTT Prefix can't have '/' or '-' in it.
Bug Reports • 13 Nov 2016, 16:19 • Meshx86 13 Nov 2016, 16:38 -
ESP8266MQTTClientGateway
Bug Reports • 30 Jan 2016, 10:26 • mbj 30 Jan 2016, 14:16 -
thethingbox
General Discussion • 12 Feb 2015, 01:00 • gregl 21 Feb 2015, 02:24 -
Stabile Controller
Troubleshooting • 5 Mar 2015, 14:08 • C.r.a.z.y. 8 Mar 2015, 15:34 -
Raspberry Pi Zero WH as gateway?
Hardware • 18 Jan 2018, 18:22 • sentur 18 Jan 2018, 20:08