From e82a23c45907e04c1e3511edd8c1a5d81030c873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20JUMELLE?= Date: Tue, 1 Jun 2021 22:33:25 +0200 Subject: [PATCH] Automatically re-enable the device after 15 minutes in case of connection issue with the server --- plugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin.py b/plugin.py index 8326eec..1318fe3 100755 --- a/plugin.py +++ b/plugin.py @@ -145,8 +145,9 @@ class BasePlugin: if self.pooling_current_step >= self.pooling_steps: Domoticz.Debug("Retry counter:{}".format(self.retry)) if self.retry < 0: - Domoticz.Log("No connection to Heatzy API ==> Device disabled") - self.pooling_current_step = 1 + Domoticz.Status("No connection to Heatzy API ==> Device disabled for 15 minutes") + self.pooling_current_step = - 15 * 60 // self.pooling + self.pooling_steps + self.retry = self.max_retry return self.mode = self.getMode() @@ -373,6 +374,9 @@ class BasePlugin: self.did = "" return self.mode + #Device is correctly running ==> we reset the retry counter + self.retry = self.max_retry + return self.mode def onOff(self, command):