Add switch platform to Vistapool#172540
Open
fdebrus wants to merge 4 commits into
Open
Conversation
Adds the switch platform that turns Vistapool from a read-only
monitoring integration into one that can actually control the pool.
Exposes:
- filtration toggle (filtration.status)
- 4 generic relay outputs (relays.relay{1-4}.info.onoff), with the
read-only status field OR'd into is_on so the entity shows the
effective state when the device is currently driving the relay
- electrolysis cover / electrolysis boost toggles (gated on hasHidro)
- heating climate toggle (dynamic, gated on filtration.hasHeat)
- smart-mode freeze protection toggle (dynamic, gated on
filtration.hasSmart)
Writes go through aioaquarite's AquariteClient.set_value(); AquariteError
is translated to HomeAssistantError with a translated message. The
quality_scale.yaml action-exceptions rule moves from exempt to done
now that the integration has user actions.
8 tasks
Confirms the HomeAssistantError raised by the turn_on/off handler is the expected set_failed one rather than an unrelated HomeAssistantError.
0.5.1 wraps aiohttp.ClientError and asyncio.TimeoutError from both the REST send_command path and the upstream auth client refresh in ConnectionError (an AquariteError subclass), so transport failures surface as the translated set_failed HomeAssistantError via the existing except AquariteError clause.
This reverts commit 5319541.
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.
Proposed change
Adds the switch platform to the Vistapool integration. This is the first PR that lets users actually control their pool from Home Assistant instead of just observing it. Follow-up to the sensor PR (#168051) and the binary_sensor PR (#172234), per joostlek's "one platform per PR" guidance.
Switches exposed (per pool):
filtration.statustoggle.relays.relay{1-4}.info.onofftoggles for the four generic relay outputs.is_onORs the writableonoffwith the read-onlystatusnext to it, so the entity correctly reads "on" when the device is currently driving the relay regardless of how the toggle was last set.hidro.cover_enabled/hidro.cloration_enabled, gated onhasHidro.filtration.hasHeat(the "Climat" toggle under the HEAT slider in the Hayward app).filtration.hasSmart(Smart-mode freeze protection).Implementation notes
Same patterns as
sensor.pyandbinary_sensor.py:VistapoolSwitchEntityDescriptionextendsSwitchEntityDescription.exists_path(single path or tuple) instead of inlineifblocks.entry.runtime_data.coordinators.values()for multi-pool support.AddConfigEntryEntitiesCallback,PARALLEL_UPDATES = 1,translation_key-only naming, unique IDs viabuild_unique_id(description.key).Writes go through
aioaquarite'sAquariteClient.set_value(pool_id, path, value).AquariteErroris caught and re-raised asHomeAssistantErrorwith a translatedset_failedmessage, which moves thequality_scale.yamlaction-exceptionsrule fromexempttodone.Tests
tests/components/vistapool/test_switch.pycovers:test_all_entitieswithsnapshot_platform(pins every entity's registry entry + state).statusfield is OR'd intois_on).heating_climateonly whenfiltration.hasHeatis set;smart_mode_freezeonly whenfiltration.hasSmartis set.turn_on/turn_offround-trip throughset_valuewith the correct(pool_id, path, value)args.AquariteErrorfrom the library is re-raised asHomeAssistantError.Type of change
Additional information
Checklist
ruff format 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.To help with the load of incoming pull requests: