KIDS_LOCK_VS_FALLBACK's write_fn wrote 'Enable', a value no dump in the fixture corpus (washers, dryers, dishwashers, ovens, ranges, microwaves, air purifiers, air dressers -- everything that lacks the OCF-standard /kidslock/0) has ever reported back; every one reports 'Ready' or 'Run'. It was never a confirmed write contract. #181's reporter tested directly: writing the *correct* value ('Run') still returns 4.05, and the SmartThings app itself has no control for kids lock either -- the resource is genuinely read-only on that hardware, not just wrong-valued. #183's reporter hit the identical symptom (toggle does nothing) on a different device family reporting the same Run/Ready vocabulary. Convert the entity to a read-only BinarySensorDesc. binary_sensor's 'lock' device class is inverted from the old switch reading (On means open/unlocked), so value_fn flips accordingly -- callers reading the flattened 'child_lock' state key need to account for the new polarity. KIDS_LOCK_GENERIC (the OCF-standard /kidslock/0 boolean) is untouched; nothing suggests that one is broken.
This commit is contained in:
5 files changed
+41
-11
No files matched your search
@@ -15,9 +15,13 @@ def _reg():
|
||||
|
||||
|
||||
def test_kids_lock_vs_value_fn():
|
||||
"""binary_sensor's 'lock' device class is inverted from a plain on/off
|
||||
switch: On means open/unlocked (issues #181/#183 -- see
|
||||
TestKidsLockFallback.test_vs_fallback_is_read_only for why this is a
|
||||
binary_sensor at all)."""
|
||||
desc = common.KIDS_LOCK_VS_FALLBACK.entities[0]
|
||||
assert desc.value_fn('Lock') is True
|
||||
assert desc.value_fn('Ready') is False
|
||||
assert desc.value_fn('Lock') is False
|
||||
assert desc.value_fn('Ready') is True
|
||||
|
||||
|
||||
def test_common_caps_discover_on_dishwasher(dishwasher_resources):
|
||||
@@ -241,6 +245,16 @@ class TestKidsLockFallback:
|
||||
assert common.KIDS_LOCK_VS_FALLBACK.match_fn(
|
||||
{}, {'/kidslock/0': {}, '/kidslock/vs/0': {}}) is False
|
||||
|
||||
def test_vs_fallback_is_read_only(self):
|
||||
"""Issues #181/#183: writing this resource 4.05s on real hardware
|
||||
even with the *correct* value ('Run'), and no dump in the fixture
|
||||
corpus has ever reported the value this used to write ('Enable')
|
||||
back -- every one reports 'Ready' or 'Run'. Never a confirmed write
|
||||
contract, so it's a binary_sensor (no write_fn field at all), not
|
||||
a switch."""
|
||||
desc = common.KIDS_LOCK_VS_FALLBACK.entities[0]
|
||||
assert isinstance(desc, BinarySensorDesc)
|
||||
|
||||
|
||||
class TestRemoteControlFallback:
|
||||
def test_generic_read(self):
|
||||
|
||||
Reference in new issue
Block a user