Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 8 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR upgrades the project to Python 3.14, migrates from pre-commit to prek tooling, replaces markdownlint with pymarkdown, removes unused imports across components, updates GitHub Actions workflows, expands translation entries, and reorganizes the CI testing script. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/test.yml (1)
80-83:⚠️ Potential issue | 🟡 MinorOrphaned
PRE_COMMIT_HOMEreference - will resolve to empty string.The
PRE_COMMIT_HOMEenvironment variable was removed from the workflowenvblock, but line 83 still references${{ env.PRE_COMMIT_HOME }}. This will pass an empty string to the action, which may cause unexpected behavior or be silently ignored.Either remove this parameter or restore the environment variable if it's still needed for the
ha-core-releasejob.🐛 Suggested fix: Remove orphaned parameter
- name: Restore cached environment id: cache-reuse uses: plugwise/gh-actions/restore-venv@v2 with: cache-key: ${{ needs.cache.outputs.cache-key }} python-version: ${{ needs.cache.outputs.python-version }} venv-dir: ${{ env.VENV }} - precommit-home: ${{ env.PRE_COMMIT_HOME }}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/test.yml around lines 80 - 83, The workflow references an orphaned env variable PRE_COMMIT_HOME in the ha-core-release job inputs (the line setting precommit-home: ${{ env.PRE_COMMIT_HOME }}), but PRE_COMMIT_HOME was removed from the workflow env block; either restore PRE_COMMIT_HOME in the job/env or remove this parameter. Fix by editing the ha-core-release job step that uses precommit-home and either (A) add PRE_COMMIT_HOME back to the workflow env with the intended value, or (B) delete the precommit-home: ${{ env.PRE_COMMIT_HOME }} line so the action no longer receives an empty string. Ensure any dependent steps that expect PRE_COMMIT_HOME are updated accordingly.
🧹 Nitpick comments (3)
custom_components/plugwise_usb/translations/en.json (1)
227-241: Polish service description casing/grammar for user-facing text.Line 227 and Line 237 use “mac”/“Node” casing that reads inconsistent in UI strings. Recommend normalizing to “MAC” and “node”.
✏️ Suggested text cleanup
- "description": "Enter the mac of the Node: (data = mac: 0123456789ABCDEF)", + "description": "Enter the MAC of the node: (data = mac: 0123456789ABCDEF)", ... - "description": "Enter the mac of the Node: (data = mac: 0123456789ABCDEF)", + "description": "Enter the MAC of the node: (data = mac: 0123456789ABCDEF)",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@custom_components/plugwise_usb/translations/en.json` around lines 227 - 241, Update the user-facing description strings for the services that reference the device identifier: edit the "description" values in the blocks for the disable_production and enable_production entries (the strings currently containing "mac" and "Node") to use consistent casing—replace "mac" with "MAC" and "Node" with "node" (keep the data example format intact, e.g., "data = mac: 0123456789ABCDEF" -> "data = MAC: 0123456789ABCDEF"); also ensure the field description for the "mac" field remains "The full 16 character MAC address of the plugwise device" (no change needed) so the UI displays "MAC" and "node" consistently..pre-commit-config.yaml (1)
23-28: Consider updating pyupgrade target version to match Python minimum.The
pyupgradehook is configured with--py39-plus, but the project now requires Python 3.14+. Consider updating to--py314-plus(or the closest available option) to catch more upgrade opportunities.♻️ Suggested update
- id: pyupgrade name: "Checking pyupgrade" - args: [--py39-plus] + args: [--py314-plus]Note: Verify that pyupgrade supports
--py314-plusflag first.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.pre-commit-config.yaml around lines 23 - 28, Update the pyupgrade hook configuration: locate the pyupgrade hook block (repo: https://github.com/asottile/pyupgrade, id: pyupgrade) and replace the args entry that currently uses "--py39-plus" with the appropriate newer target (e.g., "--py314-plus" or the closest supported flag) so the hook matches the project's Python minimum; verify pyupgrade supports the chosen flag and adjust the args accordingly.scripts/ci-core-testing.sh (1)
84-86: Use[[instead of[for conditional tests.The
[[construct is safer and more feature-rich in bash, avoiding word splitting and pathname expansion issues.♻️ Suggested fix
-if ! [ -x "$(command -v prek)" ]; then +if ! [[ -x "$(command -v prek)" ]]; then uv pip install prek fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/ci-core-testing.sh` around lines 84 - 86, Replace the POSIX-style test using [ with bash's safer [[ in the conditional that checks for the prek command; specifically update the if statement that currently reads if ! [ -x "$(command -v prek)" ]; then to use if ! [[ -x "$(command -v prek)" ]]; then so the test uses [[ ... ]], preserving the existing command substitution and negation around command -v prek and leaving the subsequent uv pip install prek and fi unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/validate.yaml:
- Around line 16-19: The workflow uses the HACS action pinned to the branch
"hacs/action@main"; replace that with a specific release tag to avoid
supply-chain and reproducibility risks by changing the uses value in the job
from "hacs/action@main" to a specific version tag (for example
"hacs/action@vX.Y.Z" or the latest stable tag) so the job references an
immutable release instead of a moving branch.
In `@scripts/ci-core-testing.sh`:
- Around line 185-188: Update the conditional that checks for pytest to use the
bash [[ ... ]] test and correct the misleading echo message: replace the current
if ! [ -x "$(command -v pytest)" ]; then with if ! [[ -x "$(command -v pytest)"
]]; then and change the echo text from "Ensure uv presence" to "Ensure pytest
presence"; keep the subsequent install invocation (uv pip install pytest) as-is
unless you also want to change the installer command separately.
---
Outside diff comments:
In @.github/workflows/test.yml:
- Around line 80-83: The workflow references an orphaned env variable
PRE_COMMIT_HOME in the ha-core-release job inputs (the line setting
precommit-home: ${{ env.PRE_COMMIT_HOME }}), but PRE_COMMIT_HOME was removed
from the workflow env block; either restore PRE_COMMIT_HOME in the job/env or
remove this parameter. Fix by editing the ha-core-release job step that uses
precommit-home and either (A) add PRE_COMMIT_HOME back to the workflow env with
the intended value, or (B) delete the precommit-home: ${{ env.PRE_COMMIT_HOME }}
line so the action no longer receives an empty string. Ensure any dependent
steps that expect PRE_COMMIT_HOME are updated accordingly.
---
Nitpick comments:
In @.pre-commit-config.yaml:
- Around line 23-28: Update the pyupgrade hook configuration: locate the
pyupgrade hook block (repo: https://github.com/asottile/pyupgrade, id:
pyupgrade) and replace the args entry that currently uses "--py39-plus" with the
appropriate newer target (e.g., "--py314-plus" or the closest supported flag) so
the hook matches the project's Python minimum; verify pyupgrade supports the
chosen flag and adjust the args accordingly.
In `@custom_components/plugwise_usb/translations/en.json`:
- Around line 227-241: Update the user-facing description strings for the
services that reference the device identifier: edit the "description" values in
the blocks for the disable_production and enable_production entries (the strings
currently containing "mac" and "Node") to use consistent casing—replace "mac"
with "MAC" and "Node" with "node" (keep the data example format intact, e.g.,
"data = mac: 0123456789ABCDEF" -> "data = MAC: 0123456789ABCDEF"); also ensure
the field description for the "mac" field remains "The full 16 character MAC
address of the plugwise device" (no change needed) so the UI displays "MAC" and
"node" consistently.
In `@scripts/ci-core-testing.sh`:
- Around line 84-86: Replace the POSIX-style test using [ with bash's safer [[
in the conditional that checks for the prek command; specifically update the if
statement that currently reads if ! [ -x "$(command -v prek)" ]; then to use if
! [[ -x "$(command -v prek)" ]]; then so the test uses [[ ... ]], preserving the
existing command substitution and negation around command -v prek and leaving
the subsequent uv pip install prek and fi unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 559dfc05-89b4-4951-8f96-d9661d728152
📒 Files selected for processing (18)
.github/workflows/test.yml.github/workflows/validate.yaml.markdownlint.yaml.pre-commit-config.yaml.pymarkdownCHANGELOG.mdcustom_components/plugwise_usb/binary_sensor.pycustom_components/plugwise_usb/coordinator.pycustom_components/plugwise_usb/event.pycustom_components/plugwise_usb/number.pycustom_components/plugwise_usb/select.pycustom_components/plugwise_usb/sensor.pycustom_components/plugwise_usb/switch.pycustom_components/plugwise_usb/translations/en.jsonpyproject.tomlrequirements_commit.txtscripts/ci-core-testing.shtests/conftest.py
💤 Files with no reviewable changes (8)
- custom_components/plugwise_usb/binary_sensor.py
- custom_components/plugwise_usb/event.py
- tests/conftest.py
- custom_components/plugwise_usb/switch.py
- custom_components/plugwise_usb/number.py
- custom_components/plugwise_usb/select.py
- custom_components/plugwise_usb/sensor.py
- .markdownlint.yaml
| if ! [ -x "$(command -v pytest)" ]; then | ||
| echo -e "${CINFO}Ensure uv presence${CWARN}" | ||
| uv pip install pytest | ||
| fi |
There was a problem hiding this comment.
Fix misleading comment and use [[ for conditional test.
The comment says "Ensure uv presence" but the code is checking for pytest. Also, use [[ instead of [ for the conditional test.
🐛 Suggested fix
- if ! [ -x "$(command -v pytest)" ]; then
- echo -e "${CINFO}Ensure uv presence${CWARN}"
+ if ! [[ -x "$(command -v pytest)" ]]; then
+ echo -e "${CINFO}Ensure pytest presence${CWARN}"
uv pip install pytest
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if ! [ -x "$(command -v pytest)" ]; then | |
| echo -e "${CINFO}Ensure uv presence${CWARN}" | |
| uv pip install pytest | |
| fi | |
| if ! [[ -x "$(command -v pytest)" ]]; then | |
| echo -e "${CINFO}Ensure pytest presence${CWARN}" | |
| uv pip install pytest | |
| fi |
🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis
[failure] 185-185: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/ci-core-testing.sh` around lines 185 - 188, Update the conditional
that checks for pytest to use the bash [[ ... ]] test and correct the misleading
echo message: replace the current if ! [ -x "$(command -v pytest)" ]; then with
if ! [[ -x "$(command -v pytest)" ]]; then and change the echo text from "Ensure
uv presence" to "Ensure pytest presence"; keep the subsequent install invocation
(uv pip install pytest) as-is unless you also want to change the installer
command separately.
|



Summary by CodeRabbit