Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: Add refresh_device_states #956

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

fetzerch
Copy link
Contributor

@fetzerch fetzerch commented Sep 2, 2023

python-overkiz-api already has a method to refresh all states of all devices. This method is used by the Somfy TaHoma web interface on login/start and it asks all devices to send their states to the gateway.

For some devices like the Somfy Dexxo io garage door motors, this call is essential because these motors do not always send their state updates automatically to the gateway and require a manual refresh. See my discussion with Somfy in Somfy-Developer/Somfy-TaHoma-Developer-Mode#26 (comment).

Now besides refreshing all states of all devices, the Somfy API also supports to refresh only the states of a specific device via setup/devices/{device_url}/states/refresh.

I'll also create a draft PR for homeassistant/core that shows how this method could be used to solve #167 (at least for garage doors and gates). But even independent of that, I believe it's a helpful addition to python-overkiz-api.

Screenshot of the Somfy API docs:
grafik

This method can be used to refresh all states of a single device.
It's mostly useful for devices that don't automatically send state
updates such as gate or garage door motors.
@fetzerch
Copy link
Contributor Author

fetzerch commented Sep 2, 2023

Related PR for homeassistant/core: home-assistant/core#99499

@iMicknl
Copy link
Owner

iMicknl commented Sep 2, 2023

I will review this + HA PR after my holidays (October). In the past we have already tried to implement such solutions, with a separate task interval in HA.

The most difficult thing is that users expect this to happen periodically, because they want state updates in HA when they execute a command outside HA. We don't like to poll this endpoint every x minutes, since this is not a best practice according to Somfy.

For TaHoma app it is easy, they just call this endpoint when you open the app. With HA all state updates should happen in the background.

@fetzerch
Copy link
Contributor Author

fetzerch commented Sep 4, 2023

Hey @iMicknl I know about the problems. It's really a pity that a workaround like this is needed. I replaced my older Dexxo Pro io with the newer Dexxo Smart io in the hope that this motor wouldn't have the limitation anymore - but it's the same. I was hoping that it's acceptable if we (1) limit the polling to the device(s) that really need it and (2) use a relatively high interval like 5m.

Happy to discuss the topic further with you once you're back. I'm slowly migrating over from the Nymea Somfy integration that I'm maintaining to Home Assistant and your Somfy integration. Thus the few PRs I've created. Enjoy your vacation! 🌞

Copy link

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😌

Copy link
Owner

@iMicknl iMicknl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

@iMicknl iMicknl merged commit e0ee1a7 into iMicknl:main Sep 19, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants