forked from klejejs/python-thermia-online-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
184 lines (147 loc) · 5.79 KB
/
example.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
from datetime import datetime, timedelta
from ThermiaOnlineAPI import Thermia
from credentials import USERNAME, PASSWORD, API_TYPE
from ThermiaOnlineAPI.const import (
THERMIA_API_TYPE_CLASSIC,
THERMIA_API_TYPE_GENESIS,
)
CHANGE_HEAT_PUMP_DATA_DURING_TEST = (
False # Set to True if you want to change heat pump data during test
)
if not USERNAME or not PASSWORD:
USERNAME = input("Enter username: ")
PASSWORD = input("Enter password: ")
if not API_TYPE:
api_type_number = input("Enter api type (1 = classic, 2 = genesis): ")
if api_type_number == "1":
API_TYPE = THERMIA_API_TYPE_CLASSIC
elif api_type_number == "2":
API_TYPE = THERMIA_API_TYPE_GENESIS
else:
print("Invalid api type")
exit(1)
thermia = Thermia(USERNAME, PASSWORD, api_type=API_TYPE)
print("Connected: " + str(thermia.connected))
heat_pump = thermia.fetch_heat_pumps()[0]
heat_pump.debug()
print("\n")
print("\n")
print(
"All available register groups: "
+ str(heat_pump.get_all_available_register_groups())
)
print(
"Available registers for 'REG_GROUP_HEATING_CURVE' group: "
+ str(heat_pump.get_available_registers_for_group("REG_GROUP_HEATING_CURVE"))
)
print("\n")
print("Other temperatures")
print("Supply Line Temperature: " + str(heat_pump.supply_line_temperature))
print(
"Desired Supply Line Temperature: " + str(heat_pump.desired_supply_line_temperature)
)
print("Return Line Temperature: " + str(heat_pump.return_line_temperature))
print("Brine Out Temperature: " + str(heat_pump.brine_out_temperature))
print("Brine In Temperature: " + str(heat_pump.brine_in_temperature))
print("Cooling Tank Temperature: " + str(heat_pump.cooling_tank_temperature))
print(
"Cooling Supply Line Temperature: " + str(heat_pump.cooling_supply_line_temperature)
)
print("\n")
print("Operational status")
print("Operational status: " + str(heat_pump.operational_status))
print(
"Available operational statuses: " + str(heat_pump.available_operational_statuses)
)
print(
"Available operational statuses map: "
+ str(heat_pump.available_operational_statuses_map)
)
print("Auxiliary heater 3KW: " + str(heat_pump.operational_status_auxiliary_heater_3kw))
print("Auxiliary heater 6KW: " + str(heat_pump.operational_status_auxiliary_heater_6kw))
print("Auxiliary heater 9KW: " + str(heat_pump.operational_status_auxiliary_heater_9kw))
print(
"Auxiliary heater 12KW: " + str(heat_pump.operational_status_auxiliary_heater_12kw)
)
print(
"Auxiliary heater 15KW: " + str(heat_pump.operational_status_auxiliary_heater_15kw)
)
print("Compressor status: " + str(heat_pump.operational_status_compressor_status))
print("Brine pump status: " + str(heat_pump.operational_status_brine_pump_status))
print("Radiator pump status: " + str(heat_pump.operational_status_radiator_pump_status))
print("Cooling status: " + str(heat_pump.operational_status_cooling_status))
print("Hot water status: " + str(heat_pump.operational_status_hot_water_status))
print("Heating status: " + str(heat_pump.operational_status_heating_status))
print("Integral: " + str(heat_pump.operational_status_integral))
print("Pid: " + str(heat_pump.operational_status_pid))
print("\n")
print("Operational Times")
print("Compressor Operational Time: " + str(heat_pump.compressor_operational_time))
print("Hot Water Operational Time: " + str(heat_pump.hot_water_operational_time))
print(
"Auxiliary Heater 1 Operational Time: "
+ str(heat_pump.auxiliary_heater_1_operational_time)
)
print(
"Auxiliary Heater 2 Operational Time: "
+ str(heat_pump.auxiliary_heater_2_operational_time)
)
print(
"Auxiliary Heater 3 Operational Time: "
+ str(heat_pump.auxiliary_heater_3_operational_time)
)
print("\n")
print("Alarms data")
print("Active Alarm Count: " + str(heat_pump.active_alarm_count))
if heat_pump.active_alarm_count > 0:
print("Active Alarms: " + str(heat_pump.active_alarms))
print("\n")
print("Operation Mode data")
print("Operation Mode: " + str(heat_pump.operation_mode))
print("Available Operation Modes: " + str(heat_pump.available_operation_modes))
print("Available Operation Modes Map: " + str(heat_pump.available_operation_mode_map))
print("Is Operation Mode Read Only: " + str(heat_pump.is_operation_mode_read_only))
print("\n")
print("Hot Water data")
print("Hot Water Switch State: " + str(heat_pump.hot_water_switch_state))
print("Hot Water Boost Switch State: " + str(heat_pump.hot_water_boost_switch_state))
print("\n")
print(
"Available historical data registers: " + str(heat_pump.historical_data_registers)
)
print(
"Historical data for outdoor temperature during past 24h: "
+ str(
heat_pump.get_historical_data_for_register(
"REG_OUTDOOR_TEMPERATURE",
datetime.now() - timedelta(days=1),
datetime.now(),
)
)
)
print("\n")
print(
"Heating Curve Register Data: "
+ str(
heat_pump.get_register_data_by_register_group_and_name(
"REG_GROUP_HEATING_CURVE", "REG_HEATING_HEAT_CURVE"
)
)
)
print("\n")
thermia.update_data()
if CHANGE_HEAT_PUMP_DATA_DURING_TEST:
heat_pump.set_temperature(19)
heat_pump.set_register_data_by_register_group_and_name(
"REG_GROUP_HEATING_CURVE", "REG_HEATING_HEAT_CURVE", 30
)
heat_pump.set_operation_mode("COMPRESSOR")
if heat_pump.hot_water_switch_state:
heat_pump.set_hot_water_switch_state(1)
if heat_pump.hot_water_boost_switch_state:
heat_pump.set_hot_water_boost_switch_state(1)
print("Heat Temperature: " + str(heat_pump.heat_temperature))
print("Operation Mode: " + str(heat_pump.operation_mode))
print("Available Operation Modes: " + str(heat_pump.available_operation_modes))
print("Hot Water Switch State: " + str(heat_pump.hot_water_switch_state))
print("Hot Water Boost Switch State: " + str(heat_pump.hot_water_boost_switch_state))