Skip to content

iaqualink: Add basic DHCP discovery for iAquaLink devices#168256

Draft
flz wants to merge 1 commit intohome-assistant:devfrom
flz:iaqualink-discovery
Draft

iaqualink: Add basic DHCP discovery for iAquaLink devices#168256
flz wants to merge 1 commit intohome-assistant:devfrom
flz:iaqualink-discovery

Conversation

@flz
Copy link
Copy Markdown
Contributor

@flz flz commented Apr 14, 2026

Breaking change

Proposed change

Add hostname-based DHCP discovery.

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:
  • 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:

Copilot AI review requested due to automatic review settings April 14, 2026 22:41
@flz flz changed the title Add basic DHCP discovery for iAquaLink devices iaqualink: Add basic DHCP discovery for iAquaLink devices Apr 14, 2026
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

This PR adds DHCP-based discovery for the iaqualink integration by matching iAquaLink-style hostnames and starting the existing user config flow with discovery context.

Changes:

  • Add DHCP matchers for iaqualink (manifest + generated DHCP matcher list).
  • Implement async_step_dhcp in the iAquaLink config flow and surface discovery details in the user step description.
  • Add tests covering DHCP discovery behavior and single-instance unique ID behavior.

Reviewed changes

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

Show a summary per file
File Description
homeassistant/components/iaqualink/config_flow.py Adds DHCP entrypoint, single-instance unique-id helper, and discovery text injection into the user step.
homeassistant/components/iaqualink/manifest.json Declares DHCP discovery pattern (iaqualink-*).
homeassistant/generated/dhcp.py Updates generated DHCP matcher registry for the new iaqualink hostname matcher.
homeassistant/components/iaqualink/strings.json Updates the user-step description to include a {discovery} placeholder prefix.
tests/components/iaqualink/test_config_flow.py Adds test coverage for DHCP-initiated flows and unique-id behavior.

async def _async_set_single_instance_unique_id(self) -> None:
"""Assign the unique ID used by this single-instance integration."""
await self.async_set_unique_id(DOMAIN, raise_on_progress=False)
self._abort_if_unique_id_configured(error="single_instance_allowed")
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Add the missing single_instance_allowed abort translation key so the new abort reason can be shown to users.

_abort_if_unique_id_configured(error="single_instance_allowed") requires a corresponding entry in homeassistant/components/iaqualink/strings.json (typically mapping to [%key:common::config_flow::abort::single_instance_allowed%]), otherwise the abort reason will be untranslated / fail translation validation.

Suggested change
self._abort_if_unique_id_configured(error="single_instance_allowed")
self._abort_if_unique_id_configured()

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +113
discovery = ""
if (
self.source == SOURCE_DHCP
and self._discovered_hostname is not None
and self._discovered_ip is not None
):
discovery = (
"A likely iAquaLink device was discovered on your network at "
f"{self._discovered_ip} ({self._discovered_hostname}). "
)

return self.async_show_form(
step_id="user",
data_schema=CREDENTIALS_DATA_SCHEMA,
description_placeholders={"discovery": discovery},
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Make the DHCP discovery message translatable by moving the user-facing sentence into strings.json and only passing raw values as placeholders.

Right now the discovery text is hard-coded in English in the config flow and injected via {discovery}. Consider adding a dedicated discovery/confirm step (with description placeholders like {ip} and {hostname}) or a separate translated description key, so translations can render the message properly.

Suggested change
discovery = ""
if (
self.source == SOURCE_DHCP
and self._discovered_hostname is not None
and self._discovered_ip is not None
):
discovery = (
"A likely iAquaLink device was discovered on your network at "
f"{self._discovered_ip} ({self._discovered_hostname}). "
)
return self.async_show_form(
step_id="user",
data_schema=CREDENTIALS_DATA_SCHEMA,
description_placeholders={"discovery": discovery},
description_placeholders: dict[str, str] | None = None
if (
self.source == SOURCE_DHCP
and self._discovered_hostname is not None
and self._discovered_ip is not None
):
description_placeholders = {
"ip": self._discovered_ip,
"hostname": self._discovered_hostname,
}
return self.async_show_form(
step_id="user",
data_schema=CREDENTIALS_DATA_SCHEMA,
description_placeholders=description_placeholders,

Copilot uses AI. Check for mistakes.
"name": "Jandy iAqualink",
"codeowners": ["@flz"],
"config_flow": true,
"dhcp": [{ "hostname": "iaqualink-*" }],
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Update the PR type-of-change section to match the actual change (new DHCP discovery feature).

The PR description/checklist currently marks this as “Code quality improvements”, but the manifest adds DHCP discovery (new user-facing functionality) which should be reflected in the PR metadata for correct release note categorization.

Copilot uses AI. Check for mistakes.
@flz
Copy link
Copy Markdown
Contributor Author

flz commented Apr 15, 2026

Unclear to me at this point why some integrations have a dhcp step defined and some don't.

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.

2 participants