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.
- {weheat-2024.9.5/weheat.egg-info → weheat-2024.9.10rc1}/PKG-INFO +1 -1
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/pyproject.toml +1 -1
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/setup.py +1 -1
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/heat_pump.py +33 -5
- {weheat-2024.9.5 → weheat-2024.9.10rc1/weheat.egg-info}/PKG-INFO +1 -1
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/LICENSE +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/README.md +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/setup.cfg +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/__init__.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/__init__.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/auth.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/discovery.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/abstractions/user.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/__init__.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/energy_log_api.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/heat_pump_api.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/heat_pump_log_api.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api/user_api.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api_client.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/api_response.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/configuration.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/exceptions.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/__init__.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/boiler_type.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/device_state.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/dhw_type.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/energy_view_dto.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_log_view_dto.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_model.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_status_enum.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/heat_pump_type.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/raw_heat_pump_log_dto.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/read_all_heat_pump_dto.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/read_heat_pump_dto.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/read_user_dto.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/models/role.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/py.typed +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat/rest.py +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat.egg-info/SOURCES.txt +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat.egg-info/dependency_links.txt +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat.egg-info/requires.txt +0 -0
- {weheat-2024.9.5 → weheat-2024.9.10rc1}/weheat.egg-info/top_level.txt +0 -0
|
@@ -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.
|
|
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
|
|
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
|
-
|
|
158
|
-
|
|
182
|
+
return None
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def energy_total(self):
|
|
186
|
+
return self._energy_consumption
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|