Improve logging, watchdog
This commit is contained in:
parent
f2a9b94cf6
commit
e9b0b08fee
10
main.py
10
main.py
|
@ -34,7 +34,9 @@ def pulse_relay(pin):
|
||||||
|
|
||||||
def ring_bell(mac):
|
def ring_bell(mac):
|
||||||
global allow_watchdog
|
global allow_watchdog
|
||||||
allow_watchdog = True
|
if not allow_watchdog and not DEBUG:
|
||||||
|
logging.info('Enabling watchdog...')
|
||||||
|
allow_watchdog = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
doorbell = settings.DOORBELLS[mac]
|
doorbell = settings.DOORBELLS[mac]
|
||||||
|
@ -71,8 +73,7 @@ async def ws_listener():
|
||||||
unsub = unifiprotect.subscribe_websocket(subscriber)
|
unsub = unifiprotect.subscribe_websocket(subscriber)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if not DEBUG and allow_watchdog:
|
if allow_watchdog and not DEBUG:
|
||||||
logging.debug('Feeding watchdog...')
|
|
||||||
feed_watchdog()
|
feed_watchdog()
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
|
@ -101,6 +102,9 @@ def init():
|
||||||
logging.info('Signals initialized')
|
logging.info('Signals initialized')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
logging.info('')
|
||||||
|
logging.info('======================================')
|
||||||
|
logging.info('Boot up...')
|
||||||
init()
|
init()
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user