Skip to content

Commit 9aa448a

Browse files
committed
chore: switch to as_list
1 parent 9570467 commit 9aa448a

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

roborock/data/containers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ def end_time(self) -> datetime.time | None:
140140
else None
141141
)
142142

143+
def as_list(self) -> list:
144+
return [self.start_hour, self.start_minute, self.end_hour, self.end_minute]
145+
143146
def __repr__(self) -> str:
144147
return _attr_repr(self)
145148

roborock/devices/traits/v1/do_not_disturb.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def is_on(self) -> bool:
1717

1818
async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None:
1919
"""Set the Do Not Disturb (DND) timer settings of the device."""
20-
await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_dict())
20+
await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list())
2121

2222
async def clear_dnd_timer(self) -> None:
2323
"""Clear the Do Not Disturb (DND) timer settings of the device."""
@@ -27,12 +27,7 @@ async def enable(self) -> None:
2727
"""Set the Do Not Disturb (DND) timer settings of the device."""
2828
await self.rpc_channel.send_command(
2929
RoborockCommand.SET_DND_TIMER,
30-
params=[
31-
self.start_hour,
32-
self.start_minute,
33-
self.end_hour,
34-
self.end_minute,
35-
],
30+
params=self.as_list(),
3631
)
3732

3833
async def disable(self) -> None:

roborock/devices/traits/v1/valley_electricity_timer.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def is_on(self) -> bool:
1818

1919
async def set_timer(self, timer: ValleyElectricityTimer) -> None:
2020
"""Set the Valley Electricity Timer settings of the device."""
21-
await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_dict())
21+
await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_list())
2222

2323
async def clear_timer(self) -> None:
2424
"""Clear the Valley Electricity Timer settings of the device."""
@@ -28,12 +28,7 @@ async def enable(self) -> None:
2828
"""Enable the Valley Electricity Timer settings of the device."""
2929
await self.rpc_channel.send_command(
3030
RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER,
31-
params=[
32-
self.start_hour,
33-
self.start_minute,
34-
self.end_hour,
35-
self.end_minute,
36-
],
31+
params=self.as_list(),
3732
)
3833

3934
async def disable(self) -> None:

0 commit comments

Comments
 (0)