Skip to content

Add select platform to Vistapool#172547

Open
fdebrus wants to merge 7 commits into
home-assistant:devfrom
fdebrus:vistapool-select
Open

Add select platform to Vistapool#172547
fdebrus wants to merge 7 commits into
home-assistant:devfrom
fdebrus:vistapool-select

Conversation

@fdebrus
Copy link
Copy Markdown
Contributor

@fdebrus fdebrus commented May 29, 2026

Proposed change

Adds the select platform to the Vistapool integration. Lets users pick controller modes from Home Assistant.

Selects exposed (per pool, all EntityCategory.CONFIG):

  • Pump modefiltration.mode. Options: manual, auto, heat, smart, intel.
  • Pump speedfiltration.manVel. Options: slow, medium, high.
  • Filtration timer speed 1 / 2 / 3filtration.timerVel{1,2,3}. Same speed options.

Implementation notes

Same patterns as the merged sensor / open binary_sensor / switch / number:

  • VistapoolSelectEntityDescription extends SelectEntityDescription with value_path and exists_path (single path or tuple). The inherited options: list[str] | None serves both as the HA-facing option set and the integer-to-name mapping for read/write.
  • Three timer-speed descriptions are generated via *(VistapoolSelectEntityDescription(...) for i in (1, 2, 3)) instead of three near-identical literals.
  • current_option indexes into options using a _to_index helper that tolerates string-int values from the API (int("3")3) and returns None for missing / unparseable / out-of-range raw values.
  • async_select_option writes the option's index back via AquariteClient.set_value. AquariteError becomes a translated HomeAssistantError using the existing set_failed translation key (introduced in the switch PR).
  • quality_scale.yaml action-exceptions moves from exempt to done.

Tests

tests/components/vistapool/test_select.py covers:

  • Default fixture: test_all_entities with snapshot_platform (pins every entity's registry entry + state).
  • Parametrized current_option happy path across int indices (0, 2, 4) and a stringified-int ("3").
  • Parametrized current_option unknown across missing (None), non-numeric string, and out-of-range index.
  • Parametrized select_option across pump_mode, pump_speed, and a filtration_timer_speed_* to pin the round-trip and the API path each entity writes to.
  • Error path: AquariteError from the library is re-raised as HomeAssistantError.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue: binary_sensor PR (Add binary_sensor platform to Vistapool #172234), switch PR (TBD), number PR (TBD)
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Adds the select platform so users can choose pool-controller modes
from Home Assistant. Five entities exposed (all EntityCategory.CONFIG):

- Pump mode (filtration.mode) - manual / auto / heat / smart / intel
- Pump speed (filtration.manVel) - slow / medium / high
- Filtration timer speed 1-3 (filtration.timerVel{1,2,3}) - slow /
  medium / high each

VistapoolSelectEntityDescription extends SelectEntityDescription with
value_path and exists_path; the inherited options list serves as both
the HA-facing option set and the integer-to-name mapping. current_option
indexes into options using a _to_index helper that tolerates string-int
values from the API. async_select_option writes back via
AquariteClient.set_value with the option's index; AquariteError becomes
the existing translated set_failed HomeAssistantError.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a select platform to the Vistapool integration (pump mode/speed and timer speeds), including entity translations and new tests/snapshots.

Changes:

  • Implement Vistapool SelectEntity support with multiple select entity descriptions and write-back via the API.
  • Add translations for new select entities and a new translated error message for set failures.
  • Add test coverage + snapshots for select entities, and enable the select platform in the integration.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/components/vistapool/test_select.py New tests validating select entity creation, option mapping, service calls, and error handling.
tests/components/vistapool/snapshots/test_select.ambr New snapshots for registry entries and states for the added select entities.
homeassistant/components/vistapool/strings.json Adds select entity translations and a set_failed error translation key.
homeassistant/components/vistapool/select.py New select platform implementation including option mapping and API write-back.
homeassistant/components/vistapool/quality_scale.yaml Updates quality scale rule annotations related to actions.
homeassistant/components/vistapool/init.py Enables the select platform alongside sensor.

Comment thread homeassistant/components/vistapool/select.py
Comment thread homeassistant/components/vistapool/select.py
Comment thread tests/components/vistapool/test_select.py
Copilot AI review requested due to automatic review settings May 29, 2026 08:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/vistapool/select.py
Comment thread homeassistant/components/vistapool/select.py
Comment thread homeassistant/components/vistapool/select.py
Comment thread homeassistant/components/vistapool/select.py
Confirms the HomeAssistantError raised by the select_option handler is
the expected set_failed one rather than an unrelated HomeAssistantError.
@fdebrus fdebrus marked this pull request as ready for review May 30, 2026 15:59
Copilot AI review requested due to automatic review settings May 30, 2026 15:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread homeassistant/components/vistapool/select.py
Comment thread tests/components/vistapool/test_select.py
Comment thread tests/components/vistapool/test_select.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c45432bc4d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread homeassistant/components/vistapool/select.py
claude added 2 commits June 1, 2026 12:18
The case passes filtration.mode=None (present-but-null), not an absent
key, so the label is now accurate. Both null and missing-key routes
flow through coordinator.get_value("filtration.mode") == None and
land in the same "unknown" state, so coverage is unchanged.
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.
Copilot AI review requested due to automatic review settings June 1, 2026 12:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Comment on lines +71 to +78
if description.exists_path is not None:
required = (
(description.exists_path,)
if isinstance(description.exists_path, str)
else description.exists_path
)
if not all(coordinator.get_value(path) for path in required):
continue
Comment on lines +131 to +136
try:
await self.coordinator.api.set_value(
self.coordinator.pool_id,
self.entity_description.value_path,
index,
)
Comment on lines +123 to +130
try:
index = options.index(option)
except ValueError as err:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="set_failed",
translation_placeholders={"entity": self.entity_id},
) from err
Comment on lines +137 to +142
except AquariteError as err:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="set_failed",
translation_placeholders={"entity": self.entity_id},
) from err
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()

assert hass.states.get("select.my_pool_pump_mode").state == "unknown"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants