Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 5 additions & 3 deletions homeassistant/components/avea/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions tests/components/avea/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
ATTR_SUPPORTED_COLOR_MODES,
ColorMode,
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
from homeassistant.const import ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, 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,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.attributes[ATTR_FRIENDLY_NAME] == "Bedroom"
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.HS]


Expand Down