From 95704679c658da6f25ad81436a2272a595b7c434 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 13 Nov 2025 21:57:21 -0500 Subject: [PATCH 1/5] fix: switches commands were incorrect --- roborock/devices/traits/v1/do_not_disturb.py | 18 +++++++----------- .../traits/v1/valley_electricity_timer.py | 16 +++++++--------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/roborock/devices/traits/v1/do_not_disturb.py b/roborock/devices/traits/v1/do_not_disturb.py index 2b20265c..9d9dc30d 100644 --- a/roborock/devices/traits/v1/do_not_disturb.py +++ b/roborock/devices/traits/v1/do_not_disturb.py @@ -27,18 +27,14 @@ async def enable(self) -> None: """Set the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command( RoborockCommand.SET_DND_TIMER, - params={ - **self.as_dict(), - _ENABLED_PARAM: 1, - }, + params=[ + self.start_hour, + self.start_minute, + self.end_hour, + self.end_minute, + ], ) async def disable(self) -> None: """Set the Do Not Disturb (DND) timer settings of the device.""" - await self.rpc_channel.send_command( - RoborockCommand.SET_DND_TIMER, - params={ - **self.as_dict(), - _ENABLED_PARAM: 0, - }, - ) + await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) diff --git a/roborock/devices/traits/v1/valley_electricity_timer.py b/roborock/devices/traits/v1/valley_electricity_timer.py index d00435bd..01fa908c 100644 --- a/roborock/devices/traits/v1/valley_electricity_timer.py +++ b/roborock/devices/traits/v1/valley_electricity_timer.py @@ -28,18 +28,16 @@ async def enable(self) -> None: """Enable the Valley Electricity Timer settings of the device.""" await self.rpc_channel.send_command( RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, - params={ - **self.as_dict(), - _ENABLED_PARAM: 1, - }, + params=[ + self.start_hour, + self.start_minute, + self.end_hour, + self.end_minute, + ], ) async def disable(self) -> None: """Disable the Valley Electricity Timer settings of the device.""" await self.rpc_channel.send_command( - RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, - params={ - **self.as_dict(), - _ENABLED_PARAM: 0, - }, + RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER, ) From 9aa448a44b293c910bb687ee9c5ffc2c65e2b8ec Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 13 Nov 2025 22:06:58 -0500 Subject: [PATCH 2/5] chore: switch to as_list --- roborock/data/containers.py | 3 +++ roborock/devices/traits/v1/do_not_disturb.py | 9 ++------- roborock/devices/traits/v1/valley_electricity_timer.py | 9 ++------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/roborock/data/containers.py b/roborock/data/containers.py index 8852b849..60d20ade 100644 --- a/roborock/data/containers.py +++ b/roborock/data/containers.py @@ -140,6 +140,9 @@ def end_time(self) -> datetime.time | None: else None ) + def as_list(self) -> list: + return [self.start_hour, self.start_minute, self.end_hour, self.end_minute] + def __repr__(self) -> str: return _attr_repr(self) diff --git a/roborock/devices/traits/v1/do_not_disturb.py b/roborock/devices/traits/v1/do_not_disturb.py index 9d9dc30d..0ee610f6 100644 --- a/roborock/devices/traits/v1/do_not_disturb.py +++ b/roborock/devices/traits/v1/do_not_disturb.py @@ -17,7 +17,7 @@ def is_on(self) -> bool: async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None: """Set the Do Not Disturb (DND) timer settings of the device.""" - await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_dict()) + await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list()) async def clear_dnd_timer(self) -> None: """Clear the Do Not Disturb (DND) timer settings of the device.""" @@ -27,12 +27,7 @@ async def enable(self) -> None: """Set the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command( RoborockCommand.SET_DND_TIMER, - params=[ - self.start_hour, - self.start_minute, - self.end_hour, - self.end_minute, - ], + params=self.as_list(), ) async def disable(self) -> None: diff --git a/roborock/devices/traits/v1/valley_electricity_timer.py b/roborock/devices/traits/v1/valley_electricity_timer.py index 01fa908c..d8e0d65e 100644 --- a/roborock/devices/traits/v1/valley_electricity_timer.py +++ b/roborock/devices/traits/v1/valley_electricity_timer.py @@ -18,7 +18,7 @@ def is_on(self) -> bool: async def set_timer(self, timer: ValleyElectricityTimer) -> None: """Set the Valley Electricity Timer settings of the device.""" - await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_dict()) + await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_list()) async def clear_timer(self) -> None: """Clear the Valley Electricity Timer settings of the device.""" @@ -28,12 +28,7 @@ async def enable(self) -> None: """Enable the Valley Electricity Timer settings of the device.""" await self.rpc_channel.send_command( RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, - params=[ - self.start_hour, - self.start_minute, - self.end_hour, - self.end_minute, - ], + params=self.as_list(), ) async def disable(self) -> None: From ecfe8e10124eaec8492d1848a0c5007658d06db0 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Thu, 13 Nov 2025 22:07:20 -0500 Subject: [PATCH 3/5] Update roborock/devices/traits/v1/do_not_disturb.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- roborock/devices/traits/v1/do_not_disturb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roborock/devices/traits/v1/do_not_disturb.py b/roborock/devices/traits/v1/do_not_disturb.py index 9d9dc30d..ee21c30f 100644 --- a/roborock/devices/traits/v1/do_not_disturb.py +++ b/roborock/devices/traits/v1/do_not_disturb.py @@ -36,5 +36,5 @@ async def enable(self) -> None: ) async def disable(self) -> None: - """Set the Do Not Disturb (DND) timer settings of the device.""" + """Disable the Do Not Disturb (DND) timer settings of the device.""" await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER) From 42d8407d8dba5fd7c62e5085f0dbdec5620a3baf Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 13 Nov 2025 22:14:19 -0500 Subject: [PATCH 4/5] chore: exclude copilot from commitlint --- commitlint.config.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commitlint.config.mjs b/commitlint.config.mjs index 586f4e9f..ad7b85d1 100644 --- a/commitlint.config.mjs +++ b/commitlint.config.mjs @@ -1,6 +1,9 @@ export default { extends: ["@commitlint/config-conventional"], - ignores: [(msg) => /Signed-off-by: dependabot\[bot]/m.test(msg)], + ignores: [ + (msg) => /Signed-off-by: dependabot\[bot]/m.test(msg), + (msg) => /Co-authored-by:.*Copilot/m.test(msg) + ], rules: { // Disable the rule that enforces lowercase in subject "subject-case": [0], // 0 = disable, 1 = warn, 2 = error From 4e603e5e937d57291e03a3f0a51bcf41f26d1fa4 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 13 Nov 2025 22:20:23 -0500 Subject: [PATCH 5/5] chore: fix test --- tests/devices/traits/v1/test_dnd.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/devices/traits/v1/test_dnd.py b/tests/devices/traits/v1/test_dnd.py index 26c7a1e8..834d1a6f 100644 --- a/tests/devices/traits/v1/test_dnd.py +++ b/tests/devices/traits/v1/test_dnd.py @@ -79,13 +79,7 @@ async def test_set_dnd_timer_success( # Verify the RPC call was made correctly with dataclass converted to dict - expected_params = { - "startHour": 22, - "startMinute": 0, - "endHour": 8, - "endMinute": 0, - "enabled": 1, - } + expected_params = [22, 0, 8, 0] mock_rpc_channel.send_command.assert_called_once_with(RoborockCommand.SET_DND_TIMER, params=expected_params)