Fix update bugs

This commit is contained in:
2021-11-29 06:53:32 +00:00
parent 0053b78e41
commit 8a05f1aacb
4 changed files with 21 additions and 35 deletions
+8 -9
View File
@@ -69,11 +69,13 @@ async def ws_listener():
settings.UFP_PASSWORD,
)
await unifiprotect.check_unifi_os()
await unifiprotect.update()
unsub = unifiprotect.subscribe_websocket(subscriber)
logging.info('Connecting to websocket.')
await asyncio.sleep(2)
while True:
try:
updates = await unifiprotect.update()
@@ -82,14 +84,10 @@ async def ws_listener():
logging.error('Problem connecting to Unifi Protect. Reconnecting...')
break
logging.debug('unifiprotect: %s', unifiprotect.__dict__)
logging.debug('ws_session %s', unifiprotect.ws_session.__dict__)
breakpoint()
#active_ws = await unifiprotect.check_ws()
#if not active_ws:
# logging.error('Websocket unactive. Reconnecting...')
active_ws = await unifiprotect.check_ws()
if not active_ws:
logging.error('Websocket unactive. Reconnecting...')
break
if allow_watchdog and not DEBUG:
feed_watchdog()
@@ -112,6 +110,7 @@ def init():
for _, doorbell in settings.DOORBELLS.items():
GPIO.setup(doorbell['gpio'], GPIO.OUT)
set_relay(doorbell['gpio'], RELAY_OFF)
#pulse_relay(doorbell['gpio'])
time.sleep(1)
logging.info('GPIO initialized')