weheat 2025.1.14__py3-none-any.whl → 2025.1.15__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.
Potentially problematic release.
This version of weheat might be problematic. Click here for more details.
- weheat/__init__.py +7 -2
- weheat/abstractions/discovery.py +6 -6
- weheat/abstractions/heat_pump.py +11 -15
- weheat/abstractions/user.py +7 -7
- weheat/api/__init__.py +1 -0
- weheat/api/energy_log_api.py +306 -132
- weheat/api/heat_pump_api.py +521 -369
- weheat/api/heat_pump_log_api.py +836 -359
- weheat/api/user_api.py +243 -115
- weheat/api_client.py +234 -261
- weheat/api_response.py +10 -18
- weheat/configuration.py +14 -9
- weheat/exceptions.py +59 -25
- weheat/models/__init__.py +6 -0
- weheat/models/boiler_type.py +8 -3
- weheat/models/device_state.py +9 -4
- weheat/models/dhw_type.py +8 -3
- weheat/models/energy_view_dto.py +81 -66
- weheat/models/heat_pump_log_view_dto.py +527 -481
- weheat/models/heat_pump_model.py +8 -3
- weheat/models/heat_pump_status_enum.py +8 -3
- weheat/models/heat_pump_type.py +8 -3
- weheat/models/raw_heat_pump_log_dto.py +353 -315
- weheat/models/read_all_heat_pump_dto.py +64 -48
- weheat/models/read_heat_pump_dto.py +59 -43
- weheat/models/read_user_dto.py +54 -39
- weheat/models/read_user_me_dto.py +124 -0
- weheat/models/role.py +10 -4
- weheat/rest.py +152 -259
- weheat-2025.1.15.dist-info/METADATA +115 -0
- weheat-2025.1.15.dist-info/RECORD +37 -0
- weheat-2025.1.14.dist-info/METADATA +0 -117
- weheat-2025.1.14.dist-info/RECORD +0 -36
- {weheat-2025.1.14.dist-info → weheat-2025.1.15.dist-info}/LICENSE +0 -0
- {weheat-2025.1.14.dist-info → weheat-2025.1.15.dist-info}/WHEEL +0 -0
- {weheat-2025.1.14.dist-info → weheat-2025.1.15.dist-info}/top_level.txt +0 -0
weheat/api_response.py
CHANGED
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
"""API response object."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from typing import Any, Dict, Optional
|
|
4
|
+
from typing import Any, Dict, Optional, Generic, TypeVar
|
|
5
|
+
from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
from pydantic.v1 import Field, StrictInt, StrictStr
|
|
8
|
-
except ImportError:
|
|
9
|
-
from pydantic import Field, StrictInt, StrictStr
|
|
7
|
+
T = TypeVar("T")
|
|
10
8
|
|
|
11
|
-
class ApiResponse:
|
|
9
|
+
class ApiResponse(BaseModel, Generic[T]):
|
|
12
10
|
"""
|
|
13
11
|
API response object
|
|
14
12
|
"""
|
|
15
13
|
|
|
16
|
-
status_code:
|
|
14
|
+
status_code: StrictInt = Field(description="HTTP status code")
|
|
17
15
|
headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers")
|
|
18
|
-
data:
|
|
19
|
-
raw_data:
|
|
16
|
+
data: T = Field(description="Deserialized data given the data type")
|
|
17
|
+
raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
data=None,
|
|
25
|
-
raw_data=None) -> None:
|
|
26
|
-
self.status_code = status_code
|
|
27
|
-
self.headers = headers
|
|
28
|
-
self.data = data
|
|
29
|
-
self.raw_data = raw_data
|
|
19
|
+
model_config = {
|
|
20
|
+
"arbitrary_types_allowed": True
|
|
21
|
+
}
|
weheat/configuration.py
CHANGED
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
import copy
|
|
16
16
|
import logging
|
|
17
|
-
import multiprocessing
|
|
18
17
|
import sys
|
|
18
|
+
|
|
19
|
+
import aiohttp
|
|
19
20
|
import urllib3
|
|
20
21
|
|
|
21
22
|
import http.client as httplib
|
|
@@ -52,6 +53,7 @@ class Configuration:
|
|
|
52
53
|
values before.
|
|
53
54
|
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
|
54
55
|
in PEM format.
|
|
56
|
+
: param client_session: A aiohttp.ClientSession to use
|
|
55
57
|
|
|
56
58
|
:Example:
|
|
57
59
|
"""
|
|
@@ -64,7 +66,7 @@ class Configuration:
|
|
|
64
66
|
access_token=None,
|
|
65
67
|
server_index=None, server_variables=None,
|
|
66
68
|
server_operation_index=None, server_operation_variables=None,
|
|
67
|
-
ssl_ca_cert=None,
|
|
69
|
+
ssl_ca_cert=None, client_session=None
|
|
68
70
|
) -> None:
|
|
69
71
|
"""Constructor
|
|
70
72
|
"""
|
|
@@ -148,12 +150,9 @@ class Configuration:
|
|
|
148
150
|
Set this to the SNI value expected by the server.
|
|
149
151
|
"""
|
|
150
152
|
|
|
151
|
-
self.connection_pool_maxsize =
|
|
152
|
-
"""
|
|
153
|
-
|
|
154
|
-
not the best value when you are making a lot of possibly parallel
|
|
155
|
-
requests to the same host, which is often the case here.
|
|
156
|
-
cpu_count * 5 is used as default value to increase performance.
|
|
153
|
+
self.connection_pool_maxsize = 100
|
|
154
|
+
"""This value is passed to the aiohttp to limit simultaneous connections.
|
|
155
|
+
Default values is 100, None means no-limit.
|
|
157
156
|
"""
|
|
158
157
|
|
|
159
158
|
self.proxy = None
|
|
@@ -183,6 +182,8 @@ class Configuration:
|
|
|
183
182
|
"""date format
|
|
184
183
|
"""
|
|
185
184
|
|
|
185
|
+
self._client_session = client_session
|
|
186
|
+
|
|
186
187
|
def __deepcopy__(self, memo):
|
|
187
188
|
cls = self.__class__
|
|
188
189
|
result = cls.__new__(cls)
|
|
@@ -200,6 +201,10 @@ class Configuration:
|
|
|
200
201
|
def __setattr__(self, name, value):
|
|
201
202
|
object.__setattr__(self, name, value)
|
|
202
203
|
|
|
204
|
+
@property
|
|
205
|
+
def client_session(self) -> aiohttp.ClientSession|None:
|
|
206
|
+
return self._client_session
|
|
207
|
+
|
|
203
208
|
@classmethod
|
|
204
209
|
def set_default(cls, default):
|
|
205
210
|
"""Set default instance of configuration.
|
|
@@ -376,7 +381,7 @@ class Configuration:
|
|
|
376
381
|
"OS: {env}\n"\
|
|
377
382
|
"Python Version: {pyversion}\n"\
|
|
378
383
|
"Version of the API: v1\n"\
|
|
379
|
-
"SDK Package Version: 2024.
|
|
384
|
+
"SDK Package Version: 2024.11.15".\
|
|
380
385
|
format(env=sys.platform, pyversion=sys.version)
|
|
381
386
|
|
|
382
387
|
def get_host_settings(self):
|
weheat/exceptions.py
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
Do not edit the class manually.
|
|
12
12
|
""" # noqa: E501
|
|
13
13
|
|
|
14
|
+
from typing import Any, Optional
|
|
15
|
+
|
|
16
|
+
from typing_extensions import Self
|
|
14
17
|
|
|
15
18
|
class OpenApiException(Exception):
|
|
16
19
|
"""The base exception class for all OpenAPIExceptions"""
|
|
@@ -101,17 +104,56 @@ class ApiKeyError(OpenApiException, KeyError):
|
|
|
101
104
|
|
|
102
105
|
class ApiException(OpenApiException):
|
|
103
106
|
|
|
104
|
-
def __init__(
|
|
107
|
+
def __init__(
|
|
108
|
+
self,
|
|
109
|
+
status=None,
|
|
110
|
+
reason=None,
|
|
111
|
+
http_resp=None,
|
|
112
|
+
*,
|
|
113
|
+
body: Optional[str] = None,
|
|
114
|
+
data: Optional[Any] = None,
|
|
115
|
+
) -> None:
|
|
116
|
+
self.status = status
|
|
117
|
+
self.reason = reason
|
|
118
|
+
self.body = body
|
|
119
|
+
self.data = data
|
|
120
|
+
self.headers = None
|
|
121
|
+
|
|
105
122
|
if http_resp:
|
|
106
|
-
self.status
|
|
107
|
-
|
|
108
|
-
self.
|
|
123
|
+
if self.status is None:
|
|
124
|
+
self.status = http_resp.status
|
|
125
|
+
if self.reason is None:
|
|
126
|
+
self.reason = http_resp.reason
|
|
127
|
+
if self.body is None:
|
|
128
|
+
try:
|
|
129
|
+
self.body = http_resp.data.decode('utf-8')
|
|
130
|
+
except Exception:
|
|
131
|
+
pass
|
|
109
132
|
self.headers = http_resp.getheaders()
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_response(
|
|
136
|
+
cls,
|
|
137
|
+
*,
|
|
138
|
+
http_resp,
|
|
139
|
+
body: Optional[str],
|
|
140
|
+
data: Optional[Any],
|
|
141
|
+
) -> Self:
|
|
142
|
+
if http_resp.status == 400:
|
|
143
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
144
|
+
|
|
145
|
+
if http_resp.status == 401:
|
|
146
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
147
|
+
|
|
148
|
+
if http_resp.status == 403:
|
|
149
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
150
|
+
|
|
151
|
+
if http_resp.status == 404:
|
|
152
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
153
|
+
|
|
154
|
+
if 500 <= http_resp.status <= 599:
|
|
155
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
156
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
115
157
|
|
|
116
158
|
def __str__(self):
|
|
117
159
|
"""Custom error messages for exception"""
|
|
@@ -121,38 +163,30 @@ class ApiException(OpenApiException):
|
|
|
121
163
|
error_message += "HTTP response headers: {0}\n".format(
|
|
122
164
|
self.headers)
|
|
123
165
|
|
|
124
|
-
if self.body:
|
|
125
|
-
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
166
|
+
if self.data or self.body:
|
|
167
|
+
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
|
126
168
|
|
|
127
169
|
return error_message
|
|
128
170
|
|
|
171
|
+
|
|
129
172
|
class BadRequestException(ApiException):
|
|
173
|
+
pass
|
|
130
174
|
|
|
131
|
-
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
132
|
-
super(BadRequestException, self).__init__(status, reason, http_resp)
|
|
133
175
|
|
|
134
176
|
class NotFoundException(ApiException):
|
|
135
|
-
|
|
136
|
-
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
137
|
-
super(NotFoundException, self).__init__(status, reason, http_resp)
|
|
177
|
+
pass
|
|
138
178
|
|
|
139
179
|
|
|
140
180
|
class UnauthorizedException(ApiException):
|
|
141
|
-
|
|
142
|
-
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
143
|
-
super(UnauthorizedException, self).__init__(status, reason, http_resp)
|
|
181
|
+
pass
|
|
144
182
|
|
|
145
183
|
|
|
146
184
|
class ForbiddenException(ApiException):
|
|
147
|
-
|
|
148
|
-
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
149
|
-
super(ForbiddenException, self).__init__(status, reason, http_resp)
|
|
185
|
+
pass
|
|
150
186
|
|
|
151
187
|
|
|
152
188
|
class ServiceException(ApiException):
|
|
153
|
-
|
|
154
|
-
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
|
155
|
-
super(ServiceException, self).__init__(status, reason, http_resp)
|
|
189
|
+
pass
|
|
156
190
|
|
|
157
191
|
|
|
158
192
|
def render_path(path_to_item):
|
weheat/models/__init__.py
CHANGED
|
@@ -14,11 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
# import models into model package
|
|
17
|
+
from weheat.models.boiler_type import BoilerType
|
|
17
18
|
from weheat.models.device_state import DeviceState
|
|
19
|
+
from weheat.models.dhw_type import DhwType
|
|
18
20
|
from weheat.models.energy_view_dto import EnergyViewDto
|
|
19
21
|
from weheat.models.heat_pump_log_view_dto import HeatPumpLogViewDto
|
|
22
|
+
from weheat.models.heat_pump_model import HeatPumpModel
|
|
23
|
+
from weheat.models.heat_pump_status_enum import HeatPumpStatusEnum
|
|
24
|
+
from weheat.models.heat_pump_type import HeatPumpType
|
|
20
25
|
from weheat.models.raw_heat_pump_log_dto import RawHeatPumpLogDto
|
|
21
26
|
from weheat.models.read_all_heat_pump_dto import ReadAllHeatPumpDto
|
|
22
27
|
from weheat.models.read_heat_pump_dto import ReadHeatPumpDto
|
|
23
28
|
from weheat.models.read_user_dto import ReadUserDto
|
|
29
|
+
from weheat.models.read_user_me_dto import ReadUserMeDto
|
|
24
30
|
from weheat.models.role import Role
|
weheat/models/boiler_type.py
CHANGED
|
@@ -12,13 +12,18 @@
|
|
|
12
12
|
""" # noqa: E501
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
15
16
|
import json
|
|
16
17
|
import pprint
|
|
17
18
|
import re # noqa: F401
|
|
18
|
-
from
|
|
19
|
+
from enum import Enum
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
23
|
+
try:
|
|
24
|
+
from typing import Self
|
|
25
|
+
except ImportError:
|
|
26
|
+
from typing_extensions import Self
|
|
22
27
|
|
|
23
28
|
|
|
24
29
|
class BoilerType(int, Enum):
|
|
@@ -35,8 +40,8 @@ class BoilerType(int, Enum):
|
|
|
35
40
|
NUMBER_3 = 3
|
|
36
41
|
|
|
37
42
|
@classmethod
|
|
38
|
-
def from_json(cls, json_str: str) ->
|
|
43
|
+
def from_json(cls, json_str: str) -> Self:
|
|
39
44
|
"""Create an instance of BoilerType from a JSON string"""
|
|
40
|
-
return
|
|
45
|
+
return cls(json.loads(json_str))
|
|
41
46
|
|
|
42
47
|
|
weheat/models/device_state.py
CHANGED
|
@@ -12,18 +12,23 @@
|
|
|
12
12
|
""" # noqa: E501
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
15
16
|
import json
|
|
16
17
|
import pprint
|
|
17
18
|
import re # noqa: F401
|
|
18
|
-
from
|
|
19
|
+
from enum import Enum
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
23
|
+
try:
|
|
24
|
+
from typing import Self
|
|
25
|
+
except ImportError:
|
|
26
|
+
from typing_extensions import Self
|
|
22
27
|
|
|
23
28
|
|
|
24
29
|
class DeviceState(int, Enum):
|
|
25
30
|
"""
|
|
26
|
-
State of the device: -
|
|
31
|
+
State of the device: - ProductionObsoleteState (0), - InStock (1), - Sold (2), - Active (3), - Inactive (4), - Broken (5), - Test (6) - Configured (7) For now Production, InStock and Sold will only be applicable to Devices that can be actually installed in installation
|
|
27
32
|
"""
|
|
28
33
|
|
|
29
34
|
"""
|
|
@@ -39,8 +44,8 @@ class DeviceState(int, Enum):
|
|
|
39
44
|
NUMBER_7 = 7
|
|
40
45
|
|
|
41
46
|
@classmethod
|
|
42
|
-
def from_json(cls, json_str: str) ->
|
|
47
|
+
def from_json(cls, json_str: str) -> Self:
|
|
43
48
|
"""Create an instance of DeviceState from a JSON string"""
|
|
44
|
-
return
|
|
49
|
+
return cls(json.loads(json_str))
|
|
45
50
|
|
|
46
51
|
|
weheat/models/dhw_type.py
CHANGED
|
@@ -12,13 +12,18 @@
|
|
|
12
12
|
""" # noqa: E501
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
15
16
|
import json
|
|
16
17
|
import pprint
|
|
17
18
|
import re # noqa: F401
|
|
18
|
-
from
|
|
19
|
+
from enum import Enum
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
23
|
+
try:
|
|
24
|
+
from typing import Self
|
|
25
|
+
except ImportError:
|
|
26
|
+
from typing_extensions import Self
|
|
22
27
|
|
|
23
28
|
|
|
24
29
|
class DhwType(int, Enum):
|
|
@@ -34,8 +39,8 @@ class DhwType(int, Enum):
|
|
|
34
39
|
NUMBER_2 = 2
|
|
35
40
|
|
|
36
41
|
@classmethod
|
|
37
|
-
def from_json(cls, json_str: str) ->
|
|
42
|
+
def from_json(cls, json_str: str) -> Self:
|
|
38
43
|
"""Create an instance of DhwType from a JSON string"""
|
|
39
|
-
return
|
|
44
|
+
return cls(json.loads(json_str))
|
|
40
45
|
|
|
41
46
|
|
weheat/models/energy_view_dto.py
CHANGED
|
@@ -18,103 +18,118 @@ import re # noqa: F401
|
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
20
|
from datetime import datetime
|
|
21
|
-
from typing import Optional, Union
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr
|
|
23
|
+
from pydantic import Field
|
|
22
24
|
try:
|
|
23
|
-
from
|
|
25
|
+
from typing import Self
|
|
24
26
|
except ImportError:
|
|
25
|
-
from
|
|
27
|
+
from typing_extensions import Self
|
|
26
28
|
|
|
27
29
|
class EnergyViewDto(BaseModel):
|
|
28
30
|
"""
|
|
29
31
|
EnergyViewDto
|
|
30
|
-
"""
|
|
31
|
-
interval: Optional[StrictStr] = Field(None, description="Interval of this EnergyViewDto (Correct intervals include: \"Hour\", \"Day\", \"Week\", \"Month\", \"Year\")")
|
|
32
|
-
time_bucket: Optional[datetime] = Field(None, alias="timeBucket")
|
|
33
|
-
total_ein_heating: Union[StrictFloat, StrictInt] = Field(
|
|
34
|
-
total_ein_dhw: Union[StrictFloat, StrictInt] = Field(
|
|
35
|
-
total_ein_heating_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
36
|
-
total_ein_dhw_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
37
|
-
total_ein_cooling: Union[StrictFloat, StrictInt] = Field(
|
|
38
|
-
total_e_out_heating: Union[StrictFloat, StrictInt] = Field(
|
|
39
|
-
total_e_out_dhw: Union[StrictFloat, StrictInt] = Field(
|
|
40
|
-
total_e_out_heating_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
41
|
-
total_e_out_dhw_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
42
|
-
total_e_out_cooling: Union[StrictFloat, StrictInt] = Field(
|
|
43
|
-
average_power_ein_heating: Union[StrictFloat, StrictInt] = Field(
|
|
44
|
-
average_power_ein_dhw: Union[StrictFloat, StrictInt] = Field(
|
|
45
|
-
average_power_ein_heating_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
46
|
-
average_power_ein_dhw_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
47
|
-
average_power_ein_cooling: Union[StrictFloat, StrictInt] = Field(
|
|
48
|
-
average_power_e_out_heating: Union[StrictFloat, StrictInt] = Field(
|
|
49
|
-
average_power_e_out_dhw: Union[StrictFloat, StrictInt] = Field(
|
|
50
|
-
average_power_e_out_heating_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
51
|
-
average_power_e_out_dhw_defrost: Union[StrictFloat, StrictInt] = Field(
|
|
52
|
-
average_power_e_out_cooling: Union[StrictFloat, StrictInt] = Field(
|
|
53
|
-
__properties = ["interval", "timeBucket", "totalEInHeating", "totalEInDhw", "totalEInHeatingDefrost", "totalEInDhwDefrost", "totalEInCooling", "totalEOutHeating", "totalEOutDhw", "totalEOutHeatingDefrost", "totalEOutDhwDefrost", "totalEOutCooling", "averagePowerEInHeating", "averagePowerEInDhw", "averagePowerEInHeatingDefrost", "averagePowerEInDhwDefrost", "averagePowerEInCooling", "averagePowerEOutHeating", "averagePowerEOutDhw", "averagePowerEOutHeatingDefrost", "averagePowerEOutDhwDefrost", "averagePowerEOutCooling"]
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
""
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
interval: Optional[StrictStr] = Field(default=None, description="Interval of this EnergyViewDto (Correct intervals include: \"Hour\", \"Day\", \"Week\", \"Month\", \"Year\")")
|
|
34
|
+
time_bucket: Optional[datetime] = Field(default=None, alias="timeBucket")
|
|
35
|
+
total_ein_heating: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going into the heat pump for heating for this interval (in kwh)", alias="totalEInHeating")
|
|
36
|
+
total_ein_dhw: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going into the heat pump for doing DHW for this interval (in kwh)", alias="totalEInDhw")
|
|
37
|
+
total_ein_heating_defrost: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going into the heat pump for defrosting whilst heating for this interval (in kwh)", alias="totalEInHeatingDefrost")
|
|
38
|
+
total_ein_dhw_defrost: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going into the heat pump for defrosting whilst doing DHW for this interval (in kwh)", alias="totalEInDhwDefrost")
|
|
39
|
+
total_ein_cooling: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going into the heat pump for cooling for this interval (in kwh)", alias="totalEInCooling")
|
|
40
|
+
total_e_out_heating: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going out of the heat pump for heating for this interval (in kwh)", alias="totalEOutHeating")
|
|
41
|
+
total_e_out_dhw: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going out of the heat pump for doing DHW for this interval (in kwh)", alias="totalEOutDhw")
|
|
42
|
+
total_e_out_heating_defrost: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going out of the heat pump for defrosting whilst heating for this interval (in kwh)", alias="totalEOutHeatingDefrost")
|
|
43
|
+
total_e_out_dhw_defrost: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going out of the heat pump for defrosting whilst doing DHW for this interval (in kwh)", alias="totalEOutDhwDefrost")
|
|
44
|
+
total_e_out_cooling: Union[StrictFloat, StrictInt] = Field(description="Total energy from electricity going out of the heat pump for cooling for this interval (in kwh)", alias="totalEOutCooling")
|
|
45
|
+
average_power_ein_heating: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going into the heat pump for heating for this interval (in kW)", alias="averagePowerEInHeating")
|
|
46
|
+
average_power_ein_dhw: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going into the heat pump for doing DHW for this interval (in kW)", alias="averagePowerEInDhw")
|
|
47
|
+
average_power_ein_heating_defrost: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going into the heat pump for defrosting whilst heating for this interval (in kW)", alias="averagePowerEInHeatingDefrost")
|
|
48
|
+
average_power_ein_dhw_defrost: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going into the heat pump for defrosting whilst doing DHW for this interval (in kW)", alias="averagePowerEInDhwDefrost")
|
|
49
|
+
average_power_ein_cooling: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going into the heat pump for cooling for this interval (in kW)", alias="averagePowerEInCooling")
|
|
50
|
+
average_power_e_out_heating: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going out of the heat pump for heating for this interval (in kW)", alias="averagePowerEOutHeating")
|
|
51
|
+
average_power_e_out_dhw: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going out of the heat pump for doing DHW for this interval (in kW)", alias="averagePowerEOutDhw")
|
|
52
|
+
average_power_e_out_heating_defrost: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going out of the heat pump for defrosting whilst heating for this interval (in kW)", alias="averagePowerEOutHeatingDefrost")
|
|
53
|
+
average_power_e_out_dhw_defrost: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going out of the heat pump for defrosting whilst doing DHW for this interval (in kW)", alias="averagePowerEOutDhwDefrost")
|
|
54
|
+
average_power_e_out_cooling: Union[StrictFloat, StrictInt] = Field(description="Average power from electricity going out of the heat pump for cooling for this interval (in kW)", alias="averagePowerEOutCooling")
|
|
55
|
+
__properties: ClassVar[List[str]] = ["interval", "timeBucket", "totalEInHeating", "totalEInDhw", "totalEInHeatingDefrost", "totalEInDhwDefrost", "totalEInCooling", "totalEOutHeating", "totalEOutDhw", "totalEOutHeatingDefrost", "totalEOutDhwDefrost", "totalEOutCooling", "averagePowerEInHeating", "averagePowerEInDhw", "averagePowerEInHeatingDefrost", "averagePowerEInDhwDefrost", "averagePowerEInCooling", "averagePowerEOutHeating", "averagePowerEOutDhw", "averagePowerEOutHeatingDefrost", "averagePowerEOutDhwDefrost", "averagePowerEOutCooling"]
|
|
56
|
+
|
|
57
|
+
model_config = {
|
|
58
|
+
"populate_by_name": True,
|
|
59
|
+
"validate_assignment": True,
|
|
60
|
+
"protected_namespaces": (),
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
|
|
60
64
|
def to_str(self) -> str:
|
|
61
65
|
"""Returns the string representation of the model using alias"""
|
|
62
|
-
return pprint.pformat(self.
|
|
66
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
63
67
|
|
|
64
68
|
def to_json(self) -> str:
|
|
65
69
|
"""Returns the JSON representation of the model using alias"""
|
|
70
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
66
71
|
return json.dumps(self.to_dict())
|
|
67
72
|
|
|
68
73
|
@classmethod
|
|
69
|
-
def from_json(cls, json_str: str) ->
|
|
74
|
+
def from_json(cls, json_str: str) -> Self:
|
|
70
75
|
"""Create an instance of EnergyViewDto from a JSON string"""
|
|
71
76
|
return cls.from_dict(json.loads(json_str))
|
|
72
77
|
|
|
73
|
-
def to_dict(self):
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
79
|
+
"""Return the dictionary representation of the model using alias.
|
|
80
|
+
|
|
81
|
+
This has the following differences from calling pydantic's
|
|
82
|
+
`self.model_dump(by_alias=True)`:
|
|
83
|
+
|
|
84
|
+
* `None` is only added to the output dict for nullable fields that
|
|
85
|
+
were set at model initialization. Other fields with value `None`
|
|
86
|
+
are ignored.
|
|
87
|
+
"""
|
|
88
|
+
_dict = self.model_dump(
|
|
89
|
+
by_alias=True,
|
|
90
|
+
exclude={
|
|
91
|
+
},
|
|
92
|
+
exclude_none=True,
|
|
93
|
+
)
|
|
79
94
|
# set to None if interval (nullable) is None
|
|
80
|
-
# and
|
|
81
|
-
if self.interval is None and "interval" in self.
|
|
95
|
+
# and model_fields_set contains the field
|
|
96
|
+
if self.interval is None and "interval" in self.model_fields_set:
|
|
82
97
|
_dict['interval'] = None
|
|
83
98
|
|
|
84
99
|
return _dict
|
|
85
100
|
|
|
86
101
|
@classmethod
|
|
87
|
-
def from_dict(cls, obj:
|
|
102
|
+
def from_dict(cls, obj: Dict) -> Self:
|
|
88
103
|
"""Create an instance of EnergyViewDto from a dict"""
|
|
89
104
|
if obj is None:
|
|
90
105
|
return None
|
|
91
106
|
|
|
92
107
|
if not isinstance(obj, dict):
|
|
93
|
-
return
|
|
108
|
+
return cls.model_validate(obj)
|
|
94
109
|
|
|
95
|
-
_obj =
|
|
110
|
+
_obj = cls.model_validate({
|
|
96
111
|
"interval": obj.get("interval"),
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
112
|
+
"timeBucket": obj.get("timeBucket"),
|
|
113
|
+
"totalEInHeating": obj.get("totalEInHeating"),
|
|
114
|
+
"totalEInDhw": obj.get("totalEInDhw"),
|
|
115
|
+
"totalEInHeatingDefrost": obj.get("totalEInHeatingDefrost"),
|
|
116
|
+
"totalEInDhwDefrost": obj.get("totalEInDhwDefrost"),
|
|
117
|
+
"totalEInCooling": obj.get("totalEInCooling"),
|
|
118
|
+
"totalEOutHeating": obj.get("totalEOutHeating"),
|
|
119
|
+
"totalEOutDhw": obj.get("totalEOutDhw"),
|
|
120
|
+
"totalEOutHeatingDefrost": obj.get("totalEOutHeatingDefrost"),
|
|
121
|
+
"totalEOutDhwDefrost": obj.get("totalEOutDhwDefrost"),
|
|
122
|
+
"totalEOutCooling": obj.get("totalEOutCooling"),
|
|
123
|
+
"averagePowerEInHeating": obj.get("averagePowerEInHeating"),
|
|
124
|
+
"averagePowerEInDhw": obj.get("averagePowerEInDhw"),
|
|
125
|
+
"averagePowerEInHeatingDefrost": obj.get("averagePowerEInHeatingDefrost"),
|
|
126
|
+
"averagePowerEInDhwDefrost": obj.get("averagePowerEInDhwDefrost"),
|
|
127
|
+
"averagePowerEInCooling": obj.get("averagePowerEInCooling"),
|
|
128
|
+
"averagePowerEOutHeating": obj.get("averagePowerEOutHeating"),
|
|
129
|
+
"averagePowerEOutDhw": obj.get("averagePowerEOutDhw"),
|
|
130
|
+
"averagePowerEOutHeatingDefrost": obj.get("averagePowerEOutHeatingDefrost"),
|
|
131
|
+
"averagePowerEOutDhwDefrost": obj.get("averagePowerEOutDhwDefrost"),
|
|
132
|
+
"averagePowerEOutCooling": obj.get("averagePowerEOutCooling")
|
|
118
133
|
})
|
|
119
134
|
return _obj
|
|
120
135
|
|