Skip to content

Commit

Permalink
Fix Netatmo light switching states by assuming state until next update (
Browse files Browse the repository at this point in the history
  • Loading branch information
cgtobi committed Dec 22, 2023
1 parent 8918a9c commit 7ef20c4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions homeassistant/components/netatmo/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ def __init__(
]
)

@property
def is_on(self) -> bool:
"""Return true if light is on."""
return self._dimmer.on is True

async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn light on."""
if ATTR_BRIGHTNESS in kwargs:
Expand All @@ -211,6 +206,8 @@ async def async_turn_off(self, **kwargs: Any) -> None:
@callback
def async_update_callback(self) -> None:
"""Update the entity's state."""
self._attr_is_on = self._dimmer.on is True

if self._dimmer.brightness is not None:
# Netatmo uses a range of [0, 100] to control brightness
self._attr_brightness = round((self._dimmer.brightness / 100) * 255)
Expand Down

0 comments on commit 7ef20c4

Please sign in to comment.