Remove throttle doesn't play well with subscriptions.

This commit is contained in:
pavoni 2016-01-09 16:16:41 +00:00
parent d406d7fa94
commit d61eb93c03
2 changed files with 1 additions and 9 deletions

View File

@ -86,5 +86,4 @@ class VeraLight(VeraSwitch):
else:
self.vera_device.switch_on()
self.last_command_send = time.time()
self.is_on_status = True

View File

@ -87,8 +87,6 @@ class VeraSwitch(ToggleEntity):
else:
self._name = self.vera_device.name
self.is_on_status = False
# for debouncing status check after command is sent
self.last_command_send = 0
self.controller.register(vera_device)
self.controller.on(
@ -132,12 +130,10 @@ class VeraSwitch(ToggleEntity):
return attr
def turn_on(self, **kwargs):
self.last_command_send = time.time()
self.vera_device.switch_on()
self.is_on_status = True
def turn_off(self, **kwargs):
self.last_command_send = time.time()
self.vera_device.switch_off()
self.is_on_status = False
@ -152,10 +148,7 @@ class VeraSwitch(ToggleEntity):
return self.is_on_status
def update(self):
# We need to debounce the status call after turning switch on or off
# because the vera has some lag in updating the device status
try:
if (self.last_command_send + 5) < time.time():
self.is_on_status = self.vera_device.is_switched_on()
except RequestException:
_LOGGER.warning('Could not update status for %s', self.name)