Skip to content

Conversation

@allenporter
Copy link
Contributor

Remove the need to pass in a home data api by taking all information up
front to create the roborock web API in the device manager creation
interface.

This creates a new Web Api wrapper that will also be used for getting
routine information in a followup PR, which was the initial motivation behind this change.

Overall this will allow additional code simplification in callers when
onboarding the new API, completely removing the need to continue using the Web API directly for devices.

Remove the need to pass in a home data api by taking all information up
 front to create the roborock web API in the device manager creation
interface.

This creates a new Web Api wrapper that will also be used for getting
routine information in a followup PR, which was the initial motivation
behind this change.

Overall this will allow additional code simplification in callers when
onboarding the new API, completely removing the need to continue using
the Web API directly for devices.
Copilot AI review requested due to automatic review settings October 26, 2025 15:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR simplifies device manager creation by consolidating authentication parameters into a UserParams dataclass and creating a new UserWebApiClient wrapper. This removes the need for callers to directly instantiate and manage the home data API, streamlining the initialization flow.

Key Changes:

  • Introduced UserParams dataclass to encapsulate username, user data, and optional base URL
  • Created UserWebApiClient wrapper class to bind API client with user context
  • Replaced create_home_data_api function with internal _create_web_api_wrapper function

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
roborock/web_api.py Added UserWebApiClient wrapper class to bind API client with user authentication context
roborock/devices/device_manager.py Replaced home data API callable pattern with UserWebApiClient, introduced UserParams dataclass, and updated create_device_manager to accept UserParams
roborock/cli.py Updated to use new UserParams interface instead of calling create_home_data_api
tests/devices/test_device_manager.py Refactored tests to use fixtures for mocking home data and updated to work with new UserParams interface

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

allenporter and others added 4 commits October 26, 2025 08:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@allenporter allenporter merged commit 4e7e776 into Python-roborock:main Oct 27, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants