diff --git a/homeassistant/components/avea/light.py b/homeassistant/components/avea/light.py index ae7f075297e39c..a22129f0f4ffce 100644 --- a/homeassistant/components/avea/light.py +++ b/homeassistant/components/avea/light.py @@ -84,7 +84,9 @@ 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.title)], update_before_add=True + ) def _discover_bulbs_for_import() -> list[dict[str, str]]: @@ -169,10 +171,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_title: str) -> None: """Initialize an AveaLight.""" self._light = light - self._attr_name = light.name + self._attr_name = entry_title self._attr_brightness = light.brightness def turn_on(self, **kwargs: Any) -> None: diff --git a/tests/components/avea/test_light.py b/tests/components/avea/test_light.py index 302c1c37c74892..c45edc578bc836 100644 --- a/tests/components/avea/test_light.py +++ b/tests/components/avea/test_light.py @@ -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 @@ -26,7 +25,7 @@ def mock_bulb() -> MagicMock: """Return a mocked Avea bulb.""" bulb = MagicMock() - bulb.name = "Bedroom" + bulb.name = "Unknown" bulb.brightness = 0 bulb.get_brightness.return_value = 0 return bulb @@ -54,13 +53,13 @@ async def setup_integration( async def test_init_state( hass: HomeAssistant, - entity_registry: er.EntityRegistry, setup_integration: MagicMock, ) -> None: """Test the initial state.""" state = hass.states.get("light.bedroom") assert state is not None assert state.state == STATE_OFF + assert state.name == "Bedroom" assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.HS]