weheat 2025.1.14rc1__tar.gz → 2025.1.15rc2__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 (60) hide show
  1. weheat-2025.1.15rc2/PKG-INFO +115 -0
  2. weheat-2025.1.15rc2/README.md +88 -0
  3. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/pyproject.toml +5 -3
  4. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/setup.cfg +0 -3
  5. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/setup.py +6 -5
  6. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/__init__.py +7 -2
  7. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/abstractions/discovery.py +6 -6
  8. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/abstractions/heat_pump.py +11 -15
  9. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/abstractions/user.py +7 -7
  10. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/api/__init__.py +1 -0
  11. weheat-2025.1.15rc2/weheat/api/energy_log_api.py +404 -0
  12. weheat-2025.1.15rc2/weheat/api/heat_pump_api.py +684 -0
  13. weheat-2025.1.15rc2/weheat/api/heat_pump_log_api.py +1031 -0
  14. weheat-2025.1.15rc2/weheat/api/user_api.py +321 -0
  15. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/api_client.py +234 -261
  16. weheat-2025.1.15rc2/weheat/api_response.py +21 -0
  17. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/configuration.py +14 -9
  18. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/exceptions.py +59 -25
  19. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/__init__.py +6 -0
  20. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/boiler_type.py +8 -3
  21. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/device_state.py +9 -4
  22. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/dhw_type.py +8 -3
  23. weheat-2025.1.15rc2/weheat/models/energy_view_dto.py +136 -0
  24. weheat-2025.1.15rc2/weheat/models/heat_pump_log_view_dto.py +817 -0
  25. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/heat_pump_model.py +8 -3
  26. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/heat_pump_status_enum.py +8 -3
  27. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/heat_pump_type.py +8 -3
  28. weheat-2025.1.15rc2/weheat/models/raw_heat_pump_log_dto.py +555 -0
  29. weheat-2025.1.15rc2/weheat/models/read_all_heat_pump_dto.py +140 -0
  30. weheat-2025.1.15rc2/weheat/models/read_heat_pump_dto.py +133 -0
  31. weheat-2025.1.15rc2/weheat/models/read_user_dto.py +117 -0
  32. weheat-2025.1.15rc2/weheat/models/read_user_me_dto.py +124 -0
  33. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/models/role.py +10 -4
  34. weheat-2025.1.15rc2/weheat/rest.py +220 -0
  35. weheat-2025.1.15rc2/weheat.egg-info/PKG-INFO +115 -0
  36. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat.egg-info/SOURCES.txt +1 -0
  37. weheat-2025.1.15rc2/weheat.egg-info/requires.txt +6 -0
  38. weheat-2025.1.14rc1/PKG-INFO +0 -117
  39. weheat-2025.1.14rc1/README.md +0 -91
  40. weheat-2025.1.14rc1/weheat/api/energy_log_api.py +0 -230
  41. weheat-2025.1.14rc1/weheat/api/heat_pump_api.py +0 -532
  42. weheat-2025.1.14rc1/weheat/api/heat_pump_log_api.py +0 -554
  43. weheat-2025.1.14rc1/weheat/api/user_api.py +0 -193
  44. weheat-2025.1.14rc1/weheat/api_response.py +0 -29
  45. weheat-2025.1.14rc1/weheat/models/energy_view_dto.py +0 -121
  46. weheat-2025.1.14rc1/weheat/models/heat_pump_log_view_dto.py +0 -771
  47. weheat-2025.1.14rc1/weheat/models/raw_heat_pump_log_dto.py +0 -517
  48. weheat-2025.1.14rc1/weheat/models/read_all_heat_pump_dto.py +0 -124
  49. weheat-2025.1.14rc1/weheat/models/read_heat_pump_dto.py +0 -117
  50. weheat-2025.1.14rc1/weheat/models/read_user_dto.py +0 -102
  51. weheat-2025.1.14rc1/weheat/rest.py +0 -327
  52. weheat-2025.1.14rc1/weheat.egg-info/PKG-INFO +0 -117
  53. weheat-2025.1.14rc1/weheat.egg-info/requires.txt +0 -5
  54. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/LICENSE +0 -0
  55. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/tests/test_ha_api.py +0 -0
  56. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/abstractions/__init__.py +0 -0
  57. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/abstractions/auth.py +0 -0
  58. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat/py.typed +0 -0
  59. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat.egg-info/dependency_links.txt +0 -0
  60. {weheat-2025.1.14rc1 → weheat-2025.1.15rc2}/weheat.egg-info/top_level.txt +0 -0
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.2
2
+ Name: weheat
3
+ Version: 2025.1.15rc2
4
+ Summary: Weheat Backend client
5
+ Home-page: https://github.com/wefabricate/wh-python
6
+ Author: Jesper Raemaekers
7
+ Author-email: jesper.raemaekers@wefabricate.com
8
+ License: MIT
9
+ Keywords: OpenAPI,OpenAPI-Generator,Weheat Backend
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: urllib3<2.1.0,>=1.25.3
13
+ Requires-Dist: python-dateutil
14
+ Requires-Dist: aiohttp>=3.0.0
15
+ Requires-Dist: aiohttp-retry>=2.8.3
16
+ Requires-Dist: pydantic>=2
17
+ Requires-Dist: typing-extensions>=4.7.1
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: keywords
24
+ Dynamic: license
25
+ Dynamic: requires-dist
26
+ Dynamic: summary
27
+
28
+ # Weheat backend client
29
+
30
+ This is a client for the Weheat backend. It is automatically generated from the OpenAPI specification.
31
+
32
+ ## Requirements.
33
+
34
+ Python 3.7+
35
+
36
+ ## Installation & Usage
37
+
38
+ You can install directly using:
39
+
40
+ ```sh
41
+ pip install weheat
42
+ ```
43
+
44
+ Then import the package:
45
+
46
+ ```python
47
+ import weheat
48
+ ```
49
+
50
+
51
+
52
+ ## Getting Started
53
+
54
+ After installation, you can now use the client to interact with the Weheat backend. Note that all methods are async as of version 2025.1.15.
55
+
56
+ ```python
57
+ import asyncio
58
+ import datetime
59
+ from keycloak import KeycloakOpenID # install with pip install python-keycloak
60
+ from weheat import ApiClient, Configuration, HeatPumpApi, HeatPumpLogApi, EnergyLogApi, UserApi
61
+
62
+ auth_url = 'https://auth.weheat.nl/auth/'
63
+ api_url = 'https://api.weheat.nl'
64
+ realm_name = 'Weheat'
65
+ my_client_id = 'WeheatCommunityAPI' # client ID and secret provided by Weheat
66
+ my_client_secret = ''
67
+ username = '' # username and password used for the online portal
68
+ password = ''
69
+ my_heat_pump_id = '' # your heat pump UUID
70
+
71
+
72
+ async def demo():
73
+ keycloak_open_id = KeycloakOpenID(server_url=auth_url,
74
+ client_id=my_client_id,
75
+ realm_name=realm_name,
76
+ client_secret_key=my_client_secret)
77
+
78
+ token_response = keycloak_open_id.token(username, password)
79
+ keycloak_open_id.logout(token_response['refresh_token'])
80
+
81
+ config = Configuration(host=api_url, access_token=token_response['access_token'])
82
+ async with ApiClient(configuration=config) as client:
83
+ response = await UserApi(client).api_v1_users_me_get_with_http_info()
84
+
85
+ if response.status_code == 200:
86
+ print(f'My user: {response.data}')
87
+
88
+ response = await HeatPumpApi(client).api_v1_heat_pumps_get_with_http_info()
89
+
90
+ if response.status_code == 200:
91
+ print(f'My heat pump: {response.data}')
92
+
93
+ response = await HeatPumpLogApi(client).api_v1_heat_pumps_heat_pump_id_logs_latest_get_with_http_info(
94
+ heat_pump_id=my_heat_pump_id)
95
+
96
+ if response.status_code == 200:
97
+ print(f'My heat pump logs: {response.data}')
98
+
99
+ response = await EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=my_heat_pump_id,
100
+ start_time=datetime.datetime(2024, 6,
101
+ 22, 0, 0,
102
+ 0),
103
+ end_time=datetime.datetime(2024, 6, 22,
104
+ 15, 0, 0),
105
+ interval='Hour')
106
+
107
+ if response.status_code == 200:
108
+ print(f'My energy logs: {response.data}')
109
+
110
+ asyncio.get_event_loop().run_until_complete(demo())
111
+
112
+ ```
113
+
114
+
115
+
@@ -0,0 +1,88 @@
1
+ # Weheat backend client
2
+
3
+ This is a client for the Weheat backend. It is automatically generated from the OpenAPI specification.
4
+
5
+ ## Requirements.
6
+
7
+ Python 3.7+
8
+
9
+ ## Installation & Usage
10
+
11
+ You can install directly using:
12
+
13
+ ```sh
14
+ pip install weheat
15
+ ```
16
+
17
+ Then import the package:
18
+
19
+ ```python
20
+ import weheat
21
+ ```
22
+
23
+
24
+
25
+ ## Getting Started
26
+
27
+ After installation, you can now use the client to interact with the Weheat backend. Note that all methods are async as of version 2025.1.15.
28
+
29
+ ```python
30
+ import asyncio
31
+ import datetime
32
+ from keycloak import KeycloakOpenID # install with pip install python-keycloak
33
+ from weheat import ApiClient, Configuration, HeatPumpApi, HeatPumpLogApi, EnergyLogApi, UserApi
34
+
35
+ auth_url = 'https://auth.weheat.nl/auth/'
36
+ api_url = 'https://api.weheat.nl'
37
+ realm_name = 'Weheat'
38
+ my_client_id = 'WeheatCommunityAPI' # client ID and secret provided by Weheat
39
+ my_client_secret = ''
40
+ username = '' # username and password used for the online portal
41
+ password = ''
42
+ my_heat_pump_id = '' # your heat pump UUID
43
+
44
+
45
+ async def demo():
46
+ keycloak_open_id = KeycloakOpenID(server_url=auth_url,
47
+ client_id=my_client_id,
48
+ realm_name=realm_name,
49
+ client_secret_key=my_client_secret)
50
+
51
+ token_response = keycloak_open_id.token(username, password)
52
+ keycloak_open_id.logout(token_response['refresh_token'])
53
+
54
+ config = Configuration(host=api_url, access_token=token_response['access_token'])
55
+ async with ApiClient(configuration=config) as client:
56
+ response = await UserApi(client).api_v1_users_me_get_with_http_info()
57
+
58
+ if response.status_code == 200:
59
+ print(f'My user: {response.data}')
60
+
61
+ response = await HeatPumpApi(client).api_v1_heat_pumps_get_with_http_info()
62
+
63
+ if response.status_code == 200:
64
+ print(f'My heat pump: {response.data}')
65
+
66
+ response = await HeatPumpLogApi(client).api_v1_heat_pumps_heat_pump_id_logs_latest_get_with_http_info(
67
+ heat_pump_id=my_heat_pump_id)
68
+
69
+ if response.status_code == 200:
70
+ print(f'My heat pump logs: {response.data}')
71
+
72
+ response = await EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=my_heat_pump_id,
73
+ start_time=datetime.datetime(2024, 6,
74
+ 22, 0, 0,
75
+ 0),
76
+ end_time=datetime.datetime(2024, 6, 22,
77
+ 15, 0, 0),
78
+ interval='Hour')
79
+
80
+ if response.status_code == 200:
81
+ print(f'My energy logs: {response.data}')
82
+
83
+ asyncio.get_event_loop().run_until_complete(demo())
84
+
85
+ ```
86
+
87
+
88
+
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "weheat"
3
- version = "2025.1.14rc1"
3
+ version = "2025.1.15rc2"
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"
@@ -14,8 +14,10 @@ python = "^3.7"
14
14
 
15
15
  urllib3 = ">= 1.25.3"
16
16
  python-dateutil = ">=2.8.2"
17
- pydantic = ">=1.10.5, < 3"
18
- aenum = ">=3.1.11"
17
+ aiohttp = ">= 3.8.4"
18
+ aiohttp-retry = ">= 2.8.3"
19
+ pydantic = ">=2"
20
+ typing-extensions = ">=4.7.1"
19
21
 
20
22
  [tool.poetry.dev-dependencies]
21
23
  pytest = ">=7.2.1"
@@ -1,9 +1,6 @@
1
1
  [flake8]
2
2
  max-line-length = 99
3
3
 
4
- [metadata]
5
- license_files = LICENSE
6
-
7
4
  [egg_info]
8
5
  tag_build =
9
6
  tag_date = 0
@@ -21,14 +21,15 @@ 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 = "2025.1.14rc1"
24
+ VERSION = "2025.1.15rc2"
25
25
  PYTHON_REQUIRES = ">=3.7"
26
26
  REQUIRES = [
27
27
  "urllib3 >= 1.25.3, < 2.1.0",
28
28
  "python-dateutil",
29
- "pydantic >= 1.10.5, < 3",
30
- "aenum",
31
- "aiohttp"
29
+ "aiohttp >= 3.0.0",
30
+ "aiohttp-retry >= 2.8.3",
31
+ "pydantic >= 2",
32
+ "typing-extensions >= 4.7.1",
32
33
  ]
33
34
 
34
35
  setup(
@@ -46,5 +47,5 @@ setup(
46
47
  long_description=pathlib.Path("README.md").read_text(), # noqa: E501
47
48
  package_data={"weheat": ["py.typed"]},
48
49
  license="MIT",
49
- license_files = ('LICENSE',),
50
+ license_files=('LICENSE',),
50
51
  )
@@ -14,7 +14,7 @@
14
14
  """ # noqa: E501
15
15
 
16
16
 
17
- __version__ = "2024.07.08"
17
+ __version__ = "2024.11.15"
18
18
 
19
19
  # import apis into sdk package
20
20
  from weheat.api.energy_log_api import EnergyLogApi
@@ -34,12 +34,17 @@ from weheat.exceptions import ApiAttributeError
34
34
  from weheat.exceptions import ApiException
35
35
 
36
36
  # import models into sdk package
37
+ from weheat.models.boiler_type import BoilerType
37
38
  from weheat.models.device_state import DeviceState
39
+ from weheat.models.dhw_type import DhwType
38
40
  from weheat.models.energy_view_dto import EnergyViewDto
39
41
  from weheat.models.heat_pump_log_view_dto import HeatPumpLogViewDto
42
+ from weheat.models.heat_pump_model import HeatPumpModel
43
+ from weheat.models.heat_pump_status_enum import HeatPumpStatusEnum
44
+ from weheat.models.heat_pump_type import HeatPumpType
40
45
  from weheat.models.raw_heat_pump_log_dto import RawHeatPumpLogDto
41
46
  from weheat.models.read_all_heat_pump_dto import ReadAllHeatPumpDto
42
47
  from weheat.models.read_heat_pump_dto import ReadHeatPumpDto
43
48
  from weheat.models.read_user_dto import ReadUserDto
49
+ from weheat.models.read_user_me_dto import ReadUserMeDto
44
50
  from weheat.models.role import Role
45
-
@@ -1,6 +1,8 @@
1
1
  import asyncio
2
2
  from dataclasses import dataclass
3
3
 
4
+ import aiohttp
5
+
4
6
  from weheat import DeviceState
5
7
  from weheat.configuration import Configuration
6
8
  from weheat.api_client import ApiClient
@@ -17,16 +19,14 @@ class HeatPumpDiscovery:
17
19
  has_dhw: bool = False
18
20
 
19
21
  @staticmethod
20
- async def async_discover_active(api_url: str, access_token: str) -> list[HeatPumpInfo]:
22
+ async def async_discover_active(api_url: str, access_token: str, client_session:aiohttp.ClientSession|None = None) -> list[HeatPumpInfo]:
21
23
  discovered_pumps = []
22
24
 
23
- config = Configuration(host=api_url, access_token=access_token)
24
-
25
- with ApiClient(configuration=config) as client:
25
+ config = Configuration(host=api_url, access_token=access_token, client_session=client_session)
26
26
 
27
- response = HeatPumpApi(client).api_v1_heat_pumps_get_with_http_info('', 1, 1000, DeviceState.NUMBER_3 ,async_req=True)
27
+ async with ApiClient(configuration=config) as client:
28
28
 
29
- response = await asyncio.to_thread(response.get)
29
+ response = await HeatPumpApi(client).api_v1_heat_pumps_get_with_http_info('', 1, 1000, DeviceState.NUMBER_3)
30
30
 
31
31
  if response.status_code == 200:
32
32
  for pump in response.data:
@@ -2,6 +2,8 @@
2
2
  import asyncio
3
3
  from enum import Enum, auto
4
4
 
5
+ import aiohttp
6
+
5
7
  from weheat import HeatPumpApi
6
8
  from weheat.configuration import Configuration
7
9
  from weheat.api_client import ApiClient
@@ -26,49 +28,43 @@ class HeatPump:
26
28
  SELF_TEST = auto()
27
29
  MANUAL_CONTROL = auto()
28
30
 
29
- def __init__(self, api_url: str, uuid: str) -> None:
31
+ def __init__(self, api_url: str, uuid: str, client_session:aiohttp.ClientSession|None = None) -> None:
30
32
  self._api_url = api_url
31
33
  self._uuid = uuid
32
34
  self._last_log = None
33
35
  self._energy_consumption = None
34
36
  self._energy_output = None
35
37
  self._nominal_max_power = None
38
+ self._client = client_session
36
39
 
37
40
  async def async_get_status(self, access_token: str):
38
41
  """Updates the heat pump instance with data from the API."""
39
42
  try:
40
- config = Configuration(host=self._api_url, access_token=access_token)
43
+ config = Configuration(host=self._api_url, access_token=access_token, client_session=self._client)
41
44
 
42
- with ApiClient(configuration=config) as client:
45
+ async with ApiClient(configuration=config) as client:
43
46
  # Set the max power once
44
47
  if self._nominal_max_power is None:
45
- response = HeatPumpApi(client).api_v1_heat_pumps_heat_pump_id_get_with_http_info(heat_pump_id=self._uuid, async_req=True)
46
-
47
- response = await asyncio.to_thread(response.get)
48
+ response = await HeatPumpApi(client).api_v1_heat_pumps_heat_pump_id_get_with_http_info(heat_pump_id=self._uuid)
48
49
 
49
50
  if response.status_code == 200:
50
51
  self._set_nominal_max_power_for_model(response.data.model)
51
52
 
52
53
 
53
- response = HeatPumpLogApi(
54
+ response = await HeatPumpLogApi(
54
55
  client
55
56
  ).api_v1_heat_pumps_heat_pump_id_logs_latest_get_with_http_info(
56
- heat_pump_id=self._uuid, async_req=True
57
- )
58
-
59
- response = await asyncio.to_thread(response.get)
57
+ heat_pump_id=self._uuid )
60
58
 
61
59
  if response.status_code == 200:
62
60
  self._last_log = response.data
63
61
 
64
62
  # Also get all energy totals form past years and add them together
65
63
  # As end time pick today + 1 day to avoid issues with timezones
66
- response = EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=self._uuid,
64
+ response = await EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=self._uuid,
67
65
  start_time=START_DATE,
68
66
  end_time=datetime.now() + timedelta(days=1),
69
- interval='Month', async_req=True)
70
-
71
- response = await asyncio.to_thread(response.get)
67
+ interval='Month')
72
68
 
73
69
  if response.status_code == 200:
74
70
  # aggregate the energy consumption
@@ -1,21 +1,21 @@
1
1
  import asyncio
2
2
 
3
+ import aiohttp
4
+
3
5
  from weheat.configuration import Configuration
4
6
  from weheat.api_client import ApiClient
5
7
  from weheat.api.user_api import UserApi
6
8
 
7
9
 
8
- async def async_get_user_id_from_token(api_url: str, access_token: str):
10
+ async def async_get_user_id_from_token(api_url: str, access_token: str, client_session:aiohttp.ClientSession|None = None):
9
11
  """ Get the user id from the current logged-in user. """
10
12
  try:
11
- config = Configuration(host=api_url, access_token=access_token)
13
+ config = Configuration(host=api_url, access_token=access_token, client_session=client_session)
12
14
 
13
- with ApiClient(configuration=config) as client:
14
- response = UserApi(
15
+ async with ApiClient(configuration=config) as client:
16
+ response = await UserApi(
15
17
  client
16
- ).api_v1_users_me_get_with_http_info(async_req=True)
17
-
18
- response = await asyncio.to_thread(response.get)
18
+ ).api_v1_users_me_get_with_http_info()
19
19
 
20
20
  if response.status_code == 200:
21
21
  return response.data.id
@@ -5,3 +5,4 @@ from weheat.api.energy_log_api import EnergyLogApi
5
5
  from weheat.api.heat_pump_api import HeatPumpApi
6
6
  from weheat.api.heat_pump_log_api import HeatPumpLogApi
7
7
  from weheat.api.user_api import UserApi
8
+