From e9b0b08fee66e85374b0c5d2f41e65369e213dbf Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 16 Oct 2021 01:41:22 +0100 Subject: [PATCH] Improve logging, watchdog --- main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 7d417a4..7c6f6fe 100644 --- a/main.py +++ b/main.py @@ -34,7 +34,9 @@ def pulse_relay(pin): def ring_bell(mac): global allow_watchdog - allow_watchdog = True + if not allow_watchdog and not DEBUG: + logging.info('Enabling watchdog...') + allow_watchdog = True try: doorbell = settings.DOORBELLS[mac] @@ -71,8 +73,7 @@ async def ws_listener(): unsub = unifiprotect.subscribe_websocket(subscriber) while True: - if not DEBUG and allow_watchdog: - logging.debug('Feeding watchdog...') + if allow_watchdog and not DEBUG: feed_watchdog() await asyncio.sleep(1) @@ -101,6 +102,9 @@ def init(): logging.info('Signals initialized') if __name__ == '__main__': + logging.info('') + logging.info('======================================') + logging.info('Boot up...') init() loop = asyncio.get_event_loop()