weheat 2024.9.5__tar.gz → 2024.9.10rc1__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.10rc1}/PKG-INFO +1 -1
  2. {weheat-2024.9.5 → weheat-2024.9.10rc1}/pyproject.toml +1 -1
  3. {weheat-2024.9.5 → weheat-2024.9.10rc1}/setup.py +1 -1
  4. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/heat_pump.py +33 -5
  5. {weheat-2024.9.5 → weheat-2024.9.10rc1/weheat.egg-info}/PKG-INFO +1 -1
  6. {weheat-2024.9.5 → weheat-2024.9.10rc1}/LICENSE +0 -0
  7. {weheat-2024.9.5 → weheat-2024.9.10rc1}/README.md +0 -0
  8. {weheat-2024.9.5 → weheat-2024.9.10rc1}/setup.cfg +0 -0
  9. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/__init__.py +0 -0
  10. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/__init__.py +0 -0
  11. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/auth.py +0 -0
  12. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/discovery.py +0 -0
  13. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/user.py +0 -0
  14. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/__init__.py +0 -0
  15. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/energy_log_api.py +0 -0
  16. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/heat_pump_api.py +0 -0
  17. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/heat_pump_log_api.py +0 -0
  18. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/user_api.py +0 -0
  19. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api_client.py +0 -0
  20. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api_response.py +0 -0
  21. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/configuration.py +0 -0
  22. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/exceptions.py +0 -0
  23. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/__init__.py +0 -0
  24. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/boiler_type.py +0 -0
  25. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/device_state.py +0 -0
  26. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/dhw_type.py +0 -0
  27. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/energy_view_dto.py +0 -0
  28. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_log_view_dto.py +0 -0
  29. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_model.py +0 -0
  30. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_status_enum.py +0 -0
  31. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_type.py +0 -0
  32. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/raw_heat_pump_log_dto.py +0 -0
  33. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/read_all_heat_pump_dto.py +0 -0
  34. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/read_heat_pump_dto.py +0 -0
  35. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/read_user_dto.py +0 -0
  36. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/role.py +0 -0
  37. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/py.typed +0 -0
  38. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/rest.py +0 -0
  39. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat.egg-info/SOURCES.txt +0 -0
  40. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat.egg-info/dependency_links.txt +0 -0
  41. {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat.egg-info/requires.txt +0 -0
  42. {weheat-2024.9.5 → weheat-2024.9.10rc1}/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.10rc1
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.10rc1"
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.10rc1"
25
25
  PYTHON_REQUIRES = ">=3.7"
26
26
  REQUIRES = [
27
27
  "urllib3 >= 1.25.3, < 2.1.0",
@@ -2,11 +2,14 @@ from enum import Enum, auto
2
2
  from weheat.configuration import Configuration
3
3
  from weheat.api_client import ApiClient
4
4
  from weheat.api.heat_pump_log_api import HeatPumpLogApi
5
+ from weheat.api.energy_log_api import EnergyLogApi
6
+ from datetime import datetime, timedelta
7
+
8
+ START_DATE = datetime(2024, 1, 11, 0, 0, 0)
5
9
 
6
10
 
7
11
  class HeatPump:
8
12
  class State(Enum):
9
- UNDEFINED = auto()
10
13
  STANDBY = auto()
11
14
  WATER_CHECK = auto()
12
15
  HEATING = auto()
@@ -21,6 +24,7 @@ class HeatPump:
21
24
  self._api_url = api_url
22
25
  self._uuid = uuid
23
26
  self._last_log = None
27
+ self._energy_consumption = None
24
28
 
25
29
  def get_status(self, access_token: str):
26
30
  try:
@@ -34,6 +38,27 @@ class HeatPump:
34
38
  )
35
39
  if response.status_code == 200:
36
40
  self._last_log = response.data
41
+
42
+ # Also get all energy totals form past years and add them together
43
+ # As end time pick today + 1 day to avoid issues with timezones
44
+ response = EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=self._uuid,
45
+ start_time=START_DATE,
46
+ end_time=datetime.now() + timedelta(days=1),
47
+ interval='Year')
48
+
49
+ if response.status_code == 200:
50
+ # aggregate the energy consumption
51
+ self._energy_consumption = 0
52
+ for year in response.data:
53
+ self._energy_consumption += year.total_ein_cooling
54
+ self._energy_consumption += year.total_ein_heating
55
+ self._energy_consumption += year.total_ein_heating_defrost
56
+ self._energy_consumption += year.total_ein_dhw
57
+ self._energy_consumption += year.total_ein_dhw_defrost
58
+ print(f'Summed for {self._uuid}: {self._energy_consumption}')
59
+
60
+
61
+
37
62
  except Exception as e:
38
63
  self._last_log = None
39
64
  raise e
@@ -133,10 +158,10 @@ class HeatPump:
133
158
  return self._if_available("control_bridge_status_decoded_gas_boiler")
134
159
 
135
160
  @property
136
- def heat_pump_state(self) -> State:
161
+ def heat_pump_state(self) -> State | None:
137
162
  numeric_state = self._if_available("state")
138
163
  if numeric_state is None:
139
- return self.State.UNDEFINED
164
+ return None
140
165
 
141
166
  if numeric_state == 40:
142
167
  return self.State.STANDBY
@@ -154,5 +179,8 @@ class HeatPump:
154
179
  return self.State.MANUAL_CONTROL
155
180
  elif numeric_state == 200:
156
181
  return self.State.DEFROSTING
157
- else:
158
- return self.State.UNDEFINED
182
+ return None
183
+
184
+ @property
185
+ def energy_total(self):
186
+ 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.10rc1
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