python-homewizard-energy 8.3.0__tar.gz → 8.3.1__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.
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/PKG-INFO +1 -1
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/homewizard_energy.py +6 -2
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v2/__init__.py +6 -4
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/pyproject.toml +2 -1
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/LICENSE +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/README.md +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/__init__.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/const.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/errors.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/models.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/py.typed +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/utils.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v1/__init__.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v1/const.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v2/cacert.py +0 -0
- {python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v2/const.py +0 -0
|
@@ -22,6 +22,8 @@ class HomeWizardEnergy:
|
|
|
22
22
|
|
|
23
23
|
_device: Device | None = None
|
|
24
24
|
|
|
25
|
+
_lock: asyncio.Lock
|
|
26
|
+
|
|
25
27
|
def __init__(
|
|
26
28
|
self,
|
|
27
29
|
host: str,
|
|
@@ -40,6 +42,8 @@ class HomeWizardEnergy:
|
|
|
40
42
|
self._close_session = clientsession is None
|
|
41
43
|
self._request_timeout = timeout
|
|
42
44
|
|
|
45
|
+
self._lock = asyncio.Lock()
|
|
46
|
+
|
|
43
47
|
@property
|
|
44
48
|
def host(self) -> str:
|
|
45
49
|
"""Return the hostname of the device.
|
|
@@ -117,6 +121,8 @@ class HomeWizardEnergy:
|
|
|
117
121
|
async def _create_clientsession(self) -> None:
|
|
118
122
|
"""Create a client session."""
|
|
119
123
|
|
|
124
|
+
LOGGER.debug("Creating clientsession")
|
|
125
|
+
|
|
120
126
|
if self._session is not None:
|
|
121
127
|
raise RuntimeError("Session already exists")
|
|
122
128
|
|
|
@@ -131,8 +137,6 @@ class HomeWizardEnergy:
|
|
|
131
137
|
connector=connector, timeout=ClientTimeout(total=self._request_timeout)
|
|
132
138
|
)
|
|
133
139
|
|
|
134
|
-
# self._session = self._create_clientsession(connector, timeout=ClientTimeout(total=self._request_timeout))
|
|
135
|
-
|
|
136
140
|
async def __aenter__(self) -> HomeWizardEnergy:
|
|
137
141
|
"""Async enter.
|
|
138
142
|
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v2/__init__.py
RENAMED
|
@@ -221,11 +221,13 @@ class HomeWizardEnergyV2(HomeWizardEnergy):
|
|
|
221
221
|
) -> tuple[HTTPStatus, dict[str, Any] | None]:
|
|
222
222
|
"""Make a request to the API."""
|
|
223
223
|
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
async with self._lock:
|
|
225
|
+
if self._session is None:
|
|
226
|
+
await self._create_clientsession()
|
|
226
227
|
|
|
227
|
-
|
|
228
|
-
self._ssl
|
|
228
|
+
async with self._lock:
|
|
229
|
+
if self._ssl is False:
|
|
230
|
+
self._ssl = await self._get_ssl_context()
|
|
229
231
|
|
|
230
232
|
# Construct request
|
|
231
233
|
url = f"https://{self.host}{path}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-homewizard-energy"
|
|
3
|
-
version = "8.3.
|
|
3
|
+
version = "8.3.1"
|
|
4
4
|
description = "Asynchronous Python client for the HomeWizard Energy"
|
|
5
5
|
authors = ["DCSBL"]
|
|
6
6
|
maintainers = ["DCSBL"]
|
|
@@ -107,6 +107,7 @@ max-attributes=20
|
|
|
107
107
|
|
|
108
108
|
[tool.pytest.ini_options]
|
|
109
109
|
addopts = "--cov"
|
|
110
|
+
asyncio_mode = "auto"
|
|
110
111
|
|
|
111
112
|
[tool.vulture]
|
|
112
113
|
min_confidence = 80
|
|
File without changes
|
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/__init__.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/const.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/errors.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/models.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/py.typed
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/utils.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v1/__init__.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v1/const.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v2/cacert.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.3.0 → python_homewizard_energy-8.3.1}/homewizard_energy/v2/const.py
RENAMED
|
File without changes
|