-
Notifications
You must be signed in to change notification settings - Fork 1
/
tempglow.py
69 lines (66 loc) · 2.03 KB
/
tempglow.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import pywapi
import string
from PyGlow import PyGlow
from time import sleep
import urllib
pyglow = PyGlow() #Setup piglow and turn all off
pyglow.all(0)
pyglow.all(brightness=255, speed=500, pulse=True)
sleep(1)
pyglow.all(brightness=255, speed=500, pulse=True)
sleep(1)
pyglow.all(brightness=255, speed=500, pulse=True)
sleep(1)
yahoo_result = pywapi.get_weather_from_yahoo('FIXX0031') #This gets the weather from Yahoo. Set the code for your city: https://www.edg3.uk/snippets/weather-location-codes/
temp = yahoo_result['condition']['temp'] # This gets only the temperature from the conditions
print temp
temperature=int(temp)
if temperature <-20:
pyglow.color("blue", 255)
elif temperature < -10:
pyglow.color("blue", 255)
pyglow.color("green", 200)
elif temperature < -5:
pyglow.color("green", 255)
pyglow.color("blue", 255)
pyglow.color("orange", 150)
pyglow.color("yellow", 255)
elif temperature < 0:
pyglow.color("green", 255)
pyglow.color("blue", 120)
pyglow.color("orange", 150)
pyglow.color("yellow", 255)
elif temperature < 5:
pyglow.color("green", 255)
pyglow.color("yellow", 200)
pyglow.color("orange", 210)
pyglow.color("red", 200)
elif temperature < 10:
pyglow.color("green", 240)
pyglow.color("yellow", 200)
pyglow.color("orange", 255)
pyglow.color("red", 220)
elif temerature < 15:
pyglow.color("green", 220)
pyglow.color("yellow", 255)
pyglow.color("orange", 255)
pyglow.color("red", 255)
elif temperature < 20:
pyglow.colur("green", 180)
pyglow.color("yellow", 255)
pyglow.color("orange", 255)
pyglow.color("red", 255)
elif temperature < 25:
pyglow.color("green", 90)
pyglow.color("yellow", 255)
pyglow.color("orange", 255)
pyglow.color("red", 255)
elif temperature < 30:
pyglow.color("red", 255)
pyglow.color("orange", 255)
elif temperature < 40:
pyglow.color("red", 255)
pyglow.color("blue", 180)
pyglow.color("orange", 255)
pyglow.color("red", 255)
else: pyglow.all(255)