python-rako-2025 0.3.9__tar.gz → 0.3.11__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_rako_2025-0.3.9 → python_rako_2025-0.3.11}/PKG-INFO +1 -1
- python_rako_2025-0.3.11/python_rako/__version__.py +1 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako/bridge.py +5 -30
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako_2025.egg-info/PKG-INFO +1 -1
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/tests/test_bridge.py +4 -4
- python_rako_2025-0.3.9/python_rako/__version__.py +0 -1
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/LICENSE +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/README.md +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/pyproject.toml +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako/__init__.py +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako/const.py +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako/exceptions.py +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako/helpers.py +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako/model.py +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako/py.typed +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako_2025.egg-info/SOURCES.txt +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako_2025.egg-info/dependency_links.txt +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako_2025.egg-info/requires.txt +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako_2025.egg-info/top_level.txt +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/setup.cfg +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/setup.py +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/tests/test_helpers.py +0 -0
- {python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/tests/test_model.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-rako-2025
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.11
|
|
4
4
|
Summary: Asynchronous Python client for Rako Controls Lighting
|
|
5
5
|
Author-email: Simon Leigh <simonleigh@users.noreply.github.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/simonleigh/python-rako
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.11
|
|
@@ -153,6 +153,7 @@ class Bridge:
|
|
|
153
153
|
self.level_cache: LevelCache = LevelCache()
|
|
154
154
|
self.scene_cache: SceneCache = SceneCache()
|
|
155
155
|
self._cached_xml: str | None = None
|
|
156
|
+
self._xml_fetch_lock = asyncio.Lock()
|
|
156
157
|
|
|
157
158
|
@property
|
|
158
159
|
def _discovery_url(self) -> str:
|
|
@@ -161,9 +162,10 @@ class Bridge:
|
|
|
161
162
|
async def get_rako_xml(
|
|
162
163
|
self, session: aiohttp.ClientSession, force_refresh: bool = False
|
|
163
164
|
) -> str:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
self.
|
|
165
|
+
async with self._xml_fetch_lock:
|
|
166
|
+
if self._cached_xml is None or force_refresh:
|
|
167
|
+
async with session.get(self._discovery_url) as response:
|
|
168
|
+
self._cached_xml = await response.text()
|
|
167
169
|
assert self._cached_xml is not None
|
|
168
170
|
return self._cached_xml
|
|
169
171
|
|
|
@@ -205,18 +207,6 @@ class Bridge:
|
|
|
205
207
|
for vent in ventilation:
|
|
206
208
|
yield vent
|
|
207
209
|
|
|
208
|
-
async def discover_all_devices(
|
|
209
|
-
self, session: aiohttp.ClientSession, force_refresh: bool = False
|
|
210
|
-
) -> AsyncGenerator[
|
|
211
|
-
RoomLight | ChannelLight | RoomVentilation | ChannelVentilation
|
|
212
|
-
]:
|
|
213
|
-
"""Discover all devices by fetching XML once."""
|
|
214
|
-
lights, ventilation = await self.discover_devices(session, force_refresh)
|
|
215
|
-
for light in lights:
|
|
216
|
-
yield light
|
|
217
|
-
for vent in ventilation:
|
|
218
|
-
yield vent
|
|
219
|
-
|
|
220
210
|
async def get_info(
|
|
221
211
|
self, session: aiohttp.ClientSession, force_refresh: bool = False
|
|
222
212
|
) -> BridgeInfo:
|
|
@@ -248,21 +238,6 @@ class Bridge:
|
|
|
248
238
|
charset=config.get("charset"),
|
|
249
239
|
)
|
|
250
240
|
|
|
251
|
-
@staticmethod
|
|
252
|
-
def get_lights_from_discovery_xml(
|
|
253
|
-
xml: str,
|
|
254
|
-
) -> Generator[RoomLight | ChannelLight]:
|
|
255
|
-
for device in Bridge.get_devices_from_discovery_xml(xml, "Lights"):
|
|
256
|
-
if isinstance(device, (RoomLight, ChannelLight)):
|
|
257
|
-
yield device
|
|
258
|
-
|
|
259
|
-
@staticmethod
|
|
260
|
-
def get_all_devices_from_discovery_xml(
|
|
261
|
-
xml: str,
|
|
262
|
-
) -> Generator[RoomLight | ChannelLight | RoomVentilation | ChannelVentilation]:
|
|
263
|
-
"""Get all devices (lights and ventilation) from discovery XML."""
|
|
264
|
-
return Bridge.get_devices_from_discovery_xml(xml)
|
|
265
|
-
|
|
266
241
|
@staticmethod
|
|
267
242
|
def get_devices_from_discovery_xml(
|
|
268
243
|
xml: str, device_types: str | list[str] | None = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-rako-2025
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.11
|
|
4
4
|
Summary: Asynchronous Python client for Rako Controls Lighting
|
|
5
5
|
Author-email: Simon Leigh <simonleigh@users.noreply.github.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/simonleigh/python-rako
|
|
@@ -9,7 +9,7 @@ from python_rako.model import (
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def test_get_lights_from_discovery_xml(rako_xml):
|
|
12
|
-
lights = Bridge.
|
|
12
|
+
lights = list(Bridge.get_devices_from_discovery_xml(rako_xml, "Lights"))
|
|
13
13
|
|
|
14
14
|
expected_lights = [
|
|
15
15
|
RoomLight(room_id=5, room_title="Living Room", channel_id=0),
|
|
@@ -87,7 +87,7 @@ def test_get_bridge_info_from_discovery_xml2(rako_xml2):
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
def test_get_lights_from_discovery_xml2(rako_xml2):
|
|
90
|
-
lights = Bridge.
|
|
90
|
+
lights = list(Bridge.get_devices_from_discovery_xml(rako_xml2, "Lights"))
|
|
91
91
|
|
|
92
92
|
expected_lights = [
|
|
93
93
|
RoomLight(room_id=112, room_title="Bedroom 1", channel_id=0),
|
|
@@ -145,7 +145,7 @@ def test_ventilation_command_compatibility():
|
|
|
145
145
|
|
|
146
146
|
def test_get_all_devices_from_discovery_xml(rako_xml3):
|
|
147
147
|
"""Test discovering all device types from XML"""
|
|
148
|
-
all_devices = list(Bridge.
|
|
148
|
+
all_devices = list(Bridge.get_devices_from_discovery_xml(rako_xml3))
|
|
149
149
|
|
|
150
150
|
# Should contain both lights and ventilation
|
|
151
151
|
lights = [dev for dev in all_devices if isinstance(dev, (RoomLight, ChannelLight))]
|
|
@@ -212,7 +212,7 @@ def test_get_devices_all_parameter_variants(rako_xml3):
|
|
|
212
212
|
"""Test different ways to get all devices"""
|
|
213
213
|
all_devices_none = list(Bridge.get_devices_from_discovery_xml(rako_xml3, None))
|
|
214
214
|
all_devices_all = list(Bridge.get_devices_from_discovery_xml(rako_xml3, "All"))
|
|
215
|
-
all_devices_method = list(Bridge.
|
|
215
|
+
all_devices_method = list(Bridge.get_devices_from_discovery_xml(rako_xml3))
|
|
216
216
|
|
|
217
217
|
# All should return the same devices
|
|
218
218
|
assert all_devices_none == all_devices_all == all_devices_method
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.3.9
|
|
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
|
{python_rako_2025-0.3.9 → python_rako_2025-0.3.11}/python_rako_2025.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|