Add timeouts per thermostat device

This commit is contained in:
zewelor
2018-01-18 08:40:52 +01:00
parent 403367ae13
commit e670451977
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
from builtins import staticmethod
from interruptingcow import timeout
from mqtt import MqttMessage
from workers.base import BaseWorker
@@ -61,7 +62,10 @@ class ThermostatWorker(BaseWorker):
def status_update(self):
ret = []
for name, thermostat in self.devices.items():
ret += self.update_device_state(name, thermostat)
try:
ret += self.update_device_state(name, thermostat)
except RuntimeError:
pass
return ret
@@ -84,6 +88,7 @@ class ThermostatWorker(BaseWorker):
setattr(thermostat, method, value)
return self.update_device_state(device_name, thermostat)
@timeout(8.0)
def update_device_state(self, name, thermostat):
thermostat.update()
+1 -1
View File
@@ -16,7 +16,7 @@ class WorkersManager:
def execute(self):
messages = []
with timeout(30):
with timeout(35):
messages = self._callback(*self._args)
_LOGGER.debug(messages)