-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsence.py
More file actions
25 lines (20 loc) · 713 Bytes
/
Copy pathsence.py
File metadata and controls
25 lines (20 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
#! -*- coding: utf-8 -*-
"""
Display Info of Sencers in i-remocon
"""
from iremocon import IRemocon
remocon = IRemocon('iremocon.yaml')
# send command
answer = remocon.SendCommand(b'*se\r\n').decode('ascii')
print('Recieved', answer)
# parse answer
if answer.startswith('se;ok;'):
illuminance = float(answer.rstrip('\r\n').split(';')[2])
humidity = float(answer.rstrip('\r\n').split(';')[3])
temperature = float(answer.rstrip('\r\n').split(';')[4])
print('illuminance: {illum:.0f}lx'.format(illum=illuminance))
print('humidity: {humidity:.0f}%'.format(humidity=humidity))
print('temperature: {temper:.0f}°C'.format(temper=temperature))
else:
print('Error')