api: fix mqtt reconnect logic errors
This commit is contained in:
parent
2e1742279d
commit
b752888812
2 changed files with 23 additions and 12 deletions
|
|
@ -162,15 +162,18 @@ class CCUJackClient:
|
|||
while True:
|
||||
try:
|
||||
|
||||
await asyncio.sleep(15 * 60) # 15 minutes
|
||||
logger.info("Running CCUJack cron")
|
||||
await self.find_locks()
|
||||
if not self.mqtt.is_connected():
|
||||
if not self.mqtt.is_connected:
|
||||
logger.warning("MQTT client was discovered to be disconnected; reconnecting now")
|
||||
await self.mqtt.connect()
|
||||
|
||||
await self.find_locks()
|
||||
|
||||
except Exception as e:
|
||||
logger.exception(f"Error in CCUJack cron task: {e}")
|
||||
finally:
|
||||
await asyncio.sleep(15 * 60) # 15 minutes
|
||||
|
||||
|
||||
async def query_param_value(self, address: str) -> CCUValue:
|
||||
if address in self.param_values:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue