mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Make Netatmo/Legrande/BTicino lights and switches optimistic (#81246)
* Make Netatmo lights optimistic * Same for switches
This commit is contained in:
parent
662aee17a6
commit
df29a8388d
@ -193,17 +193,20 @@ class NetatmoLight(NetatmoBase, LightEntity):
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn light on."""
|
||||
_LOGGER.debug("Turn light '%s' on", self.name)
|
||||
if ATTR_BRIGHTNESS in kwargs:
|
||||
await self._dimmer.async_set_brightness(kwargs[ATTR_BRIGHTNESS])
|
||||
|
||||
else:
|
||||
await self._dimmer.async_on()
|
||||
|
||||
self._attr_is_on = True
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn light off."""
|
||||
_LOGGER.debug("Turn light '%s' off", self.name)
|
||||
await self._dimmer.async_off()
|
||||
self._attr_is_on = False
|
||||
self.async_write_ha_state()
|
||||
|
||||
@callback
|
||||
def async_update_callback(self) -> None:
|
||||
|
@ -77,7 +77,11 @@ class NetatmoSwitch(NetatmoBase, SwitchEntity):
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the zone on."""
|
||||
await self._switch.async_on()
|
||||
self._attr_is_on = True
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the zone off."""
|
||||
await self._switch.async_off()
|
||||
self._attr_is_on = False
|
||||
self.async_write_ha_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user