Skip to content

Commit b40f3d0

Browse files
committed
fix: Pass through additional fields to the home data fetcher
1 parent 949a076 commit b40f3d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

roborock/devices/device_manager.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import logging
66
from collections.abc import Awaitable, Callable
77

8+
import aiohttp
9+
810
from roborock.code_mappings import RoborockCategory
911
from roborock.containers import (
1012
HomeData,
@@ -113,7 +115,9 @@ async def close(self) -> None:
113115
await asyncio.gather(*tasks)
114116

115117

116-
def create_home_data_api(email: str, user_data: UserData) -> HomeDataApi:
118+
def create_home_data_api(
119+
email: str, user_data: UserData, base_url: str | None = None, session: aiohttp.ClientSession | None = None
120+
) -> HomeDataApi:
117121
"""Create a home data API wrapper.
118122
119123
This function creates a wrapper around the Roborock API client to fetch
@@ -122,7 +126,7 @@ def create_home_data_api(email: str, user_data: UserData) -> HomeDataApi:
122126

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

127131
async def home_data_api() -> HomeData:
128132
return await client.get_home_data_v3(user_data)

0 commit comments

Comments
 (0)