Rewrite integration on DataUpdateCoordinator with typed regulation setters#5
Open
patrickweh wants to merge 3 commits into
Open
Rewrite integration on DataUpdateCoordinator with typed regulation setters#5patrickweh wants to merge 3 commits into
patrickweh wants to merge 3 commits into
Conversation
…tters
- Replace inline polling hub with PowerDogClient + DataUpdateCoordinator
- Parse Setable string and expose ManualValue (onoff) vs ManualSwitch / ManualAutoSwitch (manual) regulations as switches and numbers with the correct toggle parameter
- Honor regulation Min/Max so non-percent setables (e.g. PV surplus threshold) work
- Restore non-setable regulations as read-only sensors so existing entity ids survive
- Raise UpdateFailed and HomeAssistantError on API failures instead of silent fallbacks; client retries with timeout and resets the connection
- Drop obsolete select platform; preserve unique_id pattern (powerdog_{switch,number}_<key>)
…ch and number platforms - Pure unit tests for the XML-RPC client (Setable parser, retry/backoff, typed setters) - Integration tests via pytest-homeassistant-custom-component for entity registration, ManualValue (onoff) and ManualAutoSwitch (manual) toggle paths, number Min/Max wiring, and coordinator unavailability on PowerDogError - Config flow happy path and connection-error rendering - GitHub Actions workflow runs the suite on push and pull requests
PowerDog reports nan for calculated regulations such as 'Anforderung WP' when idle. HA's numeric sensor rejects non-finite values, so the previous implementation propagated a ValueError out of every coordinator update — that bubbled up through async_request_refresh and turned every number set service call into a 500 for the caller (e.g. EVCC). Map nan/inf to None so the entity renders as unknown instead of crashing.
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.
Summary
PowerDogClient+DataUpdateCoordinatorarchitecture so HA owns the update lifecycle and can mark the integration unavailable when the device is offline.Setablefield and route writes through the correct parameter:ManualValueregulations are toggled viaonoff,ManualSwitch/ManualAutoSwitchviamanual. Switch state is read fromOnOfforSwitchModeaccordingly.Min/Maxfor setable regulations so non-percent controls such as the PV surplus threshold (0-7000 W) work as numbers.sensor.*entity ids survive the rewrite.unique_idpatterns (powerdog_<key>,powerdog_switch_<key>,powerdog_number_<key>) are preserved.UpdateFailedand entity writes raiseHomeAssistantErrorinstead of silently logging. The client retries with a timeout, resets the XML-RPC connection on transport errors, and verifies set calls.selectplatform; switches and numbers now cover ManualAutoSwitch regulations directly.