python-dali 0.15__py3-none-any.whl → 0.16__py3-none-any.whl

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.
dali/driver/serial.py CHANGED
@@ -1329,7 +1329,13 @@ class DriverLubaRs232(DriverSerialBase):
1329
1329
  self._transport: Optional[serialx.SerialTransport] = None
1330
1330
  self._protocol: Optional[DriverLubaRs232.LubaProtocol] = None
1331
1331
 
1332
- async def connect(self, *, scan_dev_inst: bool = False) -> None:
1332
+ async def connect(
1333
+ self, *, scan_dev_inst: bool = False, apply_settings: bool = True
1334
+ ) -> None:
1335
+ # ``apply_settings=False`` connects without writing the device settings,
1336
+ # leaving the interface's hardware configuration (including its bus-power
1337
+ # state) untouched. Use it to probe a discovered interface read-only so
1338
+ # the probe cannot depower a bus the integrated supply is already driving.
1333
1339
  if self.is_connected:
1334
1340
  _LOG.warning(
1335
1341
  f"'connect()' called but luba232 driver already connected"
@@ -1358,8 +1364,9 @@ class DriverLubaRs232(DriverSerialBase):
1358
1364
  for attempt in range(1, DriverLubaRs232.handshake_attempts + 1):
1359
1365
  try:
1360
1366
  await self._protocol.send_device_info_query()
1361
- self._protocol.bus_power = self.bus_power
1362
- await self._protocol.send_device_settings()
1367
+ if apply_settings:
1368
+ self._protocol.bus_power = self.bus_power
1369
+ await self._protocol.send_device_settings()
1363
1370
  break
1364
1371
  except (asyncio.TimeoutError, TimeoutError):
1365
1372
  if attempt >= DriverLubaRs232.handshake_attempts:
@@ -1378,8 +1385,9 @@ class DriverLubaRs232(DriverSerialBase):
1378
1385
 
1379
1386
  # After switching on the integrated power supply the bus voltage takes
1380
1387
  # a moment to rise; sending DALI frames before then fails, so wait for
1381
- # the bus to be powered before scanning.
1382
- if self.bus_power:
1388
+ # the bus to be powered before scanning. Skipped when the settings were
1389
+ # not applied, as the bus-power state was then left untouched.
1390
+ if apply_settings and self.bus_power:
1383
1391
  await self._wait_for_bus_power()
1384
1392
 
1385
1393
  # Scan the bus for control devices, and create a mapping of addresses
@@ -94,6 +94,25 @@ async def test_connect_retries_handshake_on_timeout(monkeypatch):
94
94
  assert protocol.reset_luba_response.call_count == 2
95
95
 
96
96
 
97
+ @pytest.mark.asyncio
98
+ async def test_connect_without_applying_settings_leaves_hardware_untouched(
99
+ monkeypatch,
100
+ ):
101
+ """connect(apply_settings=False) must not write the device settings.
102
+
103
+ A read-only probe of a discovered interface must not overwrite the
104
+ hardware configuration, otherwise it could depower a bus the integrated
105
+ supply is already driving.
106
+ """
107
+ driver, protocol = _connecting_driver(monkeypatch, [None])
108
+
109
+ await driver.connect(apply_settings=False)
110
+
111
+ assert driver.is_connected
112
+ assert protocol.send_device_info_query.await_count == 1
113
+ assert protocol.send_device_settings.await_count == 0
114
+
115
+
97
116
  @pytest.mark.asyncio
98
117
  async def test_connect_raises_after_exhausting_handshake_attempts(monkeypatch):
99
118
  """When every handshake attempt times out, connect must give up and raise."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-dali
3
- Version: 0.15
3
+ Version: 0.16
4
4
  Summary: Interface to DALI lighting systems
5
5
  Home-page: https://github.com/sde1000/python-dali
6
6
  Author: Stephen Early
@@ -18,7 +18,7 @@ dali/driver/base.py,sha256=Jd_0PrkVg84CdkVLmGBr5IyK5Sm7N68tqNDdPFRB7-0,3891
18
18
  dali/driver/daliserver.py,sha256=YbaTv8glbsPWtXy-m-zakxsPwZBu5FsuXxtVPfE1n78,3120
19
19
  dali/driver/hasseb.py,sha256=dQDrkxdpXlXlxmoShsoYOpvXpGzSLqZ8eqG-HMKIGOI,9376
20
20
  dali/driver/hid.py,sha256=CyBkCZeyDFumzvfTUeTB3xIjALZkg6dugd3G4DYIeig,33591
21
- dali/driver/serial.py,sha256=XPMytdl7bijJBFDx2d3q94AFcZUdH6m0z0dOvkLvdI0,82350
21
+ dali/driver/serial.py,sha256=qk58G_6nEONZqS2MRX_A0XmhwBxyy8W4tE_E4z05tCw,82883
22
22
  dali/driver/trace_logging.py,sha256=qfkEdgVQsu-dXYKsmPXb6j7VRC6O1JJovuU8ca-KEMs,2366
23
23
  dali/driver/tridonic.py,sha256=H-j0u-7oP36uKxm-KdCO35AFuoyVzKu_jQs31jeDW6Y,10889
24
24
  dali/driver/unipi.py,sha256=arQ-o8zI-PtyvnyRa6f6kPKYswFtFvvdoKfCNRxTAiY,7399
@@ -54,11 +54,11 @@ dali/tests/test_frame.py,sha256=qd9LzN5ie9zFMTeqzTW5CIsLeuR4n0U4ZqybuG-s4Ck,6035
54
54
  dali/tests/test_general_sensor.py,sha256=jQqsjzUJa9rbX5pt1K9oavDiFXzMvqclx7qZ7FHrUos,1818
55
55
  dali/tests/test_memory.py,sha256=CGcoyhyd_pVC9C4yY0D7X83RIGs8RzYcDX32VuJvd3A,29526
56
56
  dali/tests/test_sequences.py,sha256=VaGy1WbUAXFRh-RU6v0OIOHKAhFwVh4KqU7O0N28zF8,4314
57
- dali/tests/test_serial_driver.py,sha256=5tZYvE3D2BDD4nQc14te9oKh7z6uAj46uYdC5IaHq6w,8711
58
- python_dali-0.15.dist-info/licenses/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
59
- python_dali-0.15.dist-info/licenses/COPYING.LESSER,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
60
- python_dali-0.15.dist-info/licenses/LICENSE,sha256=HVcO3iFdIg-1DaBsl4fgk3swO0aZDktmHBZPIhhn_5o,168
61
- python_dali-0.15.dist-info/METADATA,sha256=NqKxhlAm09OC_InJQejTr2eQVdnboPV1nbmkFmzAZsY,6198
62
- python_dali-0.15.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
63
- python_dali-0.15.dist-info/top_level.txt,sha256=VlSHNdAIGn5irB2PYMRKK0POsLocy-YusWmK3GwHViI,5
64
- python_dali-0.15.dist-info/RECORD,,
57
+ dali/tests/test_serial_driver.py,sha256=rB6PBi-2tJsi9NLo2iTxAg2oD0z2epv9L-YFcUai5gY,9351
58
+ python_dali-0.16.dist-info/licenses/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
59
+ python_dali-0.16.dist-info/licenses/COPYING.LESSER,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
60
+ python_dali-0.16.dist-info/licenses/LICENSE,sha256=HVcO3iFdIg-1DaBsl4fgk3swO0aZDktmHBZPIhhn_5o,168
61
+ python_dali-0.16.dist-info/METADATA,sha256=cBWW6vSNaCpu-RrUmZp-tw3y0kr3AMgKeO72tnxwhU4,6198
62
+ python_dali-0.16.dist-info/WHEEL,sha256=a-udL2m4V_6Yn8b-uKzWb12RjRxwwMo6ohYFM24tpaY,91
63
+ python_dali-0.16.dist-info/top_level.txt,sha256=VlSHNdAIGn5irB2PYMRKK0POsLocy-YusWmK3GwHViI,5
64
+ python_dali-0.16.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (84.0.0)
2
+ Generator: setuptools (84.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5