Fix typo in Matter lock platform (#122536)
parent
4876e35fd8
commit
d7c713d18d
|
@ -168,10 +168,10 @@ class MatterLock(MatterEntity, LockEntity):
|
|||
|
||||
LOGGER.debug("Lock state: %s for %s", lock_state, self.entity_id)
|
||||
|
||||
if lock_state is clusters.DoorLock.Enums.DlLockState.kUnlatched:
|
||||
if lock_state == clusters.DoorLock.Enums.DlLockState.kUnlatched:
|
||||
self._attr_is_locked = False
|
||||
self._attr_is_open = True
|
||||
if lock_state is clusters.DoorLock.Enums.DlLockState.kLocked:
|
||||
elif lock_state == clusters.DoorLock.Enums.DlLockState.kLocked:
|
||||
self._attr_is_locked = True
|
||||
self._attr_is_open = False
|
||||
elif lock_state in (
|
||||
|
|
|
@ -8,6 +8,7 @@ import pytest
|
|||
|
||||
from homeassistant.components.lock import (
|
||||
STATE_LOCKED,
|
||||
STATE_OPEN,
|
||||
STATE_UNLOCKED,
|
||||
LockEntityFeature,
|
||||
)
|
||||
|
@ -82,12 +83,12 @@ async def test_lock(
|
|||
assert state
|
||||
assert state.state == STATE_UNLOCKED
|
||||
|
||||
set_node_attribute(door_lock, 1, 257, 0, 0)
|
||||
set_node_attribute(door_lock, 1, 257, 0, 1)
|
||||
await trigger_subscription_callback(hass, matter_client)
|
||||
|
||||
state = hass.states.get("lock.mock_door_lock_lock")
|
||||
assert state
|
||||
assert state.state == STATE_UNLOCKED
|
||||
assert state.state == STATE_LOCKED
|
||||
|
||||
set_node_attribute(door_lock, 1, 257, 0, None)
|
||||
await trigger_subscription_callback(hass, matter_client)
|
||||
|
@ -213,9 +214,16 @@ async def test_lock_with_unbolt(
|
|||
assert state
|
||||
assert state.state == STATE_OPENING
|
||||
|
||||
set_node_attribute(door_lock_with_unbolt, 1, 257, 3, 0)
|
||||
set_node_attribute(door_lock_with_unbolt, 1, 257, 0, 0)
|
||||
await trigger_subscription_callback(hass, matter_client)
|
||||
|
||||
state = hass.states.get("lock.mock_door_lock_lock")
|
||||
assert state
|
||||
assert state.state == STATE_LOCKED
|
||||
assert state.state == STATE_UNLOCKED
|
||||
|
||||
set_node_attribute(door_lock_with_unbolt, 1, 257, 0, 3)
|
||||
await trigger_subscription_callback(hass, matter_client)
|
||||
|
||||
state = hass.states.get("lock.mock_door_lock_lock")
|
||||
assert state
|
||||
assert state.state == STATE_OPEN
|
Loading…
Reference in New Issue