mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
parent
4a50c3fbae
commit
7807df4426
@ -51,9 +51,9 @@ class YoLinkDimmerEntity(YoLinkEntity, LightEntity):
|
|||||||
@callback
|
@callback
|
||||||
def update_entity_state(self, state: dict[str, Any]) -> None:
|
def update_entity_state(self, state: dict[str, Any]) -> None:
|
||||||
"""Update HA Entity State."""
|
"""Update HA Entity State."""
|
||||||
if (dimmer_is_on := state.get("state")) is not None:
|
if (dimmer_state := state.get("state")) is not None:
|
||||||
# update _attr_is_on when device report it's state
|
# update _attr_is_on when device report it's state
|
||||||
self._attr_is_on = dimmer_is_on
|
self._attr_is_on = dimmer_state == "open"
|
||||||
if (brightness := state.get("brightness")) is not None:
|
if (brightness := state.get("brightness")) is not None:
|
||||||
self._attr_brightness = round(255 * brightness / 100)
|
self._attr_brightness = round(255 * brightness / 100)
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user