Update doorbell.py
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
import serial
|
import serial
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s - %(message)s')
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s - %(message)s')
|
||||||
logging.info('Initializing')
|
logging.info('Initializing')
|
||||||
@@ -21,5 +22,6 @@ while True:
|
|||||||
response = urllib.request.urlopen('http://192.168.178.51/bell/on', timeout=5).read().decode('utf-8')
|
response = urllib.request.urlopen('http://192.168.178.51/bell/on', timeout=5).read().decode('utf-8')
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception("Could not ring doorbell")
|
logging.exception("Could not ring doorbell")
|
||||||
|
time.sleep(300)
|
||||||
else:
|
else:
|
||||||
logging.info(data)
|
logging.info(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user