Remove watchdog

master
Tanner Collin 2 years ago
parent 055b12ee05
commit 8fa91a9c55
  1. 13
      main.py

@ -1,6 +1,5 @@
import os, logging
DEBUG = os.environ.get('DEBUG')
NO_WATCHDOG = os.environ.get('NO_WATCHDOG')
logging.basicConfig(
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s',
level=logging.DEBUG if DEBUG else logging.INFO)
@ -26,8 +25,6 @@ import settings
RELAY_ON = False
RELAY_OFF = True
allow_watchdog = False
cooldown_time = time.time()
def set_relay(pin, state):
@ -40,11 +37,7 @@ def pulse_relay(pin):
set_relay(pin, RELAY_OFF)
def ring_bell(camera):
global allow_watchdog, cooldown_time
if not allow_watchdog and not DEBUG and not NO_WATCHDOG:
logging.info('Enabling watchdog...')
allow_watchdog = True
global cooldown_time
if time.time() - cooldown_time < 2:
logging.info('Cooldown skipping.')
@ -58,10 +51,6 @@ def ring_bell(camera):
except KeyError:
logging.error('Doorbell %s not found!', camera)
def feed_watchdog():
with open('/dev/watchdog', 'w') as wdt:
wdt.write('1')
async def process_message(msg):
if msg.get('type', '') != 'ring':

Loading…
Cancel
Save