Matter dishwasher alarm (#146842)

* Update binary_sensor.py

* Update silabs_dishwasher.json

DishwasherAlarm

* DishwasherAlarm

* Update snapshot

* DishwasherAlarm

* test_dishwasher_alarm

* DishwasherAlarm

* Update silabs_dishwasher.json

* Update snapshot
This commit is contained in:
Ludovic BOUÉ 2025-06-23 12:40:37 +02:00 committed by GitHub
parent a2785a86dc
commit 82c1751f85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 160 additions and 0 deletions

View File

@ -377,4 +377,34 @@ DISCOVERY_SCHEMAS = [
),
allow_multi=True,
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(
key="DishwasherAlarmInflowError",
translation_key="dishwasher_alarm_inflow",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
measurement_to_ha=lambda x: (
x == clusters.DishwasherAlarm.Bitmaps.AlarmBitmap.kInflowError
),
),
entity_class=MatterBinarySensor,
required_attributes=(clusters.DishwasherAlarm.Attributes.State,),
allow_multi=True,
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(
key="DishwasherAlarmDoorError",
translation_key="dishwasher_alarm_door",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
measurement_to_ha=lambda x: (
x == clusters.DishwasherAlarm.Bitmaps.AlarmBitmap.kDoorError
),
),
entity_class=MatterBinarySensor,
required_attributes=(clusters.DishwasherAlarm.Attributes.State,),
allow_multi=True,
),
]

View File

@ -88,6 +88,12 @@
},
"boost_state": {
"name": "Boost state"
},
"dishwasher_alarm_inflow": {
"name": "Inflow alarm"
},
"dishwasher_alarm_door": {
"name": "Door alarm"
}
},
"button": {

View File

@ -417,6 +417,14 @@
"1/89/65528": [1],
"1/89/65529": [0],
"1/89/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/93/0": 63,
"1/93/2": 0,
"1/93/3": 63,
"1/93/65533": 1,
"1/93/65532": 0,
"1/93/65531": [0, 2, 3, 65533, 65532, 65531, 65529, 65528],
"1/93/65529": [],
"1/93/65528": [],
"1/96/0": null,
"1/96/1": null,
"1/96/3": [

View File

@ -489,6 +489,104 @@
'state': 'on',
})
# ---
# name: test_binary_sensors[silabs_dishwasher][binary_sensor.dishwasher_door_alarm-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.dishwasher_door_alarm',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Door alarm',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'dishwasher_alarm_door',
'unique_id': '00000000000004D2-0000000000000036-MatterNodeDevice-1-DishwasherAlarmDoorError-93-2',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensors[silabs_dishwasher][binary_sensor.dishwasher_door_alarm-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'Dishwasher Door alarm',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.dishwasher_door_alarm',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_binary_sensors[silabs_dishwasher][binary_sensor.dishwasher_inflow_alarm-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.dishwasher_inflow_alarm',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Inflow alarm',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'dishwasher_alarm_inflow',
'unique_id': '00000000000004D2-0000000000000036-MatterNodeDevice-1-DishwasherAlarmInflowError-93-2',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensors[silabs_dishwasher][binary_sensor.dishwasher_inflow_alarm-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'friendly_name': 'Dishwasher Inflow alarm',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.dishwasher_inflow_alarm',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_binary_sensors[silabs_evse_charging][binary_sensor.evse_charging_status-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@ -257,3 +257,21 @@ async def test_pump(
state = hass.states.get("binary_sensor.mock_pump_problem")
assert state
assert state.state == "on"
@pytest.mark.parametrize("node_fixture", ["silabs_dishwasher"])
async def test_dishwasher_alarm(
hass: HomeAssistant,
matter_client: MagicMock,
matter_node: MatterNode,
) -> None:
"""Test dishwasher alarm sensors."""
state = hass.states.get("binary_sensor.dishwasher_door_alarm")
assert state
set_node_attribute(matter_node, 1, 93, 2, 4)
await trigger_subscription_callback(hass, matter_client)
state = hass.states.get("binary_sensor.dishwasher_door_alarm")
assert state
assert state.state == "on"