-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayzspa.py
executable file
·57 lines (46 loc) · 1.18 KB
/
layzspa.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
#!/usr/bin/env python3
import sys
from dataclasses import dataclass
import json
DEBUG = True
def skills():
print("description=Transfomer to controll LayzSpa via loxone")
print("link=https://todefine")
print("input=json")
print("output=json")
if sys.argv[1] == "skills":
skills()
exit(0)
values = sys.argv[1]
data = json.loads(values)
for key, value in data.items():
input = value.split(" ")
if input[0] == "air":
cmd = {
"CMD": int(2), # SETBUBBLES
"VALUE": int(input[1]),
"XTIME": 0,
"INTERVAL": 0,
}
if input[0] == "heating":
cmd = {
"CMD": int(3), # SETHEATER
"VALUE": int(input[1]),
"XTIME": 0,
"INTERVAL": 0,
}
if input[0] == "filter":
cmd = {
"CMD": int(4), # SETPUMP
"VALUE": int(input[1]),
"XTIME": 0,
"INTERVAL": 0,
}
if input[0] == "ambient":
cmd = {
"CMD": int(15), # SETAMBIENTC
"VALUE": int(float(input[1])),
"XTIME": 0,
"INTERVAL": 0,
}
print(json.dumps({key: json.dumps(cmd)}))