Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Jun 22, 2025

This makes the reset energy collection function available to the + devices

Summary by CodeRabbit

  • New Features
    • Added support for the CIRCLE feature to relevant nodes.
  • Tests
    • Updated tests to include verification for the new CIRCLE feature.
  • Chores
    • Bumped version number to 0.44.5.

This makes the reset energy collection function available to the + devices
@coderabbitai
Copy link

coderabbitai bot commented Jun 22, 2025

Walkthrough

The changes introduce a new constant for the Circle Plus node features including NodeFeature.CIRCLE and update the load method to use it. Tests are updated to expect the new feature. The project version is incremented from 0.44.4 to 0.44.5. The changelog is updated with the new release entry.

Changes

File(s) Change Summary
plugwise_usb/nodes/circle_plus.py Added FEATURES_CIRCLE_PLUS tuple including NodeFeature.CIRCLE and used it in load method.
tests/test_usb.py Updated test_node_discovery_and_load to expect NodeFeature.CIRCLE in node features.
pyproject.toml Bumped project version from 0.44.4 to 0.44.5.
CHANGELOG.md Added changelog entry for version 0.44.5 with PR #274 and updated release date for 0.44.4.

Suggested reviewers

  • dirixmjm

Poem

A Circle Plus hops in the code,
With features new, its power showed.
The version climbs, the tests agree,
More complete the node shall be!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Pylint (3.3.7)
plugwise_usb/nodes/circle_plus.py

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c1e79b and cc30f22.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • plugwise_usb/nodes/circle_plus.py (3 hunks)
  • pyproject.toml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • pyproject.toml
  • plugwise_usb/nodes/circle_plus.py
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Check commit
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix_plus_energy_reset

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this 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 or @coderabbitai title 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.

@codecov
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.80%. Comparing base (ccc3a26) to head (cc30f22).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
plugwise_usb/nodes/circle_plus.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #274   +/-   ##
=======================================
  Coverage   80.79%   80.80%           
=======================================
  Files          36       36           
  Lines        7588     7589    +1     
=======================================
+ Hits         6131     6132    +1     
  Misses       1457     1457           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@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

🧹 Nitpick comments (2)
pyproject.toml (1)

7-7: Bump version to reflect pre-release
The project version has been updated to 0.44.5a0 to capture this new feature rollout. Consider adding or updating a changelog entry so users know that Circle reset energy collection is now available on “+” devices.

plugwise_usb/nodes/circle_plus.py (1)

34-44: Add CIRCLE feature in cache-load path
You've correctly inserted NodeFeature.CIRCLE into the _setup_protocol call when loading from cache. To avoid this list diverging in the future, you may want to extract it into a single constant.

Proposed diff:

+FEATURES_CIRCLE_PLUS = (
+    NodeFeature.RELAY,
+    NodeFeature.RELAY_INIT,
+    NodeFeature.RELAY_LOCK,
+    NodeFeature.ENERGY,
+    NodeFeature.POWER,
+    NodeFeature.CIRCLE,
+    NodeFeature.CIRCLEPLUS,
+)
 
 _setup_protocol(
     CIRCLE_PLUS_FIRMWARE_SUPPORT,
-    (
-        NodeFeature.RELAY,
-        NodeFeature.RELAY_INIT,
-        NodeFeature.RELAY_LOCK,
-        NodeFeature.ENERGY,
-        NodeFeature.POWER,
-        NodeFeature.CIRCLE,
-        NodeFeature.CIRCLEPLUS,
-    ),
+    FEATURES_CIRCLE_PLUS,
 )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccc3a26 and 3c1e79b.

📒 Files selected for processing (3)
  • plugwise_usb/nodes/circle_plus.py (2 hunks)
  • pyproject.toml (1 hunks)
  • tests/test_usb.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Process test coverage
🔇 Additional comments (2)
plugwise_usb/nodes/circle_plus.py (1)

72-82: ```shell
#!/bin/bash

Check for node classes using NodeFeature without CIRCLE

for f in plugwise_usb/nodes/*.py; do
if grep -q "NodeFeature." "$f"; then
if ! grep -q "NodeFeature.CIRCLE" "$f"; then
echo "$f missing NodeFeature.CIRCLE"
fi
fi
done


</details>
<details>
<summary>tests/test_usb.py (1)</summary>

`2486-2488`: **Include CIRCLE feature for Circle+ INFO features**  
The test now correctly asserts that `NodeFeature.CIRCLE` is included alongside `CIRCLEPLUS` in the INFO feature set for Circle+ nodes, matching the updated support in `PlugwiseCirclePlus`.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@bouwew bouwew marked this pull request as ready for review June 22, 2025 10:53
@bouwew bouwew requested a review from a team as a code owner June 22, 2025 10:53
Copy link
Contributor

@dirixmjm dirixmjm left a comment

Choose a reason for hiding this comment

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

The circleplus is an extension of a circle (inherited class). Ideally the initalisation calls back tot the super() which setups the circle features, then the circleplus only needs to add the extension to the feature.

@bouwew
Copy link
Contributor Author

bouwew commented Jun 22, 2025

@dirixmjm do you mind if we postpone such a change to a follow-up PR?

@dirixmjm
Copy link
Contributor

Ok, fair enough

@dirixmjm dirixmjm closed this Jun 22, 2025
@dirixmjm dirixmjm reopened this Jun 22, 2025
@sonarqubecloud
Copy link

@dirixmjm dirixmjm self-requested a review June 22, 2025 11:19
@bouwew bouwew merged commit 557fdf4 into main Jun 22, 2025
18 of 20 checks passed
@bouwew bouwew deleted the fix_plus_energy_reset branch June 22, 2025 11:49
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