From c86ba49a79cd90993d164403290f977a3ebc1c80 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Thu, 22 May 2025 12:40:56 +0200 Subject: [PATCH] Add Matter test to select attribute (#145440) --- tests/components/matter/test_select.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/components/matter/test_select.py b/tests/components/matter/test_select.py index 71999873135..456558d983d 100644 --- a/tests/components/matter/test_select.py +++ b/tests/components/matter/test_select.py @@ -99,6 +99,24 @@ async def test_attribute_select_entities( await trigger_subscription_callback(hass, matter_client) state = hass.states.get(entity_id) assert state.state == "on" + await hass.services.async_call( + "select", + "select_option", + { + "entity_id": entity_id, + "option": "off", + }, + blocking=True, + ) + assert matter_client.write_attribute.call_count == 1 + assert matter_client.write_attribute.call_args == call( + node_id=matter_node.node_id, + attribute_path=create_attribute_path_from_attribute( + endpoint_id=1, + attribute=clusters.OnOff.Attributes.StartUpOnOff, + ), + value=0, + ) # test that an invalid value (e.g. 253) leads to an unknown state set_node_attribute(matter_node, 1, 6, 16387, 253) await trigger_subscription_callback(hass, matter_client)