Skip to content

chore: add dataclasses for Roborock mower#862

Merged
allenporter merged 2 commits into
mainfrom
mower_dataclasses
Jul 3, 2026
Merged

chore: add dataclasses for Roborock mower#862
allenporter merged 2 commits into
mainfrom
mower_dataclasses

Conversation

@Lash-L

@Lash-L Lash-L commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Adds some dataclasses for some future work with mowers.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.88889% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
roborock/roborock_message.py 97.22% 1 Missing ⚠️
Files with missing lines Coverage Δ
roborock/data/__init__.py 100.00% <100.00%> (ø)
roborock/data/mower/__init__.py 100.00% <100.00%> (ø)
roborock/data/mower/mower_containers.py 100.00% <100.00%> (ø)
tests/data/test_mower_containers.py 100.00% <100.00%> (ø)
roborock/roborock_message.py 99.59% <97.22%> (-0.41%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds initial mower-specific data modeling support to the roborock.data layer, establishing a protocol enum and a RoborockBase-backed status dataclass with tests to validate serialization and DPS metadata mapping.

Changes:

  • Introduces RoborockMowerDataProtocol enum values for mower DPS and commands.
  • Adds MowerStatus dataclass with DPS metadata for mower status updates.
  • Adds test coverage verifying from_dict() behavior and DPS metadata mapping; re-exports mower models via roborock.data.

Reviewed changes

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

Show a summary per file
File Description
tests/data/test_mower_containers.py Adds unit tests for mower containers (from_dict + DPS metadata expectations).
roborock/roborock_message.py Adds RoborockMowerDataProtocol enum for mower DPS/command identifiers.
roborock/data/mower/mower_containers.py Introduces MowerStatus dataclass with DPS metadata fields.
roborock/data/mower/init.py Exposes mower containers via package-level exports.
roborock/data/init.py Re-exports mower module through roborock.data.

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

Comment thread roborock/roborock_message.py Outdated
Comment thread roborock/data/mower/mower_containers.py Outdated
Comment thread tests/data/test_mower_containers.py Outdated
allenporter
allenporter previously approved these changes Jul 3, 2026

error_code: int | None = field(default=None, metadata={"dps": RoborockMowerDataProtocol.ERROR_CODE})
battery: int | None = field(default=None, metadata={"dps": RoborockMowerDataProtocol.BATTERY})
mow_type: int | None = field(default=None, metadata={"dps": RoborockMowerDataProtocol.MOW_TYPE})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i assume these will be enums in the future

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep! Didn't want to get too carried away in the first PR (trying to keep it semi-manageable especially as I am just going off RR_API code). The ones that make sense to be enums will be enums

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Lash-L

Lash-L commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

Accepted copilots suggestions - need a re-review

@allenporter allenporter merged commit 413d6e5 into main Jul 3, 2026
8 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.

3 participants