Convert switch to AsnycIO (#4382)
* Convert switch to AsnycIO * Move update entity to service * use time better for faster handling * Change to suggestion from paulus * Use new shedule_update_ha_state * fix lint * minimize executor calls
This commit is contained in:
1 parent
5d8a465c18
commit
41aaeb715a
18 files changed
+80
-56
No files matched your search
@@ -92,7 +92,7 @@ class SwitchTemplate(SwitchDevice):
|
||||
@callback
|
||||
def template_switch_state_listener(entity, old_state, new_state):
|
||||
"""Called when the target device changes state."""
|
||||
hass.async_add_job(self.async_update_ha_state, True)
|
||||
hass.async_add_job(self.async_update_ha_state(True))
|
||||
|
||||
async_track_state_change(
|
||||
hass, entity_ids, template_switch_state_listener)
|
||||
|
||||
Reference in new issue
Block a user