Do not refresh the device when the "last update" is the same
This commit is contained in:
14
plugin.py
14
plugin.py
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
#pylint: disable=line-too-long,broad-exception-caught,possibly-used-before-assignment
|
#pylint: disable=line-too-long,broad-exception-caught,possibly-used-before-assignment
|
||||||
"""
|
"""
|
||||||
<plugin key="Heatzy_FJU" name="Heatzy Pilote" author="fjumelle" version="1.1.1" wikilink="" externallink="">
|
<plugin key="Heatzy_FJU" name="Heatzy Pilote" author="fjumelle" version="1.2.0" wikilink="" externallink="">
|
||||||
<description>
|
<description>
|
||||||
<h2>Heatzy Pilote</h2><br/>
|
<h2>Heatzy Pilote</h2><br/>
|
||||||
Implementation of Heatzy Pilote as a Domoticz Plugin.<br/>
|
Implementation of Heatzy Pilote as a Domoticz Plugin.<br/>
|
||||||
@@ -306,15 +306,11 @@ class BasePlugin:
|
|||||||
if 'updated_at' in response:
|
if 'updated_at' in response:
|
||||||
if self.last_update != response['updated_at']:
|
if self.last_update != response['updated_at']:
|
||||||
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:
|
else:
|
||||||
Domoticz.Status("Heatzy is back!")
|
obsolete_min = int((time.time() - self.last_update)//60)
|
||||||
Devices[1].Update(nValue=Devices[1].nValue, sValue=Devices[1].sValue, TimedOut = 0)
|
if obsolete_min >= 30 and obsolete_min%60 == 0: #more than 30 min and every hour
|
||||||
Devices[2].Update(nValue=Devices[2].nValue, sValue=Devices[2].sValue, TimedOut = 0)
|
Domoticz.Error(f"Heatzy Mode obsolete! {obsolete_min} min")
|
||||||
|
return ""
|
||||||
|
|
||||||
if 'attr' in response and 'mode' in response['attr']:
|
if 'attr' in response and 'mode' in response['attr']:
|
||||||
mode = HEATZY_MODE[response['attr']['mode']]
|
mode = HEATZY_MODE[response['attr']['mode']]
|
||||||
|
|||||||
Reference in New Issue
Block a user