Logging, timeout

master
Tanner Collin 2 years ago
parent 8fa91a9c55
commit a0e0651703
  1. 7
      main.py

@ -14,6 +14,7 @@ try:
import RPi.GPIO as GPIO
IS_PI = True
except ModuleNotFoundError:
logging.info('RPi.GPIO not found, running without GPIO.')
IS_PI = False
import time
@ -33,7 +34,7 @@ def set_relay(pin, state):
def pulse_relay(pin):
set_relay(pin, RELAY_ON)
time.sleep(0.5) # atomic
time.sleep(0.25) # atomic
set_relay(pin, RELAY_OFF)
def ring_bell(camera):
@ -66,8 +67,8 @@ async def main():
async for msg in unifi.connect():
await process_message(msg)
except BaseException as e:
logging.error('Error connecting to Unifi Protect: %s. Trying again...', str(e))
await asyncio.sleep(3)
logging.exception('Error connecting to Unifi Protect: %s. Trying again...', str(e))
await asyncio.sleep(5)
def disable_relays_on_exit(*args):

Loading…
Cancel
Save