Skip to content

Show configuration_url for gateway only#975

Merged
bouwew merged 6 commits intomainfrom
fix_config_urls
Nov 26, 2025
Merged

Show configuration_url for gateway only#975
bouwew merged 6 commits intomainfrom
fix_config_urls

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Nov 26, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Device configuration URL is shown for the gateway only; non-gateway devices now explicitly omit a configuration link.
  • Documentation
    • Changelog updated with an "Ongoing" entry describing the device info change to configuration URL visibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Warning

Rate limit exceeded

@bouwew has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 116cfee and 3c446bd.

📒 Files selected for processing (1)
  • custom_components/plugwise/entity.py (1 hunks)

Walkthrough

Device entity now imports ATTR_CONFIGURATION_URL and includes ATTR_CONFIGURATION_URL: None in serialized DeviceInfo for non-gateway devices; no other behavior changes.

Changes

Cohort / File(s) Summary
DeviceInfo configuration URL addition
custom_components/plugwise/entity.py
Added import of ATTR_CONFIGURATION_URL and included ATTR_CONFIGURATION_URL: None in serialized DeviceInfo for non-gateway devices.
Changelog update
CHANGELOG.md
Added Ongoing section entry describing DeviceInfo change: show configuration_url on gateway only (PR reference).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Small, localized change in one module and a changelog update.
  • Review attention: ensure the imported constant name is correct and that only non-gateway DeviceInfo entries include ATTR_CONFIGURATION_URL: None.

Poem

🐰 I tuck a tiny flag away,
A quiet key for devices not the gateway,
I write “None” where prompts once stood,
A soft adjustment, small and good,
Then twitch my nose and hop away ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and concisely describes the main change: modifying configuration_url visibility to appear only for gateway devices.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
custom_components/plugwise/entity.py (1)

74-84: Configuration URL only on gateway; consider small refactor to avoid overwrite

The pattern of setting configuration_url for all devices and then overriding it with ATTR_CONFIGURATION_URL: None on non‑gateway devices does achieve the goal of exposing the URL only on the gateway. To make this intent clearer and avoid the extra write, you could compute configuration_url conditionally instead, e.g.:

-        configuration_url: str | None = None
-        if entry := self.coordinator.config_entry:
-            configuration_url = f"http://{entry.data[CONF_HOST]}"
+        configuration_url: str | None = None
+        if (
+            device_id == coordinator.api.gateway_id
+            and (entry := self.coordinator.config_entry)
+        ):
+            configuration_url = f"http://{entry.data[CONF_HOST]}"
@@
-        if device_id != coordinator.api.gateway_id:
-            self._attr_device_info.update(
-                {
-                    ATTR_CONFIGURATION_URL: None,
-                    ATTR_NAME: data.get(ATTR_NAME),
-                    ATTR_VIA_DEVICE: (
-                        DOMAIN,
-                        str(self.coordinator.api.gateway_id),
-                    ),
-                }
-            )
+        if device_id != coordinator.api.gateway_id:
+            self._attr_device_info.update(
+                {
+                    ATTR_NAME: data.get(ATTR_NAME),
+                    ATTR_VIA_DEVICE: (
+                        DOMAIN,
+                        str(self.coordinator.api.gateway_id),
+                    ),
+                }
+            )

Functionally you’re fine as‑is; this is just a clarity/maintenance improvement.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8699e54 and cf67b90.

📒 Files selected for processing (1)
  • custom_components/plugwise/entity.py (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Prepare and validate pre-commit
🔇 Additional comments (1)
custom_components/plugwise/entity.py (1)

55-61: Normalizing MAC addresses before adding to connections

Using format_mac(mac) for both CONNECTION_NETWORK_MAC and CONNECTION_ZIGBEE ensures consistent, normalized identifiers for the device registry and aligns with the PR goal of formatting MACs. This should also help avoid duplicate devices caused by differing MAC formats.

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

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf67b90 and b69c992.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-12T19:48:34.652Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 793
File: custom_components/plugwise/manifest.json:10-11
Timestamp: 2024-12-12T19:48:34.652Z
Learning: In the Plugwise integration, temporary use of alpha versions from test repositories is acceptable for testing purposes.

Applied to files:

  • CHANGELOG.md

@bouwew bouwew marked this pull request as ready for review November 26, 2025 19:21
@bouwew bouwew requested a review from a team as a code owner November 26, 2025 19:21
@bouwew bouwew changed the title Show configuration_url for gateway only, format macs Show configuration_url for gateway only Nov 26, 2025
@sonarqubecloud
Copy link

@bouwew bouwew merged commit 9abb7f1 into main Nov 26, 2025
13 checks passed
@bouwew bouwew deleted the fix_config_urls branch November 27, 2025 07:14
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.

1 participant