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:
Pascal Vizeli authored and Paulus Schoutsen committed 2016-11-15 21:06:50 -08:00
1 parent 5d8a465c18
commit 41aaeb715a
18 files changed
+80 -56

No files matched your search

@@ -149,11 +149,11 @@ class CommandSwitch(SwitchDevice):
if (CommandSwitch._switch(self._command_on) and
not self._command_state):
self._state = True
self.update_ha_state()
self.shedule_update_ha_state()
def turn_off(self, **kwargs):
"""Turn the device off."""
if (CommandSwitch._switch(self._command_off) and
not self._command_state):
self._state = False
self.update_ha_state()
self.shedule_update_ha_state()