From 8942775fbcc4635c8a48fbf28113a0ce95f74c64 Mon Sep 17 00:00:00 2001 From: Francois JUMELLE Date: Wed, 4 Dec 2024 22:49:55 +0100 Subject: [PATCH] Do not refresh the device when the "last update" is the same --- plugin.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plugin.py b/plugin.py index 9c7a512..9917b09 100755 --- a/plugin.py +++ b/plugin.py @@ -4,7 +4,7 @@ # #pylint: disable=line-too-long,broad-exception-caught,possibly-used-before-assignment """ - +

Heatzy Pilote


Implementation of Heatzy Pilote as a Domoticz Plugin.
@@ -306,15 +306,11 @@ class BasePlugin: if 'updated_at' in response: if self.last_update != response['updated_at']: self.last_update = response['updated_at'] - - if time.time() > self.last_update + 60*30: #30 minutes - Domoticz.Status(f"Heatzy Mode obsolete! {(time.time() - self.last_update)//60} min") - Devices[1].Update(nValue=Devices[1].nValue, sValue=Devices[1].sValue, TimedOut = 1) - Devices[2].Update(nValue=Devices[2].nValue, sValue=Devices[2].sValue, TimedOut = 1) else: - Domoticz.Status("Heatzy is back!") - Devices[1].Update(nValue=Devices[1].nValue, sValue=Devices[1].sValue, TimedOut = 0) - Devices[2].Update(nValue=Devices[2].nValue, sValue=Devices[2].sValue, TimedOut = 0) + obsolete_min = int((time.time() - self.last_update)//60) + if obsolete_min >= 30 and obsolete_min%60 == 0: #more than 30 min and every hour + Domoticz.Error(f"Heatzy Mode obsolete! {obsolete_min} min") + return "" if 'attr' in response and 'mode' in response['attr']: mode = HEATZY_MODE[response['attr']['mode']]