Write flux_led state after turning on/off (#57152)

This commit is contained in:
J. Nick Koston 2021-10-05 14:49:42 -10:00 committed by GitHub
parent f6682ba99d
commit 286ffb2d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -355,6 +355,7 @@ class FluxLight(CoordinatorEntity, LightEntity):
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the specified or all lights on."""
await self.hass.async_add_executor_job(partial(self._turn_on, **kwargs))
self.async_write_ha_state()
await self.coordinator.async_request_refresh()
def _turn_on(self, **kwargs: Any) -> None:
@ -446,6 +447,7 @@ class FluxLight(CoordinatorEntity, LightEntity):
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the specified or all lights off."""
await self.hass.async_add_executor_job(self._bulb.turnOff)
self.async_write_ha_state()
await self.coordinator.async_request_refresh()
async def async_added_to_hass(self) -> None: