roborock.devices.traits.v1.routines
Routines trait for V1 devices.
1"""Routines trait for V1 devices.""" 2 3from roborock.data.containers import HomeDataScene 4from roborock.web_api import UserWebApiClient 5 6 7class RoutinesTrait: 8 """Trait for interacting with routines.""" 9 10 def __init__(self, device_id: str, web_api: UserWebApiClient) -> None: 11 """Initialize the routines trait.""" 12 self._device_id = device_id 13 self._web_api = web_api 14 15 async def get_routines(self) -> list[HomeDataScene]: 16 """Get available routines.""" 17 return await self._web_api.get_routines(self._device_id) 18 19 async def execute_routine(self, routine_id: int) -> None: 20 """Execute a routine by its ID. 21 22 Technically, routines are per-device, but the API does not 23 require the device ID to execute them. This can execute a 24 routine for any device but it is exposed here for convenience. 25 """ 26 await self._web_api.execute_routine(routine_id)
class
RoutinesTrait:
8class RoutinesTrait: 9 """Trait for interacting with routines.""" 10 11 def __init__(self, device_id: str, web_api: UserWebApiClient) -> None: 12 """Initialize the routines trait.""" 13 self._device_id = device_id 14 self._web_api = web_api 15 16 async def get_routines(self) -> list[HomeDataScene]: 17 """Get available routines.""" 18 return await self._web_api.get_routines(self._device_id) 19 20 async def execute_routine(self, routine_id: int) -> None: 21 """Execute a routine by its ID. 22 23 Technically, routines are per-device, but the API does not 24 require the device ID to execute them. This can execute a 25 routine for any device but it is exposed here for convenience. 26 """ 27 await self._web_api.execute_routine(routine_id)
Trait for interacting with routines.
RoutinesTrait(device_id: str, web_api: roborock.web_api.UserWebApiClient)
11 def __init__(self, device_id: str, web_api: UserWebApiClient) -> None: 12 """Initialize the routines trait.""" 13 self._device_id = device_id 14 self._web_api = web_api
Initialize the routines trait.
16 async def get_routines(self) -> list[HomeDataScene]: 17 """Get available routines.""" 18 return await self._web_api.get_routines(self._device_id)
Get available routines.
async def
execute_routine(self, routine_id: int) -> None:
20 async def execute_routine(self, routine_id: int) -> None: 21 """Execute a routine by its ID. 22 23 Technically, routines are per-device, but the API does not 24 require the device ID to execute them. This can execute a 25 routine for any device but it is exposed here for convenience. 26 """ 27 await self._web_api.execute_routine(routine_id)
Execute a routine by its ID.
Technically, routines are per-device, but the API does not require the device ID to execute them. This can execute a routine for any device but it is exposed here for convenience.