Repository navigation
fix(galevo): cache hybrid menu item IDs and back off on unparsable 429 blocks - #200
Conversation
|
Thanks @astrinh0 for the sharp review! Addressed all four points in
All |
…onor shared 429 deadline
|
Thanks @astrinh0! Addressed all four follow-up review notes and the SonarCloud checks in
|
|
Live test report from a real installation, focused on request volume. Setup
Requests per state poll (from debug logs)
Once, the properties POST was sent again ~6 s later after a slow answer. That is the existing transport retry, not this PR. Before this test the account was stuck in the bare Things that may matter for the review
I can rerun with debug logging on a newer commit if that helps. |
|
Live data from another GALEVO heat pump (NIMBUS,
|
|
@to3k when you could fix my comments please, to merge it |
|
@rudelafuente @Remper1997 and @to3k version v0.20.13 of the integration is ON |
Summary
Fixes a regression introduced in
0.19.16(confirmed live on a GALEVO NimbusHP_SYSheat pump with Home Assistant2026.11.2/ integrationv0.20.7, causing persistentHTTP 429: b'Requests are blocked'outages that forced a rollback tov0.20.6/0.19.15):Cache discovered GALEVO hybrid menu items per gateway (
AristonAPI._hybrid_menu_items)0.19.16(feat(galevo): support heat pump menu items and filter invalid menu values #195),get_menu_items/async_get_menu_items(..., include_hybrid_items=True)sentcore_values()plus all 4hybrid_groups()(and per-item500split retries) on every refresh (~5–10 GET requests per poll, doubled when HA triggersasync_refresh_after_set()after consecutive writes).gw_id), recording the core + supported IDs that succeeded intoself._hybrid_menu_items[gw_id].GET /menuItems/{gw_id}?menuItems=...request.HTTP 500, the gateway's cache entry is cleared and grouped discovery runs again once. Non-500failures (including429) never cache partial discovery results.Exponential cooldown on persistent
429without a parsable block duration429withb'Requests are blocked'(no"blocked for X seconds"message),_rate_limit_wait_secondsfell back to5son every single attempt, so retries and HA coordinator polls kept resetting/prolonging the server-side block window (22consecutive 429 errors observed in 19 minutes).5sretry on the first unparsable429(matching existing contract), also parse an integerRetry-Afterresponse header if present, and if429persists on retry or recurs (_rate_limit_streak), set_blocked_untilusing exponential cooldown (60s -> 120s -> 240s -> 480s -> 600smax, reset on200 OK)._blocked_until/ incremented_rate_limit_streak.Testing
.venv/bin/python -m coverage run --source=ariston -m unittest discover --start-directory tests:tests/test_ariston_api.pyandtests/test_rate_limit.pycovering sync/async menu-item caching,HTTP 500cache invalidation, incomplete429discovery non-caching,Retry-Afterheader parsing, and429cooldown escalation/reset).94%onariston/ariston_api.py).cc @astrinh0 (regression affecting
0.19.16/v0.20.7onHP_SYSdevices)