Improve logging, watchdog

This commit is contained in:
Tanner Collin 2021-10-16 01:41:22 +01:00
parent f2a9b94cf6
commit e9b0b08fee

10
main.py
View File

@ -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()