Improve logging, watchdog
This commit is contained in:
parent
f2a9b94cf6
commit
e9b0b08fee
8
main.py
8
main.py
|
@ -34,6 +34,8 @@ def pulse_relay(pin):
|
|||
|
||||
def ring_bell(mac):
|
||||
global allow_watchdog
|
||||
if not allow_watchdog and not DEBUG:
|
||||
logging.info('Enabling watchdog...')
|
||||
allow_watchdog = True
|
||||
|
||||
try:
|
||||
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user