Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions homeassistant/components/avea/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def async_setup_entry(
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the Avea light platform."""
async_add_entities([AveaLight(entry.runtime_data)], update_before_add=True)
async_add_entities([AveaLight(entry.runtime_data, entry)], update_before_add=True)
Comment thread
pattyland marked this conversation as resolved.
Outdated


def _discover_bulbs_for_import() -> list[dict[str, str]]:
Expand Down Expand Up @@ -169,10 +169,10 @@ class AveaLight(LightEntity):
_attr_color_mode = ColorMode.HS
_attr_supported_color_modes = {ColorMode.HS}

def __init__(self, light: avea.Bulb) -> None:
def __init__(self, light: avea.Bulb, entry: AveaConfigEntry) -> None:
"""Initialize an AveaLight."""
self._light = light
self._attr_name = light.name
self._attr_name = entry.title
Comment thread
pattyland marked this conversation as resolved.
Outdated
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.

self._attr_brightness = light.brightness

def turn_on(self, **kwargs: Any) -> None:
Expand Down
4 changes: 1 addition & 3 deletions tests/components/avea/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er

from . import AVEA_DISCOVERY_INFO

Expand All @@ -26,7 +25,7 @@
def mock_bulb() -> MagicMock:
"""Return a mocked Avea bulb."""
bulb = MagicMock()
bulb.name = "Bedroom"
bulb.name = "Unknown"
Comment thread
pattyland marked this conversation as resolved.
bulb.brightness = 0
bulb.get_brightness.return_value = 0
return bulb
Expand Down Expand Up @@ -54,7 +53,6 @@ async def setup_integration(

async def test_init_state(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
setup_integration: MagicMock,
) -> None:
"""Test the initial state."""
Expand Down