Repository navigation
Keep GALEVO data when one cloud request fails - #12
Merged
Merged
Conversation
One failing cloud request made every entity unavailable: - an empty consumption sequence raised IndexError in the energy update; - a 500 from the menu items request failed the whole state update, though the data items were fine; - some gateways answer 500 to the full data items request but not to smaller parts, so every poll failed. Now an empty sequence gives None, a menu 500 or 550 keeps the last menu items, and a data items 500 is asked again in halves (split again on 500) with at most 4 part requests per read. The part count is kept for an hour per gateway. A menu value that is an error or a probe limit value (3276.0, 3276.7, -3276.8, -3277.0) is None. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A single 500 can be a short cloud problem. Keeping the parts for an hour after it doubled the requests per read for that hour, just when the cloud was busy. Now one read with a 500 asks in parts only for itself; the parts are kept after two reads in a row with a 500 for the full request, and a full answer resets the count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One failing cloud request no longer makes every entity unavailable. An empty energy sequence gives None, a menu items 500/550 keeps the last menu items, and a GALEVO data items 500 is asked again in smaller parts (at most 4 extra requests per read; after 2 failed reads in a row the parts are kept 1 hour per gateway). Menu values that are errors or probe limit values (3276.0, 3276.7, -3276.8, -3277.0) are None. Covers fustom integration issues #514, #520, #492 / #525 and the menu check from fustom/python-ariston-api#195.
Changes
_get_consumption_sequence_last_value:Nonewhenvis empty or missing (#514:IndexErrorat the first energy update).update_state/async_update_state: a menuConnectionExceptionwith status 500 or 550 logs a warning and keeps the last menu items; other errors still raise. The data items are no longer lost with it (#520).get_properties/async_get_properties(#492 / #525):{"items": [...]}. If no part answers, the first error is raised and nothing is kept.useCache: trueretry (upstream fix: issue 525 and issue 26 fustom/python-ariston-api#193 / #196 sends up to ~25 requests per poll)._get_menu_item_by_id: forvalue,Nonewhenerroris true, the value isNone, or the value is one of the limit values above. Other keys (unit, options) are returned as before.error_status(error)inariston_api.py(HTTP status of aConnectionException, orNone).Notes for review
maxor to a negativemin" as the menu check. I used the fixed set of limit values instead: the owner's Nimbus has an enum menu item withvalue1.0 andmax1.0, which that check would drop. Upstream fustom#195 also moved to the fixed set ("preserve boundary menu values").0.0is kept (#539 does not prove zeros are a cloud marker).test_properties_without_error_send_one_request).Tests
Each new test fails on
main(checked by running the new tests against themaincode), except the guards that must already pass: one request without an error, no split for 401/403/502, menu 401 raises,0.0kept.tests/test_ariston_api.py: halves merged; one read with a 500 does not keep the parts (also fail, ok, fail); two reads in a row keep them for 1 hour, then the full request again; a failed half split again within 4 part requests with no part retry; all parts fail (first error raised, nothing kept); 401/429 in a part raises at once.tests/test_galevo_device.py: empty / missingv; menu 500/550 keeps old items (sync and async), 401 and no-status errors raise; menu limit values,error: true,NonegiveNone.192 tests pass, ruff clean.
🤖 Generated with Claude Code