Merge branch 'master' of https://www.nodebucket.de:3000/tilman/smart-home
This commit is contained in:
@@ -18,12 +18,15 @@ logger.addHandler(logHandler)
|
||||
logger.info('Initializing')
|
||||
|
||||
|
||||
arduino = serial.Serial('/dev/ttyUSB0', 9600, timeout=.1)
|
||||
arduino = serial.Serial('/dev/Doorbell', 9600, timeout=.1)
|
||||
|
||||
while True:
|
||||
data = arduino.readline()[:-2] #the last bit gets rid of the new-line chars
|
||||
if data:
|
||||
try:
|
||||
data = data.decode('utf8')
|
||||
except (UnicodeDecodeError) as ude:
|
||||
logger.error(ude)
|
||||
if (data == 'RING'):
|
||||
try:
|
||||
response = urllib.request.urlopen('http://192.168.178.51/bell/on', timeout=5).read().decode('utf-8')
|
||||
|
||||
Reference in New Issue
Block a user