iMicknl / ha-tahoma

Custom component for Home Assistant to interact with smart devices via Somfy TaHoma or other OverKiz based API's.
MIT License
152 stars 30 forks source link

Implement optional update coordinator to call `refreshState` periodically #167

Open iMicknl opened 4 years ago

iMicknl commented 4 years ago

Is your feature request related to a problem? Please describe. When we move towards using an event based approach for updating states (#1), it would be good to understand if we need to refresh the states manually for specific devices, or if we can do it in batch.

For example;

Describe the solution you'd like Getting rid of manually calling all refresh endpoints would be best, or scheduling a refresh of all states periodically.

Describe alternatives you've considered Maintaining a list of states that have to be refreshed manually.

iMicknl commented 4 years ago

Just found a reference to stateRefreshCommand in https://www.tahomalink.com/enduser-mobile-web/steer-html5-client/vendor/somfy/io/alarm/alarm.js. Is worthwhile to investigate.

stateRefreshCommand: {commands: "refreshState", label: i18n.refreshState},
iMicknl commented 4 years ago

https://github.com/dubocr/homebridge-tahoma/blob/984a8e440e081a3f34960a0303bcbda245f60de6/overkiz-api.js#L407

The HomeKit (via homebridge) integration is also calling this endpoint every x minutes (based on user setting). We could add this as well, next to our regular data update coordinator.

tetienne commented 3 years ago

What about doing this automatically if we detect a device required it ?

iMicknl commented 3 years ago

What about doing this automatically if we detect a device required it ?

I had the same thought this morning, would make a lot of sense. Just enable this for the devices where we require it and don't make it user configurable.