Relay Node with Fallback feature, if network is lost or controller is failing...
monics last edited by
Do you have any ideas/hints/best practices or examples on how to make a Relay Node, where the relay will turn off, if the network connection is lost or the controller fails? My starting point is the MySensors Relay sketch.
The intention is a safety feature that will turn off a relay if "control" is lost... either if the network connection is lost or controller for some reason should fail.
To my knowledge MySensors is a stateless connection, so you can not know when the connection is lost after the node has been initialized. Also when a node is connected to a repeater node, I was told you will get an ack from the repeater even if it fails to deliver the message.
I'm more curious to what you want to achieve, or what you've hooked up to that relay?
ejlane last edited by
@monics To know whether the controller was online and working, you could do something simple like request a variable from it, or just check on/request the time every so often. If it responds then things are good, and if it times out then you've got a problem and you can act on it.
eiten last edited by
@monics A simple solution would be to code sketch in a way that it switches off the relay automatically after, let's say, 10 seconds. On the controller side, send a ON message every 9 seconds.
Depending what's connected to a relay, I wouldn't make it go on or off depending on the controller state. It can lead to dangerous behaviour and it's prohibited by law in my country.
In all honesty I have my Sensors running for a long long time. It's stable and more reliable than anything else I have running in my home.
But like @eiten says yo could write a sketch that queries for a variable. But I think I'd go for a controller side solution. That would "ping" my node and send a nottfication to my phone whenever the node can't be reached.