forked from bigbadblunt/lightwave2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_readme.py
30 lines (27 loc) · 1.26 KB
/
example_readme.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
from lightwave_smart import lightwave_smart
import logging
logging.basicConfig(level=logging.DEBUG)
USER = None
PASSWORD = None
user = USER if USER else input("Enter username: ")
password = PASSWORD if PASSWORD else input("Enter password: ")
EXAMPLE_FEATURESET = '5bc4d06e87779374d29d7d9a-5bc4d61387779374d29fdd1e'
link = lightwave_smart.LWLink2(user, password)
link.connect()
link.get_hierarchy()
print(link.featuresets)
for i in link.featuresets.values():
print(i.name, i.featureset_id, i.features)
for i in link.featuresets[EXAMPLE_FEATURESET].features.values():
print(i.name, i.id, i.state)
print("Featureset name:",link.featuresets[EXAMPLE_FEATURESET].name)
print("is_switch:", link.featuresets[EXAMPLE_FEATURESET].is_switch())
print("is_light:",link.featuresets[EXAMPLE_FEATURESET].is_light())
print("is_climate:", link.featuresets[EXAMPLE_FEATURESET].is_climate())
print("is_energy:", link.featuresets[EXAMPLE_FEATURESET].is_energy())
print("is_gen2:", link.featuresets[EXAMPLE_FEATURESET].is_gen2())
print("Features:". link.featuresets[EXAMPLE_FEATURESET].features)
print("List of switches", link.get_switches())
print("List of lights:", link.get_lights())
print("List of climate devices:", link.get_climates())
print("List of energy sensors:", link.get_energy())