-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathserver_parser.py
More file actions
36 lines (31 loc) · 1.09 KB
/
Copy pathserver_parser.py
File metadata and controls
36 lines (31 loc) · 1.09 KB
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
#!/usr/bin/python3
"""Quick & dirty utility to check parsing of various server JSON files"""
import sys
import json
from pykumo import KumoCloudAccount
def main():
"""Entry point"""
filename = sys.argv[1]
file = open(filename)
kumo_json = json.load(file)
account = KumoCloudAccount(None, None, kumo_dict=kumo_json)
units = account.get_all_units()
print("Units: %s" % str(units))
for unit in units:
print(
"Unit %s: address: %s credentials: %s"
% (
account.get_name(unit),
account.get_address(unit),
account.get_credentials(unit),
)
)
# Optional script to test fetching data from the units
# kumos = account.make_pykumos()
# for kumoName in kumos:
# if isinstance(kumos[kumoName], PyKumoStation):
# print("Kumo Station Outdoor Temp: %s" % (kumos[kumoName].get_outdoor_temperature()))
# else:
# print("Indoor Unit %s Current Temp: %s" % (kumoName, kumos[kumoName].get_current_temperature()))
if __name__ == "__main__":
main()