python-homely 0.1.5__tar.gz → 0.1.7__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_homely-0.1.5/src/python_homely.egg-info → python_homely-0.1.7}/PKG-INFO +1 -1
- {python_homely-0.1.5 → python_homely-0.1.7}/pyproject.toml +1 -1
- {python_homely-0.1.5 → python_homely-0.1.7}/src/homely/__init__.py +3 -1
- {python_homely-0.1.5 → python_homely-0.1.7}/src/homely/websocket.py +15 -2
- {python_homely-0.1.5 → python_homely-0.1.7/src/python_homely.egg-info}/PKG-INFO +1 -1
- {python_homely-0.1.5 → python_homely-0.1.7}/tests/test_sdk.py +1 -1
- {python_homely-0.1.5 → python_homely-0.1.7}/LICENSE +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/README.md +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/setup.cfg +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/homely/client.py +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/homely/exceptions.py +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/homely/models.py +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/homely/py.typed +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/python_homely.egg-info/SOURCES.txt +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/python_homely.egg-info/dependency_links.txt +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/python_homely.egg-info/requires.txt +0 -0
- {python_homely-0.1.5 → python_homely-0.1.7}/src/python_homely.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-homely"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.7"
|
|
8
8
|
description = "Async Python client for the Homely cloud API, built for Home Assistant but usable anywhere."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -105,6 +105,7 @@ class HomelyWebSocket:
|
|
|
105
105
|
self._status_update_callback = status_update_callback
|
|
106
106
|
self._status = "Not initialized"
|
|
107
107
|
self._status_reason: str | None = None
|
|
108
|
+
self._loop: asyncio.AbstractEventLoop | None = None
|
|
108
109
|
|
|
109
110
|
def _ctx(self, device_id: str | None = None) -> str:
|
|
110
111
|
"""Build consistent log context."""
|
|
@@ -272,7 +273,13 @@ class HomelyWebSocket:
|
|
|
272
273
|
try:
|
|
273
274
|
loop = asyncio.get_running_loop()
|
|
274
275
|
except RuntimeError:
|
|
275
|
-
loop =
|
|
276
|
+
loop = self._loop
|
|
277
|
+
if loop is None:
|
|
278
|
+
_LOGGER.error(
|
|
279
|
+
"Cannot start reconnect loop: no event loop available %s",
|
|
280
|
+
self._ctx(),
|
|
281
|
+
)
|
|
282
|
+
return
|
|
276
283
|
|
|
277
284
|
self._reconnect_task = loop.create_task(self._reconnect_loop())
|
|
278
285
|
if reason:
|
|
@@ -332,6 +339,12 @@ class HomelyWebSocket:
|
|
|
332
339
|
_LOGGER.debug("Skipping websocket connect during shutdown %s", self._ctx())
|
|
333
340
|
return False
|
|
334
341
|
|
|
342
|
+
if self._loop is None:
|
|
343
|
+
try:
|
|
344
|
+
self._loop = asyncio.get_running_loop()
|
|
345
|
+
except RuntimeError:
|
|
346
|
+
pass
|
|
347
|
+
|
|
335
348
|
try:
|
|
336
349
|
import socketio # type: ignore[import-untyped]
|
|
337
350
|
except ImportError:
|
|
@@ -403,7 +416,7 @@ class HomelyWebSocket:
|
|
|
403
416
|
await asyncio.wait_for(
|
|
404
417
|
self.socket.connect(
|
|
405
418
|
url,
|
|
406
|
-
transports=["
|
|
419
|
+
transports=["websocket"],
|
|
407
420
|
headers={"Authorization": bearer_token},
|
|
408
421
|
),
|
|
409
422
|
timeout=10,
|
|
@@ -93,7 +93,7 @@ class _FakeAsyncCallable:
|
|
|
93
93
|
async def test_sdk_exports_public_symbols():
|
|
94
94
|
"""The SDK should expose a clean public surface."""
|
|
95
95
|
assert auth_header_value("token") == "Bearer token"
|
|
96
|
-
assert __version__ == "0.1.
|
|
96
|
+
assert __version__ == "0.1.5"
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
async def test_authenticate_returns_typed_token():
|
|
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
|