weheat 2024.9.5__tar.gz → 2024.9.10__tar.gz

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.

Potentially problematic release.


This version of weheat might be problematic. Click here for more details.

Files changed (42) hide show
  1. {weheat-2024.9.5/weheat.egg-info → weheat-2024.9.10}/PKG-INFO +1 -1
  2. {weheat-2024.9.5 → weheat-2024.9.10}/pyproject.toml +1 -1
  3. {weheat-2024.9.5 → weheat-2024.9.10}/setup.py +1 -1
  4. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/abstractions/heat_pump.py +57 -8
  5. {weheat-2024.9.5 → weheat-2024.9.10/weheat.egg-info}/PKG-INFO +1 -1
  6. {weheat-2024.9.5 → weheat-2024.9.10}/LICENSE +0 -0
  7. {weheat-2024.9.5 → weheat-2024.9.10}/README.md +0 -0
  8. {weheat-2024.9.5 → weheat-2024.9.10}/setup.cfg +0 -0
  9. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/__init__.py +0 -0
  10. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/abstractions/__init__.py +0 -0
  11. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/abstractions/auth.py +0 -0
  12. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/abstractions/discovery.py +0 -0
  13. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/abstractions/user.py +0 -0
  14. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/api/__init__.py +0 -0
  15. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/api/energy_log_api.py +0 -0
  16. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/api/heat_pump_api.py +0 -0
  17. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/api/heat_pump_log_api.py +0 -0
  18. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/api/user_api.py +0 -0
  19. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/api_client.py +0 -0
  20. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/api_response.py +0 -0
  21. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/configuration.py +0 -0
  22. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/exceptions.py +0 -0
  23. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/__init__.py +0 -0
  24. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/boiler_type.py +0 -0
  25. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/device_state.py +0 -0
  26. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/dhw_type.py +0 -0
  27. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/energy_view_dto.py +0 -0
  28. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/heat_pump_log_view_dto.py +0 -0
  29. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/heat_pump_model.py +0 -0
  30. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/heat_pump_status_enum.py +0 -0
  31. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/heat_pump_type.py +0 -0
  32. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/raw_heat_pump_log_dto.py +0 -0
  33. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/read_all_heat_pump_dto.py +0 -0
  34. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/read_heat_pump_dto.py +0 -0
  35. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/read_user_dto.py +0 -0
  36. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/models/role.py +0 -0
  37. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/py.typed +0 -0
  38. {weheat-2024.9.5 → weheat-2024.9.10}/weheat/rest.py +0 -0
  39. {weheat-2024.9.5 → weheat-2024.9.10}/weheat.egg-info/SOURCES.txt +0 -0
  40. {weheat-2024.9.5 → weheat-2024.9.10}/weheat.egg-info/dependency_links.txt +0 -0
  41. {weheat-2024.9.5 → weheat-2024.9.10}/weheat.egg-info/requires.txt +0 -0
  42. {weheat-2024.9.5 → weheat-2024.9.10}/weheat.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: weheat
3
- Version: 2024.9.5
3
+ Version: 2024.9.10
4
4
  Summary: Weheat Backend client
5
5
  Home-page: https://github.com/wefabricate/wh-python
6
6
  Author: Jesper Raemaekers
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "weheat"
3
- version = "2024.09.05"
3
+ version = "2024.09.10"
4
4
  description = "Weheat Backend"
5
5
  authors = ["Jesper Raemaekers <jesper.raemaekers@wefabricate.com>", "Kjell van Straaten <kjell.van.straaten@wefabricate.com>"]
6
6
  license = "MIT"
@@ -21,7 +21,7 @@ from setuptools import setup, find_packages # noqa: H301
21
21
  # prerequisite: setuptools
22
22
  # http://pypi.python.org/pypi/setuptools
23
23
  NAME = "weheat"
24
- VERSION = "2024.09.05"
24
+ VERSION = "2024.09.10"
25
25
  PYTHON_REQUIRES = ">=3.7"
26
26
  REQUIRES = [
27
27
  "urllib3 >= 1.25.3, < 2.1.0",
@@ -1,12 +1,18 @@
1
+ """Weheat heat pump abstraction from the API."""
1
2
  from enum import Enum, auto
2
3
  from weheat.configuration import Configuration
3
4
  from weheat.api_client import ApiClient
4
5
  from weheat.api.heat_pump_log_api import HeatPumpLogApi
6
+ from weheat.api.energy_log_api import EnergyLogApi
7
+ from datetime import datetime, timedelta
8
+
9
+ # before this date no energy logs are available, so start from this point onwards
10
+ START_DATE = datetime(2023, 1, 1, 0, 0, 0)
5
11
 
6
12
 
7
13
  class HeatPump:
14
+ """Heat pump class representing a heat pump."""
8
15
  class State(Enum):
9
- UNDEFINED = auto()
10
16
  STANDBY = auto()
11
17
  WATER_CHECK = auto()
12
18
  HEATING = auto()
@@ -21,8 +27,10 @@ class HeatPump:
21
27
  self._api_url = api_url
22
28
  self._uuid = uuid
23
29
  self._last_log = None
30
+ self._energy_consumption = None
24
31
 
25
32
  def get_status(self, access_token: str):
33
+ """Updates the heat pump instance with data from the API."""
26
34
  try:
27
35
  config = Configuration(host=self._api_url, access_token=access_token)
28
36
 
@@ -34,14 +42,33 @@ class HeatPump:
34
42
  )
35
43
  if response.status_code == 200:
36
44
  self._last_log = response.data
45
+
46
+ # Also get all energy totals form past years and add them together
47
+ # As end time pick today + 1 day to avoid issues with timezones
48
+ response = EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=self._uuid,
49
+ start_time=START_DATE,
50
+ end_time=datetime.now() + timedelta(days=1),
51
+ interval='Year')
52
+
53
+ if response.status_code == 200:
54
+ # aggregate the energy consumption
55
+ self._energy_consumption = 0
56
+ for year in response.data:
57
+ self._energy_consumption += year.total_ein_cooling
58
+ self._energy_consumption += year.total_ein_heating
59
+ self._energy_consumption += year.total_ein_heating_defrost
60
+ self._energy_consumption += year.total_ein_dhw
61
+ self._energy_consumption += year.total_ein_dhw_defrost
62
+
63
+
64
+
37
65
  except Exception as e:
38
66
  self._last_log = None
67
+ self._energy_consumption = None
39
68
  raise e
40
69
 
41
- def _update_properties(self):
42
- pass
43
-
44
70
  def _if_available(self, key):
71
+ """Returns the value from the last logged value if available. None otherwise."""
45
72
  if self._last_log is not None and hasattr(self._last_log, key):
46
73
  return getattr(self._last_log, key)
47
74
  return None
@@ -54,54 +81,67 @@ class HeatPump:
54
81
 
55
82
  @property
56
83
  def water_inlet_temperature(self):
84
+ """The heat pump water inlet temperature."""
57
85
  return self._if_available("t_water_in")
58
86
 
59
87
  @property
60
88
  def water_outlet_temperature(self):
89
+ """The heat pump water outlet temperature."""
61
90
  return self._if_available("t_water_out")
62
91
 
63
92
  @property
64
93
  def water_house_in_temperature(self):
94
+ """The water house in temperature."""
65
95
  return self._if_available("t_water_house_in")
66
96
 
67
97
  @property
68
98
  def air_inlet_temperature(self):
99
+ """The heat pump air inlet temperature."""
69
100
  return self._if_available("t_air_in")
70
101
 
71
102
  @property
72
103
  def air_outlet_temperature(self):
104
+ """The heat pump air outlet temperature."""
73
105
  return self._if_available("t_air_out")
74
106
 
75
107
  @property
76
108
  def thermostat_water_setpoint(self):
109
+ """The thermostat water setpoint."""
77
110
  return self._if_available("t_thermostat_setpoint")
78
111
 
79
112
  @property
80
113
  def thermostat_room_temperature(self):
114
+ """The thermostat current room temperature."""
81
115
  return self._if_available("t_room")
82
116
 
83
117
  @property
84
118
  def thermostat_room_temperature_setpoint(self):
119
+ """The thermostat room temperature setpoint."""
85
120
  return self._if_available("t_room_target")
86
121
 
87
122
  @property
88
123
  def thermostat_on_off_state(self):
124
+ """The thermostat on/off state."""
89
125
  return self._if_available("on_off_thermostat_state")
90
126
 
91
127
  @property
92
128
  def power_input(self):
129
+ """The heat pumps power input."""
93
130
  return self._if_available("cm_mass_power_in")
94
131
 
95
132
  @property
96
133
  def power_output(self):
134
+ """The heat pumps hydraulic output power."""
97
135
  return self._if_available("cm_mass_power_out")
98
136
 
99
137
  @property
100
138
  def dhw_top_temperature(self):
139
+ """The DHW vessel top temperature."""
101
140
  return self._if_available("t1")
102
141
 
103
142
  @property
104
143
  def dhw_bottom_temperature(self):
144
+ """The DHW vessel bottom temperature."""
105
145
  return self._if_available("t2")
106
146
 
107
147
  @property
@@ -118,25 +158,30 @@ class HeatPump:
118
158
 
119
159
  @property
120
160
  def inside_unit_water_pump_state(self):
161
+ """Decoded water pump state."""
121
162
  return self._if_available("control_bridge_status_decoded_water_pump")
122
163
 
123
164
  @property
124
165
  def inside_unit_auxilary_pump_state(self):
166
+ """Decoded auxilary pump state."""
125
167
  return self._if_available("control_bridge_status_decoded_water_pump2")
126
168
 
127
169
  @property
128
170
  def inside_unit_dhw_valve_or_pump_state(self):
171
+ """Decoded DHW valve or pump state."""
129
172
  return self._if_available("control_bridge_status_decoded_dhw_valve")
130
173
 
131
174
  @property
132
175
  def inside_unit_gas_boiler_state(self):
176
+ """Decoded gas boiler state."""
133
177
  return self._if_available("control_bridge_status_decoded_gas_boiler")
134
178
 
135
179
  @property
136
- def heat_pump_state(self) -> State:
180
+ def heat_pump_state(self) -> State | None:
181
+ """The heat pump state."""
137
182
  numeric_state = self._if_available("state")
138
183
  if numeric_state is None:
139
- return self.State.UNDEFINED
184
+ return None
140
185
 
141
186
  if numeric_state == 40:
142
187
  return self.State.STANDBY
@@ -154,5 +199,9 @@ class HeatPump:
154
199
  return self.State.MANUAL_CONTROL
155
200
  elif numeric_state == 200:
156
201
  return self.State.DEFROSTING
157
- else:
158
- return self.State.UNDEFINED
202
+ return None
203
+
204
+ @property
205
+ def energy_total(self):
206
+ """The total used energy in kWh from 2023 to now."""
207
+ return self._energy_consumption
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: weheat
3
- Version: 2024.9.5
3
+ Version: 2024.9.10
4
4
  Summary: Weheat Backend client
5
5
  Home-page: https://github.com/wefabricate/wh-python
6
6
  Author: Jesper Raemaekers
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes