Update thing status when bridge becomes online / offline [message #1720137] |
Thu, 14 January 2016 16:50 |
Jan Bender Messages: 3 Registered: January 2016 |
Junior Member |
|
|
When the user is interacting with his smarthome devices, the thing status should always resemble the actual status of the devices. If a device is online, the thing status should be "online" and "offline" if the device is not connected to the network.
Implementing this behaviour might be simple if there is just one thing, but it becomes more difficult if you have multiple, hierarchically structured things. To name a few cases:
1. The bridge goes offline. In this case, all children have to be set to "offline" as well.
2. The bridge goes offline again. In this case, all children that are connected to the network must be set to "online" again.
3. A thing goes offline and must be set to offline (and vice versa).
The first and the third case are the most simple. For the first case you just check for the bridge status and all things are set to offline is the bridge is offline. For the third case you could check the thing's status every x seconds / minutes and set it status accordingly. But for the second case, you need to check if the things are connected as well and you cannot set them all to "online" automatically.
As developers, we do have to implement methods manually so that the thing status gets updated. As this is a task that have to be performed for every binding, what to you thing of adding this functionality ESH? The BaseThingHandler could hold functionality for automatically checking the status of the thing. The BaseBridgeHandler could hold similar functionality and if the bridge becomes offline again, it could call a method on the children to update their status as well.
From our point of view, such implementation would benefit all binding developers. What is your stance on this?
Best regards
Jan
|
|
|
|
Powered by
FUDForum. Page generated in 0.01533 seconds