Add light platform to Vistapool#172549
Open
fdebrus wants to merge 5 commits into
Open
Conversation
Exposes the pool light (light.status) as a single ColorMode.ONOFF light entity. Writes go through AquariteClient.set_value; AquariteError becomes a translated HomeAssistantError using the existing set_failed key. State is delivered by the existing Firestore push subscription, so no optimistic updates or explicit refresh on the write path.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a Light platform to the Vistapool integration to expose pool light control as a Home Assistant light entity.
Changes:
- New
light.pyplatform withVistapoolLightentity supporting on/off via the Aquarite API, with error translation. - Registered
Platform.LIGHTin the integration setup, added translations for the new entity andset_failederror, and updated quality scale rules. - Added unit tests and snapshots covering setup, state coercion, turn on/off service calls, and API error handling.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| homeassistant/components/vistapool/init.py | Adds Platform.LIGHT to the platforms list. |
| homeassistant/components/vistapool/light.py | New light entity implementation with on/off control. |
| homeassistant/components/vistapool/strings.json | Adds translations for the pool light entity and set_failed error. |
| homeassistant/components/vistapool/quality_scale.yaml | Updates rule statuses now that actions exist. |
| tests/components/vistapool/test_light.py | New tests covering the light platform. |
| tests/components/vistapool/snapshots/test_light.ambr | Snapshot of the new light entity. |
8 tasks
joostlek
reviewed
May 29, 2026
Comment on lines
+28
to
+32
| "light": { | ||
| "pool_light": { | ||
| "name": "Pool light" | ||
| } | ||
| }, |
Member
There was a problem hiding this comment.
The device name is already prepended, so how much does Pool add to the entity name?
Contributor
Author
There was a problem hiding this comment.
Good catch ! Dropping to "Light" so the friendly name renders as "My Pool Light" instead of "My Pool Pool light". There's only ever one light fixture per controller, so the unqualified name is unambiguous
Confirms the HomeAssistantError raised by the turn_on/off handler is the expected set_failed one rather than an unrelated HomeAssistantError.
The device name ("My Pool") is already prepended for entities with
has_entity_name=True, so the friendly name was rendering as "My Pool
Pool light". Drops the redundant prefix so it reads "My Pool Light".
The auto-derived entity_id cascades to light.my_pool_light.
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 70821bb.
Comment on lines
+47
to
+52
| def is_on(self) -> bool | None: | ||
| """Return true if the light is on.""" | ||
| value = self.coordinator.get_value(_VALUE_PATH) | ||
| if value is None: | ||
| return None | ||
| return value in (True, "1") |
Comment on lines
+62
to
+67
| async def _async_set_value(self, value: int) -> None: | ||
| """Send a value update via the Vistapool cloud API.""" | ||
| try: | ||
| await self.coordinator.api.set_value( | ||
| self.coordinator.pool_id, _VALUE_PATH, value | ||
| ) |
Comment on lines
+69
to
+73
| raise HomeAssistantError( | ||
| translation_domain=DOMAIN, | ||
| translation_key="set_failed", | ||
| translation_placeholders={"entity": self.entity_id}, | ||
| ) from err |
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 light platform to the Vistapool integration. Exposes the pool light as a single on/off entity, mirroring what the Hayward app shows.
light.status,ColorMode.ONOFF,_attr_supported_color_modes={ColorMode.ONOFF}.Implementation notes
Same patterns as the open
switch/number/selectPRs:EntityDescriptiontuple needed for a single static entity; the description scaffold would be overkill here).entry.runtime_data.coordinators.values()for multi-pool support.is_onuses the samevalue in (True, "1")coercion the switch platform settled on.aioaquarite.AquariteClient.set_value.AquariteErrorbecomes a translatedHomeAssistantErrorusing the existingset_failedtranslation key.async_request_refresh()— the coordinator's Firestore push (subscribe_pool_resilient) delivers the state update typically within sub-second latency, same "trust the push" pattern as the other write-capable platforms.quality_scale.yamlaction-exceptionsmoves fromexempttodone.Tests
tests/components/vistapool/test_light.pycovers:test_all_entitieswithsnapshot_platform(pins the registry entry + state).light.status=0→STATE_OFF)."1"→STATE_ON).turn_on/turn_offround-trip throughset_valuewith the correct 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: