1
0
mirror of https://github.com/home-assistant/core synced 2024-07-01 07:15:04 +00:00

Add open state support to matter lock (#119682)

This commit is contained in:
Paul Bottein 2024-06-15 11:24:33 +02:00 committed by GitHub
parent f1f82ffbf8
commit 7a3a57c78e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -168,6 +168,9 @@ class MatterLock(MatterEntity, LockEntity):
self._attr_is_jammed = (
door_state is clusters.DoorLock.Enums.DoorStateEnum.kDoorJammed
)
self._attr_is_open = (
door_state is clusters.DoorLock.Enums.DoorStateEnum.kDoorOpen
)
DISCOVERY_SCHEMAS = [

View File

@ -9,6 +9,7 @@ import pytest
from homeassistant.components.lock import (
STATE_LOCKED,
STATE_LOCKING,
STATE_OPEN,
STATE_UNLOCKED,
STATE_UNLOCKING,
LockEntityFeature,
@ -208,3 +209,10 @@ async def test_lock_with_unbolt(
command=clusters.DoorLock.Commands.UnlockDoor(),
timed_request_timeout_ms=1000,
)
set_node_attribute(door_lock_with_unbolt, 1, 257, 3, 0)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get("lock.mock_door_lock")
assert state
assert state.state == STATE_OPEN