-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
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
Decrease timeout
and update_interval
in Xiaomi Miio integration
#57339
Decrease timeout
and update_interval
in Xiaomi Miio integration
#57339
Conversation
This pull request needs to be manually signed off by @home-assistant/core before it can get merged. |
Hey there @rytilahti, @syssi, @starkillerOG, mind taking a look at this pull request as it has been labeled with an integration ( |
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.
Looks good to me, since we have all data synced central place
This might be problematic with my vacuum at least, as it relies on a re-try every update cycle (the internal python-miio timeout being 5s, so the updates take a bit longer). I'll give this a test later today, but maybe we should also adjust the the |
I'm afraid to change timeout in |
Tested to work with non-cloud gen1 with timeout=10, update_interval=15. The timeout of 5s is too fast in some failure cases as python-miio itself has that as a default timeout, making it fail intermittently on cases where the device is not responsive for a reason or another. I created rytilahti/python-miio#1158 as a todo to reduce the timeouts in python-miio. My previous recommendation for reducing the timeout in homeassistant using the construct parameter does not work as the method signatures are not consistent (rytilahti/python-miio#1156). |
Looks good to me. |
@@ -70,6 +70,9 @@ | |||
|
|||
_LOGGER = logging.getLogger(__name__) | |||
|
|||
POLLING_TIMEOUT_SEC = 10 | |||
UPDATE_INTERVAL = timedelta(seconds=15) |
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.
Is this the most safe update interval in most cases?
Users that want a different update interval can turn off automatic polling and automate the update at their own update interval. This is built in when using config entries and the update coordinator or builtin basic polling entities.
So we should not decrease the default update interval at the risk of other problems due to some users needing a shorter interval.
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 have been testing this change from @rytilahti for several days. The devices have no problems with the current values. But of course, we are not able to test all device models.
Before DataUpdateCoordinator
implementing, the integration updated device state every 30 seconds. Maybe we should return to this value if you think the current value is too low.
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.
Yes, this seems to be working fine except on special cases (like watchdog rebooting the device because it has no cloud access) but I would be fine with 30s update interval, too.
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.
Let's merge this now, and adjust/revert if necessary. Thanks a lot @bieniu for making me to take a look at the (not so great) backend lib behavior that should be fixed for the future release!
@rytilahti No problem, we accidentally found a place for improvement 😉 |
Breaking change
Proposed change
This PR:
- decreases data update timeout from 10 to 5 seconds (this is a local communication so 5 seconds is sufficient)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: