-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.py
47 lines (35 loc) · 1.01 KB
/
misc.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
from qhue import Bridge
import yaml
import time
import configparser
config = configparser.ConfigParser()
config.read("config.ini")
username = config.get("DEFAULT","username")
print ("username",username)
bridgeAddress = config.get("DEFAULT","bridgeAddress")
print("brdge at",bridgeAddress)
# misc actions
b = Bridge(bridgeAddress, username)
# This should give you something familiar from the API docs:
print (b.url)
lights = b.lights # Creates a new Resource with its own URL
print (lights.url) # Should have '/lights' on the end
# Let's actually call the API and print the results
print (lights())
# Get information about light 1
print (b.lights[1])
b.lights[1].state(bri=128, hue=30000, sat=200, alert="select")
#i = 0
#while i <=256:
# b.lights[1].state(bri=i, hue=9000, sat=200)
# time.sleep(.1)
# print(i)
# i+=10
#i = 0
#while i <=65260:
# b.lights[1].state(bri=128, hue=i)
# time.sleep(.1)
# print(i)
# i+=1000
#b.lights[1].state(on=True)
print (yaml.safe_dump(b.groups(), indent=4))