python-rako-2025 0.3.0__tar.gz → 0.3.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.
Files changed (23) hide show
  1. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/PKG-INFO +1 -1
  2. python_rako_2025-0.3.7/python_rako/__version__.py +1 -0
  3. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako/bridge.py +18 -17
  4. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako_2025.egg-info/PKG-INFO +1 -1
  5. python_rako_2025-0.3.0/python_rako/__version__.py +0 -1
  6. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/LICENSE +0 -0
  7. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/README.md +0 -0
  8. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/pyproject.toml +0 -0
  9. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako/__init__.py +0 -0
  10. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako/const.py +0 -0
  11. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako/exceptions.py +0 -0
  12. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako/helpers.py +0 -0
  13. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako/model.py +0 -0
  14. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako/py.typed +0 -0
  15. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako_2025.egg-info/SOURCES.txt +0 -0
  16. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako_2025.egg-info/dependency_links.txt +0 -0
  17. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako_2025.egg-info/requires.txt +0 -0
  18. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/python_rako_2025.egg-info/top_level.txt +0 -0
  19. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/setup.cfg +0 -0
  20. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/setup.py +0 -0
  21. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/tests/test_bridge.py +0 -0
  22. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/tests/test_helpers.py +0 -0
  23. {python_rako_2025-0.3.0 → python_rako_2025-0.3.7}/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.0
3
+ Version: 0.3.7
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.7
@@ -163,26 +163,26 @@ class Bridge:
163
163
  async def discover_devices(
164
164
  self, session: aiohttp.ClientSession
165
165
  ) -> tuple[list[Light], list[Ventilation]]:
166
- """
167
- Discover all devices by fetching XML once and parsing all device types.
166
+ """Discover all devices by fetching XML once and parsing all device types.
167
+
168
168
  Returns a tuple of (lights, ventilation) to avoid race conditions.
169
169
  """
170
170
  rako_xml = await self.get_rako_xml(session)
171
-
172
- lights = []
173
- ventilation = []
174
-
171
+
172
+ lights: list[Light] = []
173
+ ventilation: list[Ventilation] = []
174
+
175
175
  for device in self.get_devices_from_discovery_xml(rako_xml):
176
176
  if isinstance(device, (RoomLight, ChannelLight)):
177
- lights.append(device)
177
+ lights.append(device) # type: ignore[arg-type]
178
178
  elif isinstance(device, (RoomVentilation, ChannelVentilation)):
179
- ventilation.append(device)
180
-
179
+ ventilation.append(device) # type: ignore[arg-type]
180
+
181
181
  return lights, ventilation
182
182
 
183
183
  async def discover_lights(
184
184
  self, session: aiohttp.ClientSession
185
- ) -> AsyncGenerator[Light]:
185
+ ) -> AsyncGenerator[RoomLight | ChannelLight, None]:
186
186
  """Discover lights by fetching XML once and filtering for lights."""
187
187
  rako_xml = await self.get_rako_xml(session)
188
188
  for light in self.get_lights_from_discovery_xml(rako_xml):
@@ -190,7 +190,7 @@ class Bridge:
190
190
 
191
191
  async def discover_ventilation(
192
192
  self, session: aiohttp.ClientSession
193
- ) -> AsyncGenerator[Ventilation]:
193
+ ) -> AsyncGenerator[RoomVentilation | ChannelVentilation, None]:
194
194
  """Discover ventilation by fetching XML once and filtering for ventilation."""
195
195
  rako_xml = await self.get_rako_xml(session)
196
196
  for device in self.get_devices_from_discovery_xml(rako_xml, "Ventilation"):
@@ -199,7 +199,7 @@ class Bridge:
199
199
 
200
200
  async def discover_all_devices(
201
201
  self, session: aiohttp.ClientSession
202
- ) -> AsyncGenerator[Light | Ventilation]:
202
+ ) -> AsyncGenerator[RoomLight | ChannelLight | RoomVentilation | ChannelVentilation, None]:
203
203
  """Discover all devices by fetching XML once."""
204
204
  rako_xml = await self.get_rako_xml(session)
205
205
  for device in self.get_devices_from_discovery_xml(rako_xml):
@@ -234,20 +234,20 @@ class Bridge:
234
234
  )
235
235
 
236
236
  @staticmethod
237
- def get_lights_from_discovery_xml(xml: str) -> Generator[Light]:
237
+ def get_lights_from_discovery_xml(xml: str) -> Generator[RoomLight | ChannelLight, None, None]:
238
238
  for device in Bridge.get_devices_from_discovery_xml(xml, "Lights"):
239
239
  if isinstance(device, (RoomLight, ChannelLight)):
240
240
  yield device
241
241
 
242
242
  @staticmethod
243
- def get_all_devices_from_discovery_xml(xml: str) -> Generator[Light | Ventilation]:
243
+ def get_all_devices_from_discovery_xml(xml: str) -> Generator[RoomLight | ChannelLight | RoomVentilation | ChannelVentilation, None, None]:
244
244
  """Get all devices (lights and ventilation) from discovery XML."""
245
245
  return Bridge.get_devices_from_discovery_xml(xml)
246
246
 
247
247
  @staticmethod
248
248
  def get_devices_from_discovery_xml(
249
249
  xml: str, device_types: str | list[str] | None = None
250
- ) -> Generator[Light | Ventilation]:
250
+ ) -> Generator[RoomLight | ChannelLight | RoomVentilation | ChannelVentilation, None, None]:
251
251
  # Handle different input types for backward compatibility
252
252
  if device_types is None or device_types == "All":
253
253
  target_types = {"Lights", "Ventilation"}
@@ -307,11 +307,12 @@ class Bridge:
307
307
  if not resp:
308
308
  return None
309
309
 
310
- data, (remote_ip, _) = resp
310
+ data, addr = resp
311
+ remote_ip, _ = addr
311
312
  if remote_ip != self.host:
312
313
  return None
313
314
 
314
- byte_list = list(data)
315
+ byte_list = list(data) if isinstance(data, (bytes, bytearray)) else [int(data)]
315
316
  _LOGGER.debug("Received bytes: %s", byte_list)
316
317
  message = deserialise_byte_list(byte_list)
317
318
  _LOGGER.debug("Deserialised received message as: %s", message)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-rako-2025
3
- Version: 0.3.0
3
+ Version: 0.3.7
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
@@ -1 +0,0 @@
1
- 0.3.0