Skip to content

Add config flow to Avea#168070

Merged
joostlek merged 38 commits into
home-assistant:devfrom
pattyland:dev
May 11, 2026
Merged

Add config flow to Avea#168070
joostlek merged 38 commits into
home-assistant:devfrom
pattyland:dev

Conversation

@pattyland
Copy link
Copy Markdown
Contributor

@pattyland pattyland commented Apr 12, 2026

Proposed change

This PR migrates the avea integration from legacy YAML platform setup to a config-entry-based integration with Bluetooth discovery.

It adds a config flow, supports Bluetooth auto-discovery, and moves setup to async_setup_entry. The legacy YAML platform now imports discovered bulbs into config entries, so existing setups migrate automatically when the bulbs are reachable during import. If a bulb is not reachable during import, it may still need to be added manually through the UI.

The PR also adds tests for the config flow, YAML import, and light platform behavior, and updates the integration metadata and translation strings required for config flows.

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

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:

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.

Migrates the Avea integration to a config-entry-based setup with Bluetooth discovery, replacing legacy YAML/platform setup and adding tests for the new flow and entity behavior.

Changes:

  • Added config flow with Bluetooth discovery (and translations/manifest updates).
  • Refactored light platform to async config entry setup using runtime data and HA’s Bluetooth device.
  • Added test coverage for config flow and light behaviors.

Reviewed changes

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

Show a summary per file
File Description
homeassistant/components/avea/__init__.py Adds config-entry setup/unload + runtime_data wiring for the Bulb instance
homeassistant/components/avea/config_flow.py Implements user + Bluetooth discovery config flow and validation
homeassistant/components/avea/const.py Introduces integration constants used by config flow/device info
homeassistant/components/avea/light.py Moves light setup to async_setup_entry and uses runtime_data + BT device refresh
homeassistant/components/avea/manifest.json Enables config flow + Bluetooth discovery metadata
homeassistant/components/avea/strings.json Adds config flow strings/keys
tests/components/avea/__init__.py Adds shared Bluetooth discovery fixtures/data for tests
tests/components/avea/conftest.py Adds autouse Bluetooth fixtures for test isolation
tests/components/avea/test_config_flow.py Adds config flow tests (user + Bluetooth discovery paths)
tests/components/avea/test_light.py Adds light entity behavior tests using config entry setup

Comment thread tests/components/avea/conftest.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/config_flow.py
Comment thread tests/components/avea/test_light.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: 2aff09e5f5

ℹ️ 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/avea/manifest.json
Comment thread homeassistant/components/avea/manifest.json
Comment thread homeassistant/components/avea/__init__.py
Comment thread homeassistant/components/avea/config_flow.py Outdated
Comment thread homeassistant/components/avea/config_flow.py Outdated
Comment thread homeassistant/components/avea/config_flow.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Co-authored-by: Erwin Douna <e.douna@gmail.com>
Copilot AI review requested due to automatic review settings April 13, 2026 13:02
Co-authored-by: Erwin Douna <e.douna@gmail.com>
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 12 out of 15 changed files in this pull request and generated 5 comments.

Comment thread homeassistant/components/avea/config_flow.py
Comment thread tests/components/avea/conftest.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/manifest.json
Copilot AI review requested due to automatic review settings April 13, 2026 13:45
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 12 out of 15 changed files in this pull request and generated 3 comments.

Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py
Comment thread homeassistant/components/avea/config_flow.py Outdated
Copilot AI review requested due to automatic review settings April 13, 2026 14:09
Copilot AI review requested due to automatic review settings May 9, 2026 21:43
@home-assistant home-assistant Bot requested a review from joostlek May 9, 2026 21:43
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 13 out of 16 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

homeassistant/components/avea/light.py:168

  • Set a stable unique_id (and corresponding device_info for the Bluetooth device) for AveaLight so the entity is registered in the entity/device registry and can be managed reliably from the UI.
    def __init__(self, light: avea.Bulb) -> None:
        """Initialize an AveaLight."""
        self._light = light
        self._attr_name = light.name
        self._attr_brightness = light.brightness

Comment thread tests/components/avea/test_light.py
# Conflicts:
#	homeassistant/components/avea/light.py
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread homeassistant/components/avea/__init__.py Outdated
Comment thread homeassistant/components/avea/__init__.py Outdated
Comment thread homeassistant/components/avea/config_flow.py Outdated
Comment thread homeassistant/components/avea/config_flow.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft May 10, 2026 07:12
Copilot AI review requested due to automatic review settings May 10, 2026 08:04
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 13 out of 16 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

homeassistant/components/avea/light.py:167

  • Initialize _attr_brightness using Home Assistant’s 0-255 scale instead of the bulb’s likely 0-4095 raw value. Setting _attr_brightness = light.brightness can publish an out-of-range brightness if the first update_before_add read fails (or before the first successful update), so compute/normalize it (or leave it unset until update() populates it).
    def __init__(self, light: avea.Bulb) -> None:
        """Initialize an AveaLight."""
        self._light = light
        self._attr_name = light.name
        self._attr_brightness = light.brightness

Comment thread homeassistant/components/avea/light.py
Comment thread homeassistant/components/avea/__init__.py
Comment thread homeassistant/components/avea/config_flow.py Outdated
Copilot AI review requested due to automatic review settings May 10, 2026 15:46
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 13 out of 16 changed files in this pull request and generated no new comments.

@pattyland pattyland marked this pull request as ready for review May 10, 2026 17:32
@home-assistant home-assistant Bot requested a review from erwindouna May 10, 2026 17:32
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: c0fec0fd73

ℹ️ 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/avea/__init__.py
Copilot AI review requested due to automatic review settings May 11, 2026 15:04
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 13 out of 16 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

homeassistant/components/avea/light.py:176

  • Avoid using the library default/placeholder bulb name (e.g., "Unknown") as the entity name. The config flow/YAML import already normalizes "Unknown" to a better fallback (discovery name/address), but the entity currently sets _attr_name = light.name, which can reintroduce "Unknown" names and confusing entity_ids. Consider using the config entry title (validated/normalized) or applying the same _normalize_name fallback here.
    def __init__(self, light: avea.Bulb) -> None:
        """Initialize an AveaLight."""
        self._light = light
        self._attr_name = light.name
        self._attr_brightness = light.brightness

Comment thread homeassistant/components/avea/light.py
@joostlek joostlek merged commit 4641c82 into home-assistant:dev May 11, 2026
47 of 48 checks passed
lmaertin pushed a commit to lmaertin/homeassistant-core that referenced this pull request May 11, 2026
Co-authored-by: Erwin Douna <e.douna@gmail.com>
Co-authored-by: Joostlek <joostlek@outlook.com>
raman325 added a commit to raman325/home-assistant that referenced this pull request May 12, 2026
…-timer

* upstream/dev:
  Bump infrared-protocols to 5.1.0 (home-assistant#170365)
  Clean up template engine after extension modularization (home-assistant#170346)
  Bump axis to v71 (home-assistant#170347)
  Enhance WebDAV metadata download with concurrency (home-assistant#170223)
  Add target temperature sensor for ViCare RadiatorActuator devices (home-assistant#170102)
  Bump pyzbar to 0.1.9 (home-assistant#170076)
  homematicip_cloud: fix HmIP-FLC lock state polarity (home-assistant#170159)
  Watts: add timer mode service (home-assistant#169846)
  Set parallel updates for Ecowitt platforms (home-assistant#170349)
  Add config flow to Avea (home-assistant#168070)
  Cleanup Eurotronic number platform (home-assistant#170337)
  Add number platform to eurotronic_cometblue (home-assistant#168119)
@github-actions github-actions Bot locked and limited conversation to collaborators May 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants