Fix retry mechanism
This commit is contained in:
10
plugin.py
10
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="HeatzyEx" name="Heatzy Pilote Ex" author="fjumelle" version="2.2.0" wikilink="" externallink="">
|
<plugin key="HeatzyEx" name="Heatzy Pilote Ex" author="fjumelle" version="2.2.1" 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/>
|
||||||
@@ -295,14 +295,15 @@ class BasePlugin:
|
|||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, timeout=self._HTTP_TIMEOUT).json()
|
response = requests.get(url, headers=headers, timeout=self._HTTP_TIMEOUT).json()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
#Decrease retry
|
|
||||||
self.retry = self.retry - 1
|
|
||||||
|
|
||||||
message = f"Cannot open connection to Heatzy API to get the mode for {alias} (retry={self.retry}): {exc}"
|
message = f"Cannot open connection to Heatzy API to get the mode for {alias} (retry={self.retry}): {exc}"
|
||||||
if self.retry < 0:
|
if self.retry < 0:
|
||||||
Domoticz.Error(message)
|
Domoticz.Error(message)
|
||||||
else:
|
else:
|
||||||
Domoticz.Status(message + f" (retry left: {self.retry})")
|
Domoticz.Status(message + f" (retry left: {self.retry})")
|
||||||
|
|
||||||
|
#Decrease retry
|
||||||
|
self.retry = self.retry - 1
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
Domoticz.Debug(f"Get Mode Response for {alias}: {response}")
|
Domoticz.Debug(f"Get Mode Response for {alias}: {response}")
|
||||||
@@ -456,6 +457,7 @@ class BasePlugin:
|
|||||||
|
|
||||||
def reset_retry(self):
|
def reset_retry(self):
|
||||||
"""Reset the retry counter"""
|
"""Reset the retry counter"""
|
||||||
|
Domoticz.Status("Reset retry counter")
|
||||||
self.retry = self._MAX_RETRY_PER_DEVICE * len(self.did)
|
self.retry = self._MAX_RETRY_PER_DEVICE * len(self.did)
|
||||||
|
|
||||||
_plugin = BasePlugin()
|
_plugin = BasePlugin()
|
||||||
|
|||||||
Reference in New Issue
Block a user