Skip to content

Commit cedc4d2

Browse files
jktjktsde1000
authored andcommitted
DeviceInstanceMapper: do not skip devices with inputDeviceError
I have a bunch of non-pushbuttons switches connected to some of my Lunatone DALI-2 MC pushbutton couplers. These devices unfortunately set the "inputDeviceError" bit whenever any of its inputs is closed/shorted for longer than T_stuck. The 62386-301:2017 says (Table 4, page 15) that this timer is up to 255s, which is definitely not enough for a door sensor. The same standard then says that such errors should be propagated to bit 0 in the "instanceErrorByte", which python-dali does not query. However, my devices unfortunately also propagate this status into the "inputDeviceError", and that means that the initial discovery of instance numbers to instance types won't recognize these buttons at all. I was not able to find a reference in the standard whether any "instanceError" propagates to the "inputDeviceError", but even if this was an incorrect behavior, these devices exist, one can buy them, and presumably using them as a kind-of persistent contact inputs still makes sense; just to provide some data, I have: - magnet and a reed switch for door status monitoring, - a "permanent" switch for disabling automation at a hallway where our baby sometimes sleeps. I think that both use cases make sense, and I would prefer python-dali to not skip over some input devices which actually work just fine. Fixes: 0cfddb7 Add support for DALI 24-bit event messages
1 parent 73ba41f commit cedc4d2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

dali/device/helpers.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ def autodiscover(
127127
if isinstance(rsp, QueryDeviceStatusResponse):
128128
# Make sure the status is OK
129129
if (
130-
rsp.input_device_error
131-
or rsp.short_address_is_mask
130+
rsp.short_address_is_mask
132131
or rsp.reset_state
133132
):
134133
continue

dali/tests/test_device_sequences.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class DeviceFakeError(fakes.Device):
7777
_device_status = 0b00000001
7878

7979

80-
def test_device_autodiscover_skip_bad(fakes_bus):
80+
def test_device_autodiscover_dont_skip_bad(fakes_bus):
8181
dev_inst_map = DeviceInstanceTypeMapper()
8282
# Add an extra fake device, one with an error bit set
8383
fakes_bus.gear.append(
@@ -90,8 +90,8 @@ def test_device_autodiscover_skip_bad(fakes_bus):
9090
assert rsp.input_device_error
9191

9292
fakes_bus.run_sequence(dev_inst_map.autodiscover())
93-
# The device in error mode shouldn't have had its instances counted
94-
assert len(dev_inst_map.mapping) == 12
93+
# The mere fact that a device has "inputDeviceError" set does not mean it is not usable
94+
assert len(dev_inst_map.mapping) == 16
9595

9696

9797
class DeviceNoInstances(fakes.Device):

0 commit comments

Comments
 (0)