mysensors / MySensors

MySensors library and examples
https://www.mysensors.org
1.31k stars 891 forks source link

Proposal: allow nodes to communicate their timeout threshold #1350

Open flatsiedatsie opened 4 years ago

flatsiedatsie commented 4 years ago

Current controllers, like Domoticz, have a universal 'timeout' period. If the node does not communicate for a certain time period, the device should be set to 'offline'.

However, the actual transmission frequency for nodes may very greatly, making the universal period quite unwieldy. For example, a temperature sensor may transmit every minute, while a soil moisture sensor may transmit every 24 hours.

It would be useful if a node could tell the controller its intended transmission frequency / optimal timeout period during the presentation phase. Then, if the node doesn't transmit for a while, the node could be set to offline.

I don't know what the best way to implement this would be.

This period could even be communicated per child. Then if a single sensor is faulty and no new values are communicated (because the value doesn't change), then this could raise the alarm.

See also: https://forum.mysensors.org/topic/10674/mysensor-things-show-up-as-active-when-they-are-unplugged

Nca78 commented 4 years ago

I think a "per child" timeout is a bit excessive, and usually most nodes force sending after x sleep loops without data change, so it would not be very efficient.

It would seem logical to me to tie this to the heartbeat functionality, and to have it sent together with the I_HEARTBEAT_REQUEST command ? We could have an optional parameter to the sendHeartbeat() method to send the timeout duration ?