Add CancelBoost for Matter Water heater (#145316)

* Update water_heater.py

Add CancelBoost

* Add test for CancelBoost

* Update water_heater.py
This commit is contained in:
Ludovic BOUÉ 2025-05-22 08:01:42 +02:00 committed by GitHub
parent 9e7ae1daa4
commit 12b5dbdd83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View File

@ -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."""

View File

@ -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(