Skip to content

Use config entry title for Avea light#170978

Open
pattyland wants to merge 3 commits into
home-assistant:devfrom
pattyland:avea-config-entry-identity
Open

Use config entry title for Avea light#170978
pattyland wants to merge 3 commits into
home-assistant:devfrom
pattyland:avea-config-entry-identity

Conversation

@pattyland
Copy link
Copy Markdown
Contributor

Proposed change

Use the config entry title for the Avea light entity name instead of the initial avea.Bulb.name value.

The Avea library may still expose the default name Unknown when the entity is created, even though the config flow already validated the device and created the config entry with the correct title. This prevents newly configured bulbs from being added as light.unknown after discovery/config flow setup.

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:

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.

Updates Avea light entity instantiation and naming to be based on the config entry title instead of the bulb-reported name, with corresponding test adjustments.

Changes:

  • Pass the config entry into AveaLight during setup.
  • Derive the entity’s _attr_name from entry.title instead of light.name.
  • Simplify the Avea light test by removing the entity registry dependency and adjusting the mocked bulb name.

Reviewed changes

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

File Description
tests/components/avea/test_light.py Updates test fixtures/mocks to align with entity naming changes and removes entity registry usage.
homeassistant/components/avea/light.py Changes AveaLight construction and sets the entity name from the config entry title.

Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
Comment thread homeassistant/components/avea/light.py Outdated
"""Initialize an AveaLight."""
self._light = light
self._attr_name = light.name
self._attr_name = entry.title
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.

I’m keeping this PR limited to the regression fix for entities being created from the library default name "Unknown". Moving Avea to device/entity naming with device_info would be a broader metadata change and is better handled separately once we have the right device identifiers.

@pattyland pattyland marked this pull request as draft May 17, 2026 21:01
@pattyland pattyland marked this pull request as ready for review May 17, 2026 21:01
Copilot AI review requested due to automatic review settings May 17, 2026 21:01
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 2 out of 2 changed files in this pull request and generated 2 comments.

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

state = hass.states.get("light.bedroom")
assert state is not None
assert state.state == STATE_OFF
assert state.attributes[ATTR_FRIENDLY_NAME] == "Bedroom"
"""Initialize an AveaLight."""
self._light = light
self._attr_name = light.name
self._attr_name = entry_title
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