Add timeouts per thermostat device
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
from builtins import staticmethod
|
from builtins import staticmethod
|
||||||
|
|
||||||
|
from interruptingcow import timeout
|
||||||
from mqtt import MqttMessage
|
from mqtt import MqttMessage
|
||||||
from workers.base import BaseWorker
|
from workers.base import BaseWorker
|
||||||
|
|
||||||
@@ -61,7 +62,10 @@ class ThermostatWorker(BaseWorker):
|
|||||||
def status_update(self):
|
def status_update(self):
|
||||||
ret = []
|
ret = []
|
||||||
for name, thermostat in self.devices.items():
|
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
|
return ret
|
||||||
|
|
||||||
@@ -84,6 +88,7 @@ class ThermostatWorker(BaseWorker):
|
|||||||
setattr(thermostat, method, value)
|
setattr(thermostat, method, value)
|
||||||
return self.update_device_state(device_name, thermostat)
|
return self.update_device_state(device_name, thermostat)
|
||||||
|
|
||||||
|
@timeout(8.0)
|
||||||
def update_device_state(self, name, thermostat):
|
def update_device_state(self, name, thermostat):
|
||||||
thermostat.update()
|
thermostat.update()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ class WorkersManager:
|
|||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
messages = []
|
messages = []
|
||||||
with timeout(30):
|
with timeout(35):
|
||||||
messages = self._callback(*self._args)
|
messages = self._callback(*self._args)
|
||||||
|
|
||||||
_LOGGER.debug(messages)
|
_LOGGER.debug(messages)
|
||||||
|
|||||||
Reference in New Issue
Block a user