Update doorbell.py
This commit is contained in:
@@ -19,11 +19,7 @@ while True:
|
|||||||
if (data == 'RING'):
|
if (data == 'RING'):
|
||||||
try:
|
try:
|
||||||
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 (HTTPError, URLError) as error:
|
except Exception:
|
||||||
logging.error('Data of %s not retrieved because %s\nURL: %s', name, error, url)
|
logging.exception("Could not ring doorbell")
|
||||||
except timeout:
|
|
||||||
logging.error('socket timed out - URL %s', url)
|
|
||||||
except OSError as err:
|
|
||||||
logging.error("OS error: {0}".format(err))
|
|
||||||
else:
|
else:
|
||||||
logging.info(data)
|
logging.info(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user