Skip to content

Add Avea device info#171624

Open
pattyland wants to merge 10 commits into
home-assistant:devfrom
pattyland:avea-device-info
Open

Add Avea device info#171624
pattyland wants to merge 10 commits into
home-assistant:devfrom
pattyland:avea-device-info

Conversation

@pattyland
Copy link
Copy Markdown
Contributor

@pattyland pattyland commented May 20, 2026

Proposed change

Add device information for Avea lights.

The integration now reads the standard BLE Device Information values exposed by avea during entity setup and exposes them through DeviceInfo:

  • manufacturer
  • hardware version
  • firmware version
  • serial number

The current generic model remains unchanged. Exact Avea model detection is intentionally left to the upstream library once hardware-type based model detection is available.

The device information is read during entity setup, so it is refreshed on Home Assistant restart or integration reload without adding recurring polling for static BLE device information values.

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.

This PR adds device metadata (manufacturer/model/firmware/serial) for Avea bulbs and verifies it via tests.

Changes:

  • Populate DeviceInfo for AveaLight using bulb-provided metadata and config entry identifiers.
  • Introduce a setup-time executor call to pre-fetch metadata from the bulb.
  • Add a new test asserting device registry fields and extend the test fixture constants.

Reviewed changes

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

File Description
homeassistant/components/avea/light.py Fetch bulb metadata and expose it via DeviceInfo on the light entity.
tests/components/avea/test_light.py Mock additional bulb metadata and assert device registry values.
tests/components/avea/__init__.py Add shared constants for firmware version and serial number used in tests.

Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread tests/components/avea/test_light.py Outdated
@pattyland pattyland marked this pull request as draft May 20, 2026 19:29
@pattyland pattyland marked this pull request as ready for review May 20, 2026 19:42
Copilot AI review requested due to automatic review settings May 20, 2026 19:42
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 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
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: 5273284173

ℹ️ 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/light.py Outdated
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: 3f76671a86

ℹ️ 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/light.py Outdated
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: 3f76671a86

ℹ️ 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/light.py Outdated
Copilot AI review requested due to automatic review settings May 20, 2026 20:19
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 3 out of 3 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/avea/light.py
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py
Comment thread homeassistant/components/avea/light.py Outdated
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: 2c985c2e77

ℹ️ 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/light.py Outdated
@pattyland pattyland marked this pull request as draft May 20, 2026 20:34
Copilot AI review requested due to automatic review settings May 21, 2026 05:48
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 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
@pattyland pattyland marked this pull request as ready for review May 21, 2026 05:57
Copilot AI review requested due to automatic review settings May 21, 2026 05:57
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 3 out of 3 changed files in this pull request and generated 4 comments.

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

ℹ️ 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/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment on lines +31 to +34
bulb.fw_version = "Unknown"
bulb.hardware_revision = "Unknown"
bulb.manufacturer_name = "Unknown"
bulb.serial_number = "Unknown"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this what is returned in real life? Because if we get back Unknown, I'd rather map that to None

Copy link
Copy Markdown
Contributor Author

@pattyland pattyland May 21, 2026

Choose a reason for hiding this comment

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

The library initializes these cached attributes to Unknown, so this is its internal default/sentinel rather than a real Device Information value. The integration already normalizes UNKNOWN_NAME to None; I added a test that getter return values of Unknown/empty string are not written to the device registry.

Tracked upstream in k0rventen/avea#51.

Comment thread tests/components/avea/test_light.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft May 21, 2026 06:46
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Copilot AI review requested due to automatic review settings May 21, 2026 17:25
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 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +204 to +207
self._attr_device_info = DeviceInfo(
connections={(CONNECTION_BLUETOOTH, address)},
model=MODEL,
)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this. The human review feedback in this PR explicitly asked to omit DeviceInfo.name so the device name defaults to the config entry title, and to keep AveaLight independent from the config entry. The current test verifies that the device registry name is still Bedroom while DeviceInfo only provides the Bluetooth connection plus model and metadata.

Comment on lines +219 to +228
if manufacturer:
device_info["manufacturer"] = manufacturer
if hardware_revision:
device_info["hw_version"] = hardware_revision
if firmware_version:
device_info["sw_version"] = firmware_version
if serial_number:
device_info["serial_number"] = serial_number

self._device_info_updated = True
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Intentionally not changing this into retry logic. The scope here is a small best-effort DeviceInfo read during setup/reload, without per-field retry, backoff, or post-registration registry updates. If all metadata reads fail during setup, the integration still loads normally and a later reload/restart will try again. That keeps normal polling free from repeated extra GATT reads.

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