weheat 2025.1.15rc1__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 (44) hide show
  1. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/PKG-INFO +1 -1
  2. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/pyproject.toml +1 -1
  3. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/setup.py +1 -1
  4. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/abstractions/discovery.py +4 -2
  5. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/abstractions/heat_pump.py +5 -2
  6. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/abstractions/user.py +4 -2
  7. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/configuration.py +10 -1
  8. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/rest.py +27 -19
  9. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat.egg-info/PKG-INFO +1 -1
  10. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/LICENSE +0 -0
  11. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/README.md +0 -0
  12. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/setup.cfg +0 -0
  13. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/tests/test_ha_api.py +0 -0
  14. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/__init__.py +0 -0
  15. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/abstractions/__init__.py +0 -0
  16. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/abstractions/auth.py +0 -0
  17. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/api/__init__.py +0 -0
  18. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/api/energy_log_api.py +0 -0
  19. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/api/heat_pump_api.py +0 -0
  20. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/api/heat_pump_log_api.py +0 -0
  21. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/api/user_api.py +0 -0
  22. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/api_client.py +0 -0
  23. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/api_response.py +0 -0
  24. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/exceptions.py +0 -0
  25. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/__init__.py +0 -0
  26. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/boiler_type.py +0 -0
  27. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/device_state.py +0 -0
  28. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/dhw_type.py +0 -0
  29. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/energy_view_dto.py +0 -0
  30. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/heat_pump_log_view_dto.py +0 -0
  31. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/heat_pump_model.py +0 -0
  32. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/heat_pump_status_enum.py +0 -0
  33. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/heat_pump_type.py +0 -0
  34. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/raw_heat_pump_log_dto.py +0 -0
  35. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/read_all_heat_pump_dto.py +0 -0
  36. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/read_heat_pump_dto.py +0 -0
  37. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/read_user_dto.py +0 -0
  38. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/read_user_me_dto.py +0 -0
  39. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/models/role.py +0 -0
  40. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat/py.typed +0 -0
  41. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat.egg-info/SOURCES.txt +0 -0
  42. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat.egg-info/dependency_links.txt +0 -0
  43. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat.egg-info/requires.txt +0 -0
  44. {weheat-2025.1.15rc1 → weheat-2025.1.15rc2}/weheat.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: weheat
3
- Version: 2025.1.15rc1
3
+ Version: 2025.1.15rc2
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 = "2025.1.15rc1"
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"
@@ -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 = "2025.1.15rc1"
24
+ VERSION = "2025.1.15rc2"
25
25
  PYTHON_REQUIRES = ">=3.7"
26
26
  REQUIRES = [
27
27
  "urllib3 >= 1.25.3, < 2.1.0",
@@ -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,10 +19,10 @@ 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)
25
+ config = Configuration(host=api_url, access_token=access_token, client_session=client_session)
24
26
 
25
27
  async with ApiClient(configuration=config) as client:
26
28
 
@@ -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,18 +28,19 @@ 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
45
  async with ApiClient(configuration=config) as client:
43
46
  # Set the max power once
@@ -1,14 +1,16 @@
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
15
  async with ApiClient(configuration=config) as client:
14
16
  response = await UserApi(
@@ -15,6 +15,8 @@
15
15
  import copy
16
16
  import logging
17
17
  import sys
18
+
19
+ import aiohttp
18
20
  import urllib3
19
21
 
20
22
  import http.client as httplib
@@ -51,6 +53,7 @@ class Configuration:
51
53
  values before.
52
54
  :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
53
55
  in PEM format.
56
+ : param client_session: A aiohttp.ClientSession to use
54
57
 
55
58
  :Example:
56
59
  """
@@ -63,7 +66,7 @@ class Configuration:
63
66
  access_token=None,
64
67
  server_index=None, server_variables=None,
65
68
  server_operation_index=None, server_operation_variables=None,
66
- ssl_ca_cert=None,
69
+ ssl_ca_cert=None, client_session=None
67
70
  ) -> None:
68
71
  """Constructor
69
72
  """
@@ -179,6 +182,8 @@ class Configuration:
179
182
  """date format
180
183
  """
181
184
 
185
+ self._client_session = client_session
186
+
182
187
  def __deepcopy__(self, memo):
183
188
  cls = self.__class__
184
189
  result = cls.__new__(cls)
@@ -196,6 +201,10 @@ class Configuration:
196
201
  def __setattr__(self, name, value):
197
202
  object.__setattr__(self, name, value)
198
203
 
204
+ @property
205
+ def client_session(self) -> aiohttp.ClientSession|None:
206
+ return self._client_session
207
+
199
208
  @classmethod
200
209
  def set_default(cls, default):
201
210
  """Set default instance of configuration.
@@ -55,32 +55,37 @@ class RESTClientObject:
55
55
  # maxsize is number of requests to host that are allowed in parallel
56
56
  maxsize = configuration.connection_pool_maxsize
57
57
 
58
- ssl_context = ssl.create_default_context(
59
- cafile=configuration.ssl_ca_cert
60
- )
61
- if configuration.cert_file:
62
- ssl_context.load_cert_chain(
63
- configuration.cert_file, keyfile=configuration.key_file
58
+ self._client_session = configuration.client_session
59
+ # only setup SSL when the session is not provided. Otherwise, it will do disk access and HA will get mad.
60
+ if not configuration.client_session:
61
+ ssl_context = ssl.create_default_context(
62
+ cafile=configuration.ssl_ca_cert
64
63
  )
64
+ if configuration.cert_file:
65
+ ssl_context.load_cert_chain(
66
+ configuration.cert_file, keyfile=configuration.key_file
67
+ )
68
+
69
+ if not configuration.verify_ssl:
70
+ ssl_context.check_hostname = False
71
+ ssl_context.verify_mode = ssl.CERT_NONE
65
72
 
66
- if not configuration.verify_ssl:
67
- ssl_context.check_hostname = False
68
- ssl_context.verify_mode = ssl.CERT_NONE
73
+ connector = aiohttp.TCPConnector(
74
+ limit=maxsize,
75
+ ssl=ssl_context
76
+ )
69
77
 
70
- connector = aiohttp.TCPConnector(
71
- limit=maxsize,
72
- ssl=ssl_context
73
- )
78
+ # https pool manager
79
+ self.pool_manager = aiohttp.ClientSession(
80
+ connector=connector,
81
+ trust_env=True
82
+ )
83
+ else:
84
+ self.pool_manager = configuration.client_session
74
85
 
75
86
  self.proxy = configuration.proxy
76
87
  self.proxy_headers = configuration.proxy_headers
77
88
 
78
- # https pool manager
79
- self.pool_manager = aiohttp.ClientSession(
80
- connector=connector,
81
- trust_env=True
82
- )
83
-
84
89
  retries = configuration.retries
85
90
  if retries is not None:
86
91
  self.retry_client = aiohttp_retry.RetryClient(
@@ -96,6 +101,9 @@ class RESTClientObject:
96
101
  self.retry_client = None
97
102
 
98
103
  async def close(self):
104
+ # do not close the session if provided via client_session
105
+ if self._client_session:
106
+ return
99
107
  await self.pool_manager.close()
100
108
  if self.retry_client is not None:
101
109
  await self.retry_client.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: weheat
3
- Version: 2025.1.15rc1
3
+ Version: 2025.1.15rc2
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