Skip to content

Update cli.py / device_manager.py to use get_home_data_v3 and discovered Roborock Q10 devices #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion roborock/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def _discover(ctx):
if not login_data:
raise Exception("You need to login first")
client = RoborockApiClient(login_data.email)
home_data = await client.get_home_data(login_data.user_data)
home_data = await client.get_home_data_v3(login_data.user_data)
login_data.home_data = home_data
context.update(login_data)
click.echo(f"Discovered devices {', '.join([device.name for device in home_data.get_all_devices()])}")
Expand Down
2 changes: 1 addition & 1 deletion roborock/devices/device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def create_home_data_api(email: str, user_data: UserData) -> HomeDataApi:
client = RoborockApiClient(email)

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

return home_data_api

Expand Down
2 changes: 1 addition & 1 deletion tests/devices/test_device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def home_data_api_exception() -> HomeData:
async def test_create_home_data_api_exception() -> None:
"""Test that exceptions from the home data API are propagated through the wrapper."""

with patch("roborock.devices.device_manager.RoborockApiClient.get_home_data") as mock_get_home_data:
with patch("roborock.devices.device_manager.RoborockApiClient.get_home_data_v3") as mock_get_home_data:
mock_get_home_data.side_effect = RoborockException("Test exception")
api = create_home_data_api(USER_DATA, mock_get_home_data)

Expand Down
Loading