-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Update Somfy to reduce calls to /site entrypoint #51572
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
Update Somfy to reduce calls to /site entrypoint #51572
Conversation
3c5524e
to
0967543
Compare
I cannot currently test my fix. For any reason, Somfy API returns a device I don’t own 👎 |
740cfd3
to
b921e01
Compare
After some exchange with Somfy support, they review their quota limitation. Once a site is retrieved, we can chain with another call to get the device. Tested locally, without any issue (finally 🎉 ) |
@tetienne Can we adjust the tests so we can include it in the July release? |
I will check asap. |
Test is failing because |
Don’t know how to correctly mock, so I updated the code :( |
This reverts commit fb56c9c.
@tetienne Reverted the change and added a mock to the setup entry (which is how we generally do that with testing config flows). |
Awesome, many thx @frenck |
Co-authored-by: Franck Nijhof <git@frenck.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the comments in a new PR. Thanks!
devices = await self.hass.async_add_executor_job( | ||
self.client.get_devices, site_id | ||
) | ||
self.site_device[site_id] = devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please only wrap the line that can raise in the try... except block.
from .const import DOMAIN | ||
|
||
|
||
class SomfyEntity(CoordinatorEntity, Entity): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to inherit Entity
when inheriting CoordinatorEntity
.
@@ -0,0 +1,71 @@ | |||
"""Helpers to help coordinate updated.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please exclude all new untested modules from coverage calculation in .coveragerc
.
Breaking change
Proposed change
Somfy recently changed the rules about polling their server to get the latest status. The purpose of this PR is to apply these rules.
Release notes:
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: