Update doorbell.py

This commit is contained in:
2020-09-02 07:48:13 +00:00
parent 568a9a2528
commit bdb8c8bbca
+3 -1
View File
@@ -19,9 +19,11 @@ while True:
if (data == 'RING'):
try:
response = urllib.request.urlopen('http://192.168.178.51/bell/on', timeout=5).read().decode('utf-8')
except (HTTPError, URLError, OSError) as error:
except (HTTPError, URLError) as error:
logging.error('Data of %s not retrieved because %s\nURL: %s', name, error, url)
except timeout:
logging.error('socket timed out - URL %s', url)
except OSError as err:
logging.error("OS error: {0}".format(err))
else:
logging.info(data)