Add Avea device info#171624
Conversation
There was a problem hiding this comment.
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
DeviceInfoforAveaLightusing 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. |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
| bulb.fw_version = "Unknown" | ||
| bulb.hardware_revision = "Unknown" | ||
| bulb.manufacturer_name = "Unknown" | ||
| bulb.serial_number = "Unknown" |
There was a problem hiding this comment.
Is this what is returned in real life? Because if we get back Unknown, I'd rather map that to None
There was a problem hiding this comment.
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.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
| self._attr_device_info = DeviceInfo( | ||
| connections={(CONNECTION_BLUETOOTH, address)}, | ||
| model=MODEL, | ||
| ) |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
Proposed change
Add device information for Avea lights.
The integration now reads the standard BLE Device Information values exposed by
aveaduring entity setup and exposes them throughDeviceInfo: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
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: