-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathexample.py
184 lines (140 loc) · 5.32 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
CHANGE_HEAT_PUMP_DATA_DURING_TEST = (
False # Set to True if you want to change heat pump data during test
)
USERNAME = None
PASSWORD = None
with open(".env", "r") as env_file:
for line in env_file:
if line.startswith("USERNAME="):
USERNAME = line.split("=")[1].strip()
elif line.startswith("PASSWORD="):
PASSWORD = line.split("=")[1].strip()
if not USERNAME or not PASSWORD:
USERNAME = input("Enter username: ")
PASSWORD = input("Enter password: ")
thermia = Thermia(USERNAME, PASSWORD)
print("Connected: " + str(thermia.connected))
heat_pump = thermia.heat_pumps[0]
print("Creating debug file")
with open("debug.txt", "w") as f:
f.write(heat_pump.debug())
print("Debug file created")
print("\n")
print("\n")
print("Heat pump model: " + str(heat_pump.model))
print("Heat pump model id: " + str(heat_pump.model_id))
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("Pool Temperature: " + str(heat_pump.pool_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("Running operational statuses: " + str(heat_pump.running_operational_statuses))
print(
"Available operational statuses: " + str(heat_pump.available_operational_statuses)
)
print(
"Available operational statuses map: "
+ str(heat_pump.available_operational_statuses_map)
)
print("\n")
print("Power status")
print("Running power statuses: " + str(heat_pump.running_power_statuses))
print("Available power statuses: " + str(heat_pump.available_power_statuses))
print("Available power statuses map: " + str(heat_pump.available_power_statuses_map))
print("\n")
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("Heating Operational Time: " + str(heat_pump.heating_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))