|
4 | 4 | from typing import Any |
5 | 5 |
|
6 | 6 | from roborock import B01Props |
7 | | -from roborock.data.b01_q7.b01_q7_code_mappings import SCWindMapping, WaterLevelMapping |
| 7 | +from roborock.data.b01_q7.b01_q7_code_mappings import ( |
| 8 | + CleanTaskTypeMapping, |
| 9 | + SCDeviceCleanParam, |
| 10 | + SCWindMapping, |
| 11 | + WaterLevelMapping, |
| 12 | +) |
8 | 13 | from roborock.devices.b01_channel import send_decoded_command |
9 | 14 | from roborock.devices.mqtt_channel import MqttChannel |
10 | 15 | from roborock.devices.traits import Trait |
@@ -50,6 +55,63 @@ async def set_water_level(self, water_level: WaterLevelMapping) -> dict[str, Any |
50 | 55 | """Set the water level (water).""" |
51 | 56 | return await self.set_prop(RoborockB01Props.WATER, water_level.code) |
52 | 57 |
|
| 58 | + async def start_clean(self) -> dict[str, Any]: |
| 59 | + """Start cleaning.""" |
| 60 | + return await send_decoded_command( |
| 61 | + self._channel, |
| 62 | + dps=10000, |
| 63 | + command=RoborockB01Q7Methods.SET_ROOM_CLEAN, |
| 64 | + params={ |
| 65 | + "clean_type": CleanTaskTypeMapping.ALL.code, |
| 66 | + "ctrl_value": SCDeviceCleanParam.START.code, |
| 67 | + "room_ids": [], |
| 68 | + }, |
| 69 | + ) |
| 70 | + |
| 71 | + async def pause_clean(self) -> dict[str, Any]: |
| 72 | + """Pause cleaning.""" |
| 73 | + return await send_decoded_command( |
| 74 | + self._channel, |
| 75 | + dps=10000, |
| 76 | + command=RoborockB01Q7Methods.SET_ROOM_CLEAN, |
| 77 | + params={ |
| 78 | + "clean_type": CleanTaskTypeMapping.ALL.code, |
| 79 | + "ctrl_value": SCDeviceCleanParam.PAUSE.code, |
| 80 | + "room_ids": [], |
| 81 | + }, |
| 82 | + ) |
| 83 | + |
| 84 | + async def stop_clean(self) -> dict[str, Any]: |
| 85 | + """Stop cleaning.""" |
| 86 | + return await send_decoded_command( |
| 87 | + self._channel, |
| 88 | + dps=10000, |
| 89 | + command=RoborockB01Q7Methods.SET_ROOM_CLEAN, |
| 90 | + params={ |
| 91 | + "clean_type": CleanTaskTypeMapping.ALL.code, |
| 92 | + "ctrl_value": SCDeviceCleanParam.STOP.code, |
| 93 | + "room_ids": [], |
| 94 | + }, |
| 95 | + ) |
| 96 | + |
| 97 | + async def return_to_dock(self) -> dict[str, Any]: |
| 98 | + """Return to dock.""" |
| 99 | + return await send_decoded_command( |
| 100 | + self._channel, |
| 101 | + dps=10000, |
| 102 | + command=RoborockB01Q7Methods.START_RECHARGE, |
| 103 | + params={}, |
| 104 | + ) |
| 105 | + |
| 106 | + async def find_me(self) -> dict[str, Any]: |
| 107 | + """Locate the robot.""" |
| 108 | + return await send_decoded_command( |
| 109 | + self._channel, |
| 110 | + dps=10000, |
| 111 | + command=RoborockB01Q7Methods.FIND_DEVICE, |
| 112 | + params={}, |
| 113 | + ) |
| 114 | + |
53 | 115 |
|
54 | 116 | def create(channel: MqttChannel) -> Q7PropertiesApi: |
55 | 117 | """Create traits for B01 devices.""" |
|
0 commit comments