Skip to content

Conversation

@dirixmjm
Copy link
Contributor

@dirixmjm dirixmjm commented Jun 13, 2025

Summary by CodeRabbit

  • New Features
    • Added a button to enable auto joining directly from the CirclePlus device page in the Plugwise USB integration.
  • Localization
    • Introduced new English and Dutch translations for the "Enable Auto-joining (temporarily)" button.
  • Chores
    • Updated the Plugwise USB integration and dependency versions.
    • Added documentation for the new features in the changelog.
  • Bug Fixes
    • Removed the deprecated auto-joining service and related functionality from the Plugwise USB integration.

@dirixmjm dirixmjm requested a review from a team as a code owner June 13, 2025 11:30
@coderabbitai
Copy link

coderabbitai bot commented Jun 13, 2025

Walkthrough

A new button entity for enabling auto join on Plugwise CirclePlus devices was introduced in the HomeAssistant Plugwise USB integration. This includes implementation, localization, and translation updates, as well as dependency and version bumps in relevant files and documentation.

Changes

Files/Group Change Summary
custom_components/plugwise_usb/button.py Added new button entity implementation for enabling auto join on CirclePlus devices.
custom_components/plugwise_usb/const.py Added Platform.BUTTON to supported platforms; removed SERVICE_AUTO_JOIN constant.
custom_components/plugwise_usb/__init__.py, custom_components/plugwise_usb/services.yaml Removed the enable_auto_joining service handler and service registration.
custom_components/plugwise_usb/manifest.json, pyproject.toml Bumped integration and dependency versions to 0.54.2 and plugwise-usb to 0.44.3.
custom_components/plugwise_usb/strings.json Removed service localization for auto joining; added button entity localization for "Enable Auto-joining".
custom_components/plugwise_usb/translations/en.json Removed English service translation; added button entity translation for "Enable Auto-joining".
custom_components/plugwise_usb/translations/nl.json Removed Dutch service translation; added button entity translation for "Enable Auto-joining".
CHANGELOG.md Documented the new button feature and dependency update for version 0.54.2.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomeAssistant
    participant PlugwiseUSB Integration
    participant CirclePlus Node

    User->>HomeAssistant: Press "Enable Auto Join" button
    HomeAssistant->>PlugwiseUSB Integration: Handle button press event
    PlugwiseUSB Integration->>CirclePlus Node: Call enable_auto_join()
    CirclePlus Node-->>PlugwiseUSB Integration: Auto join enabled
    PlugwiseUSB Integration-->>HomeAssistant: Update entity state
Loading

Possibly related PRs

  • Merge latest updates into ASYNC-branch #237: This PR removes the enable_auto_joining service and replaces it with a button entity for enabling auto-joining, modifying overlapping code areas in __init__.py and service definitions related to the auto-joining feature.

Suggested reviewers

  • ArnoutD

Poem

A button appears, new and bright,
To help your CirclePlus take flight.
With auto join just one click away,
Devices gather—no delay!
In English or Dutch, the feature’s in tune,
Plugwise grows smarter, under the June moon.
🐇✨


📜 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 0bcc192 and 82fb6d3.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md

[uncategorized] ~8-~8: It appears that a hyphen is missing (if ‘auto’ is not used in the context of ‘cars’).
Context: ...g/v0.44.3) - Implement button to enable auto joining through CirclePlus device page ### v0....

(AUTO_HYPHEN)

🔇 Additional comments (1)
CHANGELOG.md (1)

7-7: Version bump entry looks correct.
The plugwise upgrade text matches the linked release v0.44.3 as intended.


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 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

@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

🧹 Nitpick comments (6)
custom_components/plugwise_usb/strings.json (1)

194-197: Align wording with existing service for UI consistency

The integration already exposes a service named enable_auto_joining (lines 26-29). Using “Enable Auto Join” here introduces a slight terminology mismatch (auto-join vs auto-joining). Harmonising the wording (e.g. “Enable Auto-joining”) keeps the UI consistent across services and entities.

custom_components/plugwise_usb/translations/nl.json (1)

194-197: Keep Dutch translation in sync with any English wording change

If the English label is updated for consistency (see previous comment), mirror the change here to avoid a drift between languages.

custom_components/plugwise_usb/button.py (4)

99-110: Redundant _node_duc shadowing self.node_duc

PlugwiseUSBEntity already defines self.node_duc; introducing _node_duc duplicates the reference and can be confusing. The object isn’t used elsewhere in the class, so the extra attribute can be removed.

-        self._node_duc = node_duc

111-114: Return real availability to reflect device state

Hard-coding available = True ignores stick/node connectivity and defeats front-end expectations (e.g. greying out unavailable entities). Instead, delegate to the base implementation:

-        return True
+        return super().available

54-70: update_before_add=True is unnecessary for stateless buttons

Buttons don’t expose state, so forcing an immediate coordinator refresh on creation adds superfluous I/O. Dropping the flag speeds up startup:

-            async_add_entities(entities, update_before_add=True)
+            async_add_entities(entities)

23-25: Unused constants can be removed

PARALLEL_UPDATES and SCAN_INTERVAL aren’t referenced in this file. Consider deleting them to avoid dead code.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 23b679a and bacf0ca.

📒 Files selected for processing (8)
  • CHANGELOG.md (1 hunks)
  • custom_components/plugwise_usb/button.py (1 hunks)
  • custom_components/plugwise_usb/const.py (1 hunks)
  • custom_components/plugwise_usb/manifest.json (1 hunks)
  • custom_components/plugwise_usb/strings.json (1 hunks)
  • custom_components/plugwise_usb/translations/en.json (1 hunks)
  • custom_components/plugwise_usb/translations/nl.json (1 hunks)
  • pyproject.toml (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
custom_components/plugwise_usb/button.py (2)
custom_components/plugwise_usb/coordinator.py (1)
  • PlugwiseUSBDataUpdateCoordinator (25-87)
custom_components/plugwise_usb/entity.py (2)
  • PlugwiseUSBEntity (28-105)
  • PlugwiseUSBEntityDescription (22-25)
🪛 LanguageTool
CHANGELOG.md

[uncategorized] ~8-~8: It appears that a hyphen is missing (if ‘auto’ is not used in the context of ‘cars’).
Context: ...g/v0.44.3) - Implement button to enable auto joining through CirclePlus device page ### v0....

(AUTO_HYPHEN)

🔇 Additional comments (5)
pyproject.toml (1)

3-3: Verify version bump consistency across the project.

The project version was bumped to 0.54.2. Please ensure this aligns with the version in custom_components/plugwise_usb/manifest.json and any relevant documentation or CI pipelines that reference the version.

custom_components/plugwise_usb/manifest.json (1)

11-12: Approve dependency and integration version bump.

The plugwise-usb requirement has been updated to 0.44.3 and the integration version to 0.54.2, matching the project version in pyproject.toml. This aligns correctly with the new button feature additions.

custom_components/plugwise_usb/translations/en.json (1)

193-198: Confirm translation key coverage in strings.json.

A new "enable_auto_join" entry was added under "entity" -> "button". Please verify that the same key and display name exist in custom_components/plugwise_usb/strings.json so the entity translations resolve correctly.

custom_components/plugwise_usb/const.py (1)

30-30: Approve adding Button to supported platforms.

Including Platform.BUTTON in PLUGWISE_USB_PLATFORMS properly enables the new button entity integration. No further changes needed here.

custom_components/plugwise_usb/button.py (1)

37-44: Verify that NodeFeature.CIRCLEPLUS actually exists

BUTTON_TYPES filters on NodeFeature.CIRCLEPLUS, yet in the Plugwise-USB library “CirclePlus” is generally a node type rather than a feature.
If the constant doesn’t exist (or node.node_info.features never contains it), the button will never be created.

-from plugwise_usb.api import NodeEvent, NodeFeature
+from plugwise_usb.api import NodeEvent, NodeFeature, NodeType
 ...
-        node_feature=NodeFeature.CIRCLEPLUS,
+        node_feature=NodeType.CIRCLEPLUS,

Please double-check the upstream enum and adjust accordingly.

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 (1)
custom_components/plugwise_usb/strings.json (1)

189-194: Verify new button localization entry and naming consistency.

Ensure that the key "enable_auto_join" exactly matches the entity ID used in your button.py implementation. Also, confirm that this entry is added to all other locale files (e.g., strings_de.json, strings_fr.json, etc.) to keep translations in sync. If you’d like a tooltip or help text for this button in the UI, consider adding a "description" field here as well.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bacf0ca and 7a234ce.

📒 Files selected for processing (7)
  • custom_components/plugwise_usb/__init__.py (0 hunks)
  • custom_components/plugwise_usb/button.py (1 hunks)
  • custom_components/plugwise_usb/const.py (1 hunks)
  • custom_components/plugwise_usb/services.yaml (0 hunks)
  • custom_components/plugwise_usb/strings.json (1 hunks)
  • custom_components/plugwise_usb/translations/en.json (1 hunks)
  • custom_components/plugwise_usb/translations/nl.json (1 hunks)
💤 Files with no reviewable changes (2)
  • custom_components/plugwise_usb/services.yaml
  • custom_components/plugwise_usb/init.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • custom_components/plugwise_usb/const.py
  • custom_components/plugwise_usb/translations/nl.json
  • custom_components/plugwise_usb/button.py
🔇 Additional comments (1)
custom_components/plugwise_usb/translations/en.json (1)

189-194: Approve new button translation entry.

The entity.button.enable_auto_join block is correctly inserted under "entity", follows the existing JSON structure, and the display name aligns with the PR objective.

@sonarqubecloud
Copy link

Comment on lines +114 to +115
async def async_added_to_hass(self):
"""Subscribe for push updates."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be removed, there's the same function in entity.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As mentioned on discord, the overload is required to prevent the execution of the function in entity.py as it breaks functioning of the circle+ as soon as the button is loaded.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah Ok, now I finally understand this, sorry.

@dirixmjm dirixmjm merged commit 2cf4c0b into main Jun 16, 2025
9 checks passed
@bouwew bouwew deleted the cpaj branch June 16, 2025 07:13
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