weheat 2024.9.23rc1__py3-none-any.whl → 2024.11.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- weheat/abstractions/heat_pump.py +58 -0
- {weheat-2024.9.23rc1.dist-info → weheat-2024.11.1.dist-info}/METADATA +1 -1
- {weheat-2024.9.23rc1.dist-info → weheat-2024.11.1.dist-info}/RECORD +6 -6
- {weheat-2024.9.23rc1.dist-info → weheat-2024.11.1.dist-info}/WHEEL +1 -1
- {weheat-2024.9.23rc1.dist-info → weheat-2024.11.1.dist-info}/LICENSE +0 -0
- {weheat-2024.9.23rc1.dist-info → weheat-2024.11.1.dist-info}/top_level.txt +0 -0
weheat/abstractions/heat_pump.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""Weheat heat pump abstraction from the API."""
|
|
2
2
|
from enum import Enum, auto
|
|
3
|
+
|
|
4
|
+
from weheat import HeatPumpApi
|
|
3
5
|
from weheat.configuration import Configuration
|
|
4
6
|
from weheat.api_client import ApiClient
|
|
5
7
|
from weheat.api.heat_pump_log_api import HeatPumpLogApi
|
|
@@ -28,6 +30,8 @@ class HeatPump:
|
|
|
28
30
|
self._uuid = uuid
|
|
29
31
|
self._last_log = None
|
|
30
32
|
self._energy_consumption = None
|
|
33
|
+
self._energy_output = None
|
|
34
|
+
self._nominal_max_power = None
|
|
31
35
|
|
|
32
36
|
def get_status(self, access_token: str):
|
|
33
37
|
"""Updates the heat pump instance with data from the API."""
|
|
@@ -35,6 +39,14 @@ class HeatPump:
|
|
|
35
39
|
config = Configuration(host=self._api_url, access_token=access_token)
|
|
36
40
|
|
|
37
41
|
with ApiClient(configuration=config) as client:
|
|
42
|
+
# Set the max power once
|
|
43
|
+
if self._nominal_max_power is None:
|
|
44
|
+
repsonse = HeatPumpApi(client).api_v1_heat_pumps_heat_pump_id_get_with_http_info(heat_pump_id=self._uuid)
|
|
45
|
+
|
|
46
|
+
if repsonse.status_code == 200:
|
|
47
|
+
self._set_nominal_max_power_for_model(repsonse.data.model)
|
|
48
|
+
|
|
49
|
+
|
|
38
50
|
response = HeatPumpLogApi(
|
|
39
51
|
client
|
|
40
52
|
).api_v1_heat_pumps_heat_pump_id_logs_latest_get_with_http_info(
|
|
@@ -53,12 +65,18 @@ class HeatPump:
|
|
|
53
65
|
if response.status_code == 200:
|
|
54
66
|
# aggregate the energy consumption
|
|
55
67
|
self._energy_consumption = 0
|
|
68
|
+
self._energy_output = 0
|
|
56
69
|
for year in response.data:
|
|
57
70
|
self._energy_consumption += year.total_ein_cooling
|
|
58
71
|
self._energy_consumption += year.total_ein_heating
|
|
59
72
|
self._energy_consumption += year.total_ein_heating_defrost
|
|
60
73
|
self._energy_consumption += year.total_ein_dhw
|
|
61
74
|
self._energy_consumption += year.total_ein_dhw_defrost
|
|
75
|
+
self._energy_output += year.total_e_out_cooling
|
|
76
|
+
self._energy_output += year.total_e_out_heating
|
|
77
|
+
self._energy_output += year.total_e_out_heating_defrost
|
|
78
|
+
self._energy_output += year.total_e_out_dhw
|
|
79
|
+
self._energy_output += year.total_e_out_dhw_defrost
|
|
62
80
|
|
|
63
81
|
|
|
64
82
|
|
|
@@ -73,6 +91,23 @@ class HeatPump:
|
|
|
73
91
|
return getattr(self._last_log, key)
|
|
74
92
|
return None
|
|
75
93
|
|
|
94
|
+
def _set_nominal_max_power_for_model(self, model_id:int):
|
|
95
|
+
# These numbers are the rpm at 100% power in the portal
|
|
96
|
+
# RPM can go above 100% if the limit is increased in the portal.
|
|
97
|
+
# except for the Flint, that cannot go above 100%.
|
|
98
|
+
if model_id == 1:
|
|
99
|
+
#BB60
|
|
100
|
+
self._nominal_max_power = 5280
|
|
101
|
+
elif 2 <= model_id <= 4:
|
|
102
|
+
#SP60
|
|
103
|
+
self._nominal_max_power = 5280
|
|
104
|
+
elif model_id == 5:
|
|
105
|
+
# Flint
|
|
106
|
+
self._nominal_max_power = 5400
|
|
107
|
+
else:
|
|
108
|
+
#BB80
|
|
109
|
+
self._nominal_max_power = 4500
|
|
110
|
+
|
|
76
111
|
def __str__(self):
|
|
77
112
|
return f"WeheatHeatPump(uuid={self._uuid}, last update={self._if_available('timestamp')})"
|
|
78
113
|
|
|
@@ -176,6 +211,24 @@ class HeatPump:
|
|
|
176
211
|
"""Decoded gas boiler state."""
|
|
177
212
|
return self._if_available("control_bridge_status_decoded_gas_boiler")
|
|
178
213
|
|
|
214
|
+
@property
|
|
215
|
+
def inside_unit_gas_electric_heater(self):
|
|
216
|
+
"""Decoded electric heater state."""
|
|
217
|
+
return self._if_available("control_bridge_status_decoded_electric_heater")
|
|
218
|
+
|
|
219
|
+
@property
|
|
220
|
+
def compressor_percentage(self):
|
|
221
|
+
current_rpm = self._if_available("rpm")
|
|
222
|
+
if self._nominal_max_power is not None and current_rpm is not None:
|
|
223
|
+
# calculate percentage of rpm
|
|
224
|
+
return int((100 / self._nominal_max_power) * current_rpm)
|
|
225
|
+
return None
|
|
226
|
+
|
|
227
|
+
@property
|
|
228
|
+
def compressor_rpm(self):
|
|
229
|
+
"""Compressor RPM."""
|
|
230
|
+
return self._if_available("rpm")
|
|
231
|
+
|
|
179
232
|
@property
|
|
180
233
|
def heat_pump_state(self) -> State | None:
|
|
181
234
|
"""The heat pump state."""
|
|
@@ -205,3 +258,8 @@ class HeatPump:
|
|
|
205
258
|
def energy_total(self):
|
|
206
259
|
"""The total used energy in kWh from 2023 to now."""
|
|
207
260
|
return self._energy_consumption
|
|
261
|
+
|
|
262
|
+
@property
|
|
263
|
+
def energy_output(self):
|
|
264
|
+
"""The total energy output in kWh from 2023 to now."""
|
|
265
|
+
return self._energy_output
|
|
@@ -8,7 +8,7 @@ weheat/rest.py,sha256=hLgJ0CYAR1Dr_LppodDNNC_chj5hEQUmzDmbxvID1ao,13808
|
|
|
8
8
|
weheat/abstractions/__init__.py,sha256=cRdA_kyTIooo39I13_mqShSfZMqdzNGHbmrnITqgx6A,161
|
|
9
9
|
weheat/abstractions/auth.py,sha256=VCAxJ4OIj7bsYttqJl5-juU0VUlSd3xPu7kUjtHZr3U,979
|
|
10
10
|
weheat/abstractions/discovery.py,sha256=o0w4lxMPP-vfKrfsrH3-W_1Cxmk9u-hbywibY_zZs9w,2274
|
|
11
|
-
weheat/abstractions/heat_pump.py,sha256=
|
|
11
|
+
weheat/abstractions/heat_pump.py,sha256=CysEH7Z5u37SFuZPKZSnifnxeoiwVuMCyOkswFnwbUw,9706
|
|
12
12
|
weheat/abstractions/user.py,sha256=n1gmPaLKXmRjF1jDuMQ0951RkbBKm-Cx3cgUU2nOA9U,648
|
|
13
13
|
weheat/api/__init__.py,sha256=DQnnRs5Z29Nf5sGdFd3f96xM6p_FMym-_-dvQC2VzdU,243
|
|
14
14
|
weheat/api/energy_log_api.py,sha256=yIIqd-C_xHSM_1eNoj2i04IDkJkzU0-a9iFGDSd2zLo,11374
|
|
@@ -29,8 +29,8 @@ weheat/models/read_all_heat_pump_dto.py,sha256=PDaWb-2qSzAnMoIsNceHavT1ybIZa3-lv
|
|
|
29
29
|
weheat/models/read_heat_pump_dto.py,sha256=ufDbcHxtB8o2jmk00bMP_xol3uCdoTOqiHS6UUzRic4,4514
|
|
30
30
|
weheat/models/read_user_dto.py,sha256=J1YlL-WsXArbirllI1fHZrguKy5Wv35NIck59ICBSGg,3465
|
|
31
31
|
weheat/models/role.py,sha256=eF6nawkz8mmCGQEmJx26Y2MPFmlKdpOOtJ2Q70b-Qtc,938
|
|
32
|
-
weheat-2024.
|
|
33
|
-
weheat-2024.
|
|
34
|
-
weheat-2024.
|
|
35
|
-
weheat-2024.
|
|
36
|
-
weheat-2024.
|
|
32
|
+
weheat-2024.11.1.dist-info/LICENSE,sha256=rWmFUq0uth2jpet-RQ2QPd2VhZkcPSUs6Dxfmbqkbis,1068
|
|
33
|
+
weheat-2024.11.1.dist-info/METADATA,sha256=62ag45Pz7lgvMzy4RbwgZrJNvG26ZfpSaGGscOlEUAo,3901
|
|
34
|
+
weheat-2024.11.1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
35
|
+
weheat-2024.11.1.dist-info/top_level.txt,sha256=hLzdyvGZ9rs4AqK7U48mdHx_-FcP5sDuTSleDUvGAZw,7
|
|
36
|
+
weheat-2024.11.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|