Fix incorrect call to async_schedule_update_ha_state in command_line switch (#116347)

This commit is contained in:
J. Nick Koston 2024-04-28 11:36:01 -05:00 committed by GitHub
parent 9ca1d204b6
commit 3bcce2197c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -191,12 +191,12 @@ class CommandSwitch(ManualTriggerEntity, SwitchEntity):
"""Turn the device on.""" """Turn the device on."""
if await self._switch(self._command_on) and not self._command_state: if await self._switch(self._command_on) and not self._command_state:
self._attr_is_on = True self._attr_is_on = True
self.async_schedule_update_ha_state() self.async_write_ha_state()
await self._update_entity_state() await self._update_entity_state()
async def async_turn_off(self, **kwargs: Any) -> None: async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the device off.""" """Turn the device off."""
if await self._switch(self._command_off) and not self._command_state: if await self._switch(self._command_off) and not self._command_state:
self._attr_is_on = False self._attr_is_on = False
self.async_schedule_update_ha_state() self.async_write_ha_state()
await self._update_entity_state() await self._update_entity_state()