diff --git a/homeassistant/components/matter/water_heater.py b/homeassistant/components/matter/water_heater.py index 07c011554fa..e453a8be067 100644 --- a/homeassistant/components/matter/water_heater.py +++ b/homeassistant/components/matter/water_heater.py @@ -108,6 +108,11 @@ class MatterWaterHeater(MatterEntity, WaterHeaterEntity): await self.send_device_command( clusters.WaterHeaterManagement.Commands.Boost(boostInfo=boost_info) ) + # Trigger CancelBoost command for other modes + else: + await self.send_device_command( + clusters.WaterHeaterManagement.Commands.CancelBoost() + ) async def async_turn_on(self, **kwargs: Any) -> None: """Turn on water heater.""" diff --git a/tests/components/matter/test_water_heater.py b/tests/components/matter/test_water_heater.py index 2785dc9c778..a674c87c24b 100644 --- a/tests/components/matter/test_water_heater.py +++ b/tests/components/matter/test_water_heater.py @@ -166,6 +166,32 @@ async def test_water_heater_boostmode( command=clusters.WaterHeaterManagement.Commands.Boost(boostInfo=boost_info), ) + # disable water_heater boostmode + await hass.services.async_call( + "water_heater", + "set_operation_mode", + { + "entity_id": "water_heater.water_heater", + "operation_mode": STATE_ECO, + }, + blocking=True, + ) + assert matter_client.write_attribute.call_count == 2 + assert matter_client.write_attribute.call_args == call( + node_id=matter_node.node_id, + attribute_path=create_attribute_path_from_attribute( + endpoint_id=2, + attribute=clusters.Thermostat.Attributes.SystemMode, + ), + value=4, + ) + assert matter_client.send_device_command.call_count == 2 + assert matter_client.send_device_command.call_args == call( + node_id=matter_node.node_id, + endpoint_id=2, + command=clusters.WaterHeaterManagement.Commands.CancelBoost(), + ) + @pytest.mark.parametrize("node_fixture", ["silabs_water_heater"]) async def test_update_from_water_heater(