1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Expose ActuatorEnabled attr of matter DoorLock (#162598)

This commit is contained in:
Aron List
2026-02-12 16:03:30 +01:00
committed by GitHub
parent 47be13e6bf
commit 72a7d708b0
4 changed files with 281 additions and 0 deletions

View File

@@ -176,6 +176,16 @@ DISCOVERY_SCHEMAS = [
required_attributes=(clusters.DoorLock.Attributes.DoorState,),
featuremap_contains=clusters.DoorLock.Bitmaps.Feature.kDoorPositionSensor,
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(
key="LockActuatorEnabledSensor",
translation_key="actuator",
entity_category=EntityCategory.DIAGNOSTIC,
),
entity_class=MatterBinarySensor,
required_attributes=(clusters.DoorLock.Attributes.ActuatorEnabled,),
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(

View File

@@ -47,6 +47,9 @@
},
"entity": {
"binary_sensor": {
"actuator": {
"name": "Actuator"
},
"alarm_door": {
"name": "Door alarm"
},

View File

@@ -149,6 +149,55 @@
'state': 'on',
})
# ---
# name: test_binary_sensors[aqara_u200][binary_sensor.aqara_smart_lock_u200_actuator-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.aqara_smart_lock_u200_actuator',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Actuator',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Actuator',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'actuator',
'unique_id': '00000000000004D2-0000000000000014-MatterNodeDevice-1-LockActuatorEnabledSensor-257-2',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensors[aqara_u200][binary_sensor.aqara_smart_lock_u200_actuator-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Aqara Smart Lock U200 Actuator',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.aqara_smart_lock_u200_actuator',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_binary_sensors[eve_contact_sensor][binary_sensor.eve_door_door-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1045,6 +1094,55 @@
'state': 'on',
})
# ---
# name: test_binary_sensors[mock_door_lock][binary_sensor.mock_door_lock_actuator-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.mock_door_lock_actuator',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Actuator',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Actuator',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'actuator',
'unique_id': '00000000000004D2-0000000000000001-MatterNodeDevice-1-LockActuatorEnabledSensor-257-2',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensors[mock_door_lock][binary_sensor.mock_door_lock_actuator-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Mock Door Lock Actuator',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.mock_door_lock_actuator',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_binary_sensors[mock_door_lock][binary_sensor.mock_door_lock_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1095,6 +1193,55 @@
'state': 'off',
})
# ---
# name: test_binary_sensors[mock_door_lock_with_unbolt][binary_sensor.mock_door_lock_with_unbolt_actuator-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.mock_door_lock_with_unbolt_actuator',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Actuator',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Actuator',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'actuator',
'unique_id': '00000000000004D2-0000000000000001-MatterNodeDevice-1-LockActuatorEnabledSensor-257-2',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensors[mock_door_lock_with_unbolt][binary_sensor.mock_door_lock_with_unbolt_actuator-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Mock Door Lock with unbolt Actuator',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.mock_door_lock_with_unbolt_actuator',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_binary_sensors[mock_door_lock_with_unbolt][binary_sensor.mock_door_lock_with_unbolt_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -1245,6 +1392,55 @@
'state': 'on',
})
# ---
# name: test_binary_sensors[mock_lock][binary_sensor.mock_lock_actuator-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.mock_lock_actuator',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Actuator',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Actuator',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'actuator',
'unique_id': '00000000000004D2-0000000000000097-MatterNodeDevice-1-LockActuatorEnabledSensor-257-2',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensors[mock_lock][binary_sensor.mock_lock_actuator-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Mock Lock Actuator',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.mock_lock_actuator',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_binary_sensors[mock_lock][binary_sensor.mock_lock_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@@ -2142,6 +2338,55 @@
'state': 'off',
})
# ---
# name: test_binary_sensors[secuyou_smart_lock][binary_sensor.secuyou_smart_lock_actuator-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.secuyou_smart_lock_actuator',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Actuator',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Actuator',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'actuator',
'unique_id': '00000000000004D2-0000000000000002-MatterNodeDevice-1-LockActuatorEnabledSensor-257-2',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensors[secuyou_smart_lock][binary_sensor.secuyou_smart_lock_actuator-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Secuyou Smart Lock Actuator',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.secuyou_smart_lock_actuator',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_binary_sensors[silabs_dishwasher][binary_sensor.dishwasher_door_alarm-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@@ -119,6 +119,29 @@ async def test_battery_sensor(
assert state.state == "on"
@pytest.mark.parametrize("node_fixture", ["mock_door_lock"])
async def test_actuator_sensor(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
matter_client: MagicMock,
matter_node: MatterNode,
) -> None:
"""Test actuator enabled sensor."""
entity_id = "binary_sensor.mock_door_lock_actuator"
state = hass.states.get(entity_id)
assert state
assert state.state == "on"
set_node_attribute(matter_node, 1, 257, 2, False)
await trigger_subscription_callback(
hass, matter_client, data=(matter_node.node_id, "1/257/2", False)
)
state = hass.states.get(entity_id)
assert state
assert state.state == "off"
@pytest.mark.parametrize("node_fixture", ["mock_door_lock"])
async def test_optional_sensor_from_featuremap(
hass: HomeAssistant,