Skip to content
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

Add Support for Deebot N8+ #628

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Add Support for Deebot N8+ #628

merged 2 commits into from
Dec 6, 2024

Conversation

brendanm720
Copy link
Contributor

@brendanm720 brendanm720 commented Dec 6, 2024

Good Evening!

Trying this again!

Please merge this file to add support for the Deebot N8+. I have tested this with my Deebot N8+ install and it seems to be working as expected.

Thank you.

Summary by CodeRabbit

  • New Features
    • Introduced comprehensive capabilities for the DEEBOT N8+ robot vacuum, including battery status retrieval, cleaning actions, and preference settings.
    • Added support for advanced features like continuous cleaning, fan speed adjustments, and map management.
    • Implemented error handling mechanisms to enhance user feedback and interaction.
    • Included the DEEBOT N8+ in the device test suite to ensure proper functionality and model loading.

Copy link
Contributor

coderabbitai bot commented Dec 6, 2024

Walkthrough

The changes involve the introduction of a new file, 7bryc5.py, which defines the capabilities of the DEEBOT N8+ robot vacuum. This file includes a StaticDeviceInfo object registered in the DEVICES dictionary, encapsulating functionalities such as battery status retrieval, cleaning commands, and error handling. It organizes capabilities into structured events and commands, supporting advanced features like continuous cleaning and fan speed adjustments.

Changes

File Path Change Summary
deebot_client/hardware/deebot/7bryc5.py New file added with StaticDeviceInfo registration and comprehensive capabilities for DEEBOT N8+.
tests/hardware/test_init.py Updated tests to include the new device identifier "7bryc5" in the test_all_models_loaded function. No changes to logic in other tests.

Possibly related PRs

  • Add support for Deebot N8 #613: This PR adds support for the Deebot N8, which is closely related to the DEEBOT N8+ introduced in the main PR, as both pertain to the same product line and share similar functionalities.
  • Add support for Deebot N8 Pro+ #617: This PR introduces support for the Deebot N8 Pro+, which is another variant in the N8 series, indicating a direct relationship to the DEEBOT N8+ capabilities.
  • Add support for Deebot N8 Pro+ Black #619: This PR focuses on the Deebot N8 Pro+ Black, a specific model variant that also relates to the DEEBOT N8+ functionalities, emphasizing the need for tailored support for different versions within the same series.

🐇 In the world of clean and bright,
The DEEBOT N8+ takes flight.
With commands and features galore,
It sweeps and cleans forevermore.
A rabbit's cheer, a joyful hop,
For every corner, it won't stop! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
deebot_client/hardware/deebot/7bryc5.py (1)

106-110: Consider refactoring repeated CapabilitySetEnable definitions to reduce code duplication

Multiple CapabilitySetEnable instances with similar structure are defined for capabilities such as continuous, preference, multi_state, advanced_mode, carpet_auto_fan_boost, and true_detect. Refactoring to use a helper function or a factory method could improve maintainability by reducing code duplication and enhancing readability.

Also applies to: 113-115, 156-158, 167-169, 170-174, 175-177

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 987cc64 and 3d4f5b5.

📒 Files selected for processing (1)
  • deebot_client/hardware/deebot/7bryc5.py (1 hunks)
🔇 Additional comments (1)
deebot_client/hardware/deebot/7bryc5.py (1)

95-198: LGTM!

The capabilities for the DEEBOT N8+ are correctly defined, and the code aligns with the existing codebase structure.

@brendanm720 brendanm720 mentioned this pull request Dec 6, 2024
4 tasks
@edenhaus edenhaus added pr: enhancement PR with Improve something pr: new-feature PR, which adds a new feature and removed pr: enhancement PR with Improve something labels Dec 6, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3d4f5b5 and 25b1d65.

📒 Files selected for processing (1)
  • tests/hardware/test_init.py (1 hunks)
🔇 Additional comments (2)
tests/hardware/test_init.py (2)

261-261: LGTM on adding the N8+ device identifier.

The device identifier "7bryc5" has been correctly added to the list of supported devices.


261-261: Verify N8+ capabilities implementation.

Let's verify that the N8+ capabilities are properly implemented in the codebase.

✅ Verification successful

Let me gather more information about the N8+ capabilities implementation.


N8+ capabilities are properly implemented

The implementation in deebot_client/hardware/deebot/7bryc5.py shows a complete and comprehensive implementation of N8+ capabilities including:

  • All core vacuum functionalities (clean, charge, fan speed)
  • Advanced features (true detect, carpet auto fan boost)
  • Map management capabilities
  • Life span monitoring for components
  • Water system controls
  • Statistics and state monitoring
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify N8+ capabilities implementation

# Check if the device file exists
echo "Checking for N8+ device file..."
fd "7bryc5.py$"

# Check capabilities implementation
echo "Checking N8+ capabilities implementation..."
rg -A 10 "7bryc5" . --type py

# Look for any TODO or FIXME comments in the N8+ implementation
echo "Checking for TODO/FIXME comments..."
rg "TODO|FIXME" . --type py

Length of output: 1417


Script:

#!/bin/bash
# Check the implementation details in the 7bryc5.py file
echo "Checking N8+ implementation details..."
cat deebot_client/hardware/deebot/7bryc5.py

# Check for any references to N8+ capabilities
echo "Checking for N8+ capability references..."
rg -i "n8\+" . --type py

# Check for capability-related code patterns
echo "Checking capability patterns..."
ast-grep --pattern 'class $_ {
  $$$
  capabilities($$$) {
    $$$
  }
  $$$
}'

Length of output: 7522

@@ -258,6 +258,7 @@ def test_all_models_loaded() -> None:
"5xu9h3",
"626v6g",
"77atlz",
"7bryc5",
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add test coverage for N8+ specific capabilities.

While the device identifier has been added, there's no test coverage for the N8+ specific capabilities in the test_capabilities_event_extraction function. Please add a test case for the "7bryc5" device to verify its capabilities and commands.

Example addition to the test_capabilities_event_extraction parametrize:

(
    "7bryc5",
    {
        # Add expected events and commands specific to N8+
        # Example (adjust based on actual capabilities):
        AvailabilityEvent: [GetBattery(is_available_check=True)],
        BatteryEvent: [GetBattery()],
        # ... other capabilities
    },
)

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.55%. Comparing base (987cc64) to head (25b1d65).
Report is 3 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #628      +/-   ##
==========================================
+ Coverage   86.42%   86.55%   +0.13%     
==========================================
  Files          88       89       +1     
  Lines        3301     3333      +32     
  Branches      298      298              
==========================================
+ Hits         2853     2885      +32     
  Misses        394      394              
  Partials       54       54              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

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

Thanks @brendanm720 👍

@edenhaus edenhaus merged commit 5f811d7 into DeebotUniverse:dev Dec 6, 2024
8 of 9 checks passed
@Qbertx78
Copy link

Qbertx78 commented Dec 6, 2024

Hi everyone, I really appreciate your efforts to get our Deebots working with HA again. However, could you provide a unique procedure (the simplest possible) to understand, even for dumb users like me, how to fix these files?

@FelixHutnyk
Copy link

FelixHutnyk commented Dec 7, 2024

Just updated to the latest released which included this yet still running into:

[homeassistant.components.ecovacs.controller] Device "DEEBOT N8+" not supported. More information at https://github.com/DeebotUniverse/client.py/issues/612: {'class': 'b2jqs4', 'company': 'eco-ng', 'did': 'f44bdd3f-0fd0-45b2-9f1e-703df650e312', 'name': 'E08642549C09HJZY0482', 'nick': '', 'resource': 'tshV', 'mqtt_connection': True, 'xmpp_connection': False, 'UILogicId': 'N8_PLUS', 'ota': True, 'icon': 'https://portal-ww.ecouser.net/api/pim/file/get/5feaeb27d4cb3a0006679047', 'model': 'N8_PLUS_BLACK', 'pip': '5fbc7cc69601440008b24469', 'deviceName': 'DEEBOT N8+', 'materialNo': '110-2029-0002', 'product_category': 'DEEBOT', 'status': 1}

N8+ should be working with this?

@brendanm720
Copy link
Contributor Author

Just updated to the latest released which included this yet still running into:

[homeassistant.components.ecovacs.controller] Device "DEEBOT N8+" not supported. More information at https://github.com/DeebotUniverse/client.py/issues/612: {'class': 'b2jqs4', 'company': 'eco-ng', 'did': 'f44bdd3f-0fd0-45b2-9f1e-703df650e312', 'name': 'E08642549C09HJZY0482', 'nick': '', 'resource': 'tshV', 'mqtt_connection': True, 'xmpp_connection': False, 'UILogicId': 'N8_PLUS', 'ota': True, 'icon': 'https://portal-ww.ecouser.net/api/pim/file/get/5feaeb27d4cb3a0006679047', 'model': 'N8_PLUS_BLACK', 'pip': '5fbc7cc69601440008b24469', 'deviceName': 'DEEBOT N8+', 'materialNo': '110-2029-0002', 'product_category': 'DEEBOT', 'status': 1}

N8+ should be working with this?

it looks like the class id for the "black" version is different from the "white" version even though electronically they're the same thing.

I will submit another PR for the black version for you.

@FelixHutnyk
Copy link

Amazing

Thank you so much!

Just updated to the latest released which included this yet still running into:

[homeassistant.components.ecovacs.controller] Device "DEEBOT N8+" not supported. More information at https://github.com/DeebotUniverse/client.py/issues/612: {'class': 'b2jqs4', 'company': 'eco-ng', 'did': 'f44bdd3f-0fd0-45b2-9f1e-703df650e312', 'name': 'E08642549C09HJZY0482', 'nick': '', 'resource': 'tshV', 'mqtt_connection': True, 'xmpp_connection': False, 'UILogicId': 'N8_PLUS', 'ota': True, 'icon': 'https://portal-ww.ecouser.net/api/pim/file/get/5feaeb27d4cb3a0006679047', 'model': 'N8_PLUS_BLACK', 'pip': '5fbc7cc69601440008b24469', 'deviceName': 'DEEBOT N8+', 'materialNo': '110-2029-0002', 'product_category': 'DEEBOT', 'status': 1}

N8+ should be working with this?

it looks like the class id for the "black" version is different from the "white" version even though electronically they're the same thing.

I will submit another PR for the black version for you.

@coderabbitai coderabbitai bot mentioned this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new-feature PR, which adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants