Skip to content

Commit 011b253

Browse files
authored
feat: Implement set_value method for a01 device protocols (#408)
1 parent 642b7d3 commit 011b253

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

roborock/version_a01_apis/roborock_mqtt_client_a01.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,16 @@ async def update_values(
7373
payload=pad(json.dumps(payload).encode("utf-8"), AES.block_size),
7474
)
7575
)
76+
77+
async def set_value(
78+
self, protocol: RoborockDyadDataProtocol | RoborockZeoProtocol, value: typing.Any
79+
) -> dict[int, typing.Any]:
80+
"""Set a value for a specific protocol on the A01 device."""
81+
payload = {"dps": {int(protocol): value}}
82+
return await self.send_message(
83+
RoborockMessage(
84+
protocol=RoborockMessageProtocol.RPC_REQUEST,
85+
version=b"A01",
86+
payload=pad(json.dumps(payload).encode("utf-8"), AES.block_size),
87+
)
88+
)

0 commit comments

Comments
 (0)