mirror of
https://github.com/home-assistant/core.git
synced 2025-09-09 14:51:34 +02:00
Matter valve Open command doesn't support TargetLevel=0 (#150922)
This commit is contained in:
committed by
Paulus Schoutsen
parent
1bd5aa0ab0
commit
bb9660269c
@@ -52,9 +52,12 @@ class MatterValve(MatterEntity, ValveEntity):
|
|||||||
|
|
||||||
async def async_set_valve_position(self, position: int) -> None:
|
async def async_set_valve_position(self, position: int) -> None:
|
||||||
"""Move the valve to a specific position."""
|
"""Move the valve to a specific position."""
|
||||||
await self.send_device_command(
|
if position > 0:
|
||||||
ValveConfigurationAndControl.Commands.Open(targetLevel=position)
|
await self.send_device_command(
|
||||||
)
|
ValveConfigurationAndControl.Commands.Open(targetLevel=position)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
await self.send_device_command(ValveConfigurationAndControl.Commands.Close())
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _update_from_device(self) -> None:
|
def _update_from_device(self) -> None:
|
||||||
|
@@ -133,3 +133,22 @@ async def test_valve(
|
|||||||
command=clusters.ValveConfigurationAndControl.Commands.Open(targetLevel=100),
|
command=clusters.ValveConfigurationAndControl.Commands.Open(targetLevel=100),
|
||||||
)
|
)
|
||||||
matter_client.send_device_command.reset_mock()
|
matter_client.send_device_command.reset_mock()
|
||||||
|
|
||||||
|
# test using set_position action to close valve
|
||||||
|
await hass.services.async_call(
|
||||||
|
"valve",
|
||||||
|
"set_valve_position",
|
||||||
|
{
|
||||||
|
"entity_id": entity_id,
|
||||||
|
"position": 0,
|
||||||
|
},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert matter_client.send_device_command.call_count == 1
|
||||||
|
assert matter_client.send_device_command.call_args == call(
|
||||||
|
node_id=matter_node.node_id,
|
||||||
|
endpoint_id=1,
|
||||||
|
command=clusters.ValveConfigurationAndControl.Commands.Close(),
|
||||||
|
)
|
||||||
|
matter_client.send_device_command.reset_mock()
|
||||||
|
Reference in New Issue
Block a user