-
Notifications
You must be signed in to change notification settings - Fork 2
Implement button in CirclePlus Device page to enable Auto-Joining #261
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
Conversation
WalkthroughA 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
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
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🪛 LanguageToolCHANGELOG.md[uncategorized] ~8-~8: It appears that a hyphen is missing (if ‘auto’ is not used in the context of ‘cars’). (AUTO_HYPHEN) 🔇 Additional comments (1)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
for more information, see https://pre-commit.ci
There was a problem hiding this 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 consistencyThe integration already exposes a service named
enable_auto_joining(lines 26-29). Using “Enable Auto Join” here introduces a slight terminology mismatch (auto-joinvsauto-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 changeIf 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_ducshadowingself.node_duc
PlugwiseUSBEntityalready definesself.node_duc; introducing_node_ducduplicates 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 stateHard-coding
available = Trueignores 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=Trueis unnecessary for stateless buttonsButtons 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_UPDATESandSCAN_INTERVALaren’t referenced in this file. Consider deleting them to avoid dead code.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 incustom_components/plugwise_usb/manifest.jsonand 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-usbrequirement has been updated to0.44.3and the integration version to0.54.2, matching the project version inpyproject.toml. This aligns correctly with the new button feature additions.custom_components/plugwise_usb/translations/en.json (1)
193-198: Confirm translation key coverage instrings.json.A new
"enable_auto_join"entry was added under"entity" -> "button". Please verify that the same key and display name exist incustom_components/plugwise_usb/strings.jsonso the entity translations resolve correctly.custom_components/plugwise_usb/const.py (1)
30-30: Approve adding Button to supported platforms.Including
Platform.BUTTONinPLUGWISE_USB_PLATFORMSproperly enables the new button entity integration. No further changes needed here.custom_components/plugwise_usb/button.py (1)
37-44: Verify thatNodeFeature.CIRCLEPLUSactually exists
BUTTON_TYPESfilters onNodeFeature.CIRCLEPLUS, yet in the Plugwise-USB library “CirclePlus” is generally a node type rather than a feature.
If the constant doesn’t exist (ornode.node_info.featuresnever 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.
There was a problem hiding this 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 yourbutton.pyimplementation. 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
📒 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_joinblock is correctly inserted under"entity", follows the existing JSON structure, and the display name aligns with the PR objective.
|
| async def async_added_to_hass(self): | ||
| """Subscribe for push updates.""" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.



Summary by CodeRabbit