-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample.py
More file actions
68 lines (47 loc) · 1.64 KB
/
example.py
File metadata and controls
68 lines (47 loc) · 1.64 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
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
"""
Example usage of controlmyspa module
use e.g. with "python example.py user@example.com myverysecretpassword"
"""
import argparse
import logging
from controlmyspa import ControlMySpa
PARSER = argparse.ArgumentParser(description="Get metrics from Balboa Controlmyspa")
PARSER.add_argument(
"-v",
"--verbose",
help="enable debug logging",
action="store_true",
default=False,
)
PARSER.add_argument("email", help="email to log in to controlmyspa.com")
PARSER.add_argument("password", help="password to log in to controlmyspa.com")
ARGS = PARSER.parse_args()
LOGFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
if ARGS.verbose:
logging.basicConfig(level=logging.DEBUG, format=LOGFORMAT)
else:
logging.basicConfig(level=logging.INFO, format=LOGFORMAT)
logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(
logging.WARNING
)
logging.debug("starting with arguments: %s", ARGS)
API = ControlMySpa(ARGS.email, ARGS.password)
print("online", API.online)
print("current_temp", API.current_temp)
print("desired_temp", API.desired_temp)
API.desired_temp = 27 if API.desired_temp == 37 else 37
print("temp_range", API.temp_range)
print("panel_lock", API.panel_lock)
print("lights", API.lights)
# toggle lights
# API.lights = [not x for x in API.lights]
print("jets", API.jets)
# toggle jets
# API.set_jet(0, not API.get_jet(0))
# API.set_jet(1, not API.get_jet(1))
# API.set_jet(2, not API.get_jet(2))
print("blowers", API.blowers)
print("heater", API.heater_mode)
print("circulation_pumps", API.circulation_pumps)
print("ozone_generators", API.ozone_generators)
print("serial", API.get_serial())