-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopberry.py
42 lines (29 loc) · 978 Bytes
/
popberry.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/local/bin/python3
from modules import *
data = {}
def getWeather():
return weather.currentWeather()
def hueTemperature():
temp = hue.getTemperatureSensors(hue.getSensors())
tempSensors = []
for sensor, val in temp.items():
room_name = val['name']
room_temp = val['state']['temperature']/100
#print(room_name,': ',room_temp)
tempSensors.append({room_name : room_temp})
return tempSensors
def updateInformation():
data['currentweather'] = weather.currentWeather()
print(data['currentweather'])
# push to database
for key, val in data['currentweather'].items():
firebase.pushToDatabase(val, ['currentweather', key])
data['room_temp'] = hueTemperature()
for d in data['room_temp']:
for key, val in d.items():
firebase.pushToDatabase(val, ['room_temp', key])
def main():
print('main running')
updateInformation()
if __name__ == '__main__':
main()