Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions roborock/devices/device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import logging
from collections.abc import Awaitable, Callable

import aiohttp

from roborock.code_mappings import RoborockCategory
from roborock.containers import (
HomeData,
Expand Down Expand Up @@ -113,7 +115,9 @@ async def close(self) -> None:
await asyncio.gather(*tasks)


def create_home_data_api(email: str, user_data: UserData) -> HomeDataApi:
def create_home_data_api(
email: str, user_data: UserData, base_url: str | None = None, session: aiohttp.ClientSession | None = None
) -> HomeDataApi:
"""Create a home data API wrapper.

This function creates a wrapper around the Roborock API client to fetch
Expand All @@ -122,7 +126,7 @@ def create_home_data_api(email: str, user_data: UserData) -> HomeDataApi:

# Note: This will auto discover the API base URL. This can be improved
# by caching this next to `UserData` if needed to avoid unnecessary API calls.
client = RoborockApiClient(email)
client = RoborockApiClient(username=email, base_url=base_url, session=session)

async def home_data_api() -> HomeData:
return await client.get_home_data_v3(user_data)
Expand Down