mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Set hyperion icon to lightbulb when off (#45351)
Co-authored-by: Dermot Duffy <dermot.duffy@gmail.com>
This commit is contained in:
parent
3647d549b0
commit
c16fd0a1ac
@ -318,7 +318,6 @@ class HyperionLight(LightEntity):
|
||||
self._brightness: int = 255
|
||||
self._rgb_color: Sequence[int] = DEFAULT_COLOR
|
||||
self._effect: str = KEY_EFFECT_SOLID
|
||||
self._icon: str = ICON_LIGHTBULB
|
||||
|
||||
self._effect_list: List[str] = []
|
||||
|
||||
@ -350,7 +349,12 @@ class HyperionLight(LightEntity):
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
"""Return state specific icon."""
|
||||
return self._icon
|
||||
if self.is_on:
|
||||
if self.effect in const.KEY_COMPONENTID_EXTERNAL_SOURCES:
|
||||
return ICON_EXTERNAL_SOURCE
|
||||
if self.effect != KEY_EFFECT_SOLID:
|
||||
return ICON_EFFECT
|
||||
return ICON_LIGHTBULB
|
||||
|
||||
@property
|
||||
def effect(self) -> str:
|
||||
@ -516,12 +520,6 @@ class HyperionLight(LightEntity):
|
||||
self._rgb_color = rgb_color
|
||||
if effect is not None:
|
||||
self._effect = effect
|
||||
if effect == KEY_EFFECT_SOLID:
|
||||
self._icon = ICON_LIGHTBULB
|
||||
elif effect in const.KEY_COMPONENTID_EXTERNAL_SOURCES:
|
||||
self._icon = ICON_EXTERNAL_SOURCE
|
||||
else:
|
||||
self._icon = ICON_EFFECT
|
||||
|
||||
def _update_components(self, _: Optional[Dict[str, Any]] = None) -> None:
|
||||
"""Update Hyperion components."""
|
||||
|
@ -629,6 +629,11 @@ async def test_light_async_turn_off(hass: HomeAssistantType) -> None:
|
||||
}
|
||||
)
|
||||
|
||||
_call_registered_callback(client, "components-update")
|
||||
entity_state = hass.states.get(TEST_ENTITY_ID_1)
|
||||
assert entity_state
|
||||
assert entity_state.attributes["icon"] == hyperion_light.ICON_LIGHTBULB
|
||||
|
||||
# No calls if no state loaded.
|
||||
client.has_loaded_state = False
|
||||
client.async_send_set_component = AsyncMock(return_value=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user