Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Jun 28, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability by updating how device information is accessed, ensuring compatibility with the latest Plugwise API structure.
  • Chores

    • Updated the required version of the external Plugwise package to 1.7.7 for enhanced stability.
    • Adjusted test fixtures and data to align with updated device attribute structure and added a new test device for more comprehensive testing.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 28, 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 1 minutes and 36 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 600e093 and db5fad8.

📒 Files selected for processing (1)
  • tests/components/plugwise/conftest.py (9 hunks)

Walkthrough

This update refactors attribute access throughout the Plugwise integration, changing references from flat API attributes (e.g., smile_name) to nested properties under a smile object (e.g., smile.name). It also updates test fixtures and snapshots to match the new structure and bumps the required plugwise library version.

Changes

Files/Groups Change Summary
custom_components/plugwise/__init__.py, climate.py, config_flow.py, coordinator.py, entity.py Refactored attribute access from flat API attributes to nested smile object properties (e.g., smile.name, smile.model).
custom_components/plugwise/manifest.json Updated required plugwise Python package version from 1.7.6 to 1.7.7.
tests/components/plugwise/conftest.py Updated test fixtures to use nested smile object with properties instead of flat attributes; added Munch import.
tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json, snapshots/test_diagnostics.ambr Added a new device entry for a "Switchgroup" device with members and relay switch to both test fixture and diagnostics snapshot.
tests/components/plugwise/test_config_flow.py Changed test mock attribute from flat to nested (smile.hostname) to match new structure.
tests/components/plugwise/test_init.py Removed unnecessary list conversion when iterating over device registry devices in test.
CHANGELOG.md, pyproject.toml Updated integration version to 0.57.5 and plugwise dependency to 1.7.7; set pre-release version in pyproject.toml.

Sequence Diagram(s)

sequenceDiagram
    participant HA as Home Assistant
    participant Plugwise as Plugwise Integration
    participant API as Plugwise API
    participant Smile as Smile Device

    HA->>Plugwise: Initialize integration
    Plugwise->>API: Access smile object (e.g., smile.name, smile.model)
    API->>Smile: Retrieve nested attributes
    Smile-->>API: Return requested properties
    API-->>Plugwise: Provide nested property values
    Plugwise-->>HA: Complete setup with updated device info
Loading

Possibly related PRs

Suggested labels

require-dev-pass

Suggested reviewers

  • CoMPaTech

Poem

A bunny hopped through fields of code,
Refactoring where data flowed.
From flat to nested, names now neat,
With smiles and models, the change complete.
Tests and fixtures join the fun,
Another tidy patch is done!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch pw_1_7_7

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.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

@CoMPaTech
Copy link
Member

Weird, action states: Successfully tested against dev HA-core ...

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

@bouwew bouwew marked this pull request as ready for review June 29, 2025 05:49
@bouwew bouwew requested a review from a team as a code owner June 29, 2025 05:49
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: 0

♻️ Duplicate comments (7)
tests/components/plugwise/conftest.py (7)

127-150: See previous comment – same api.smile duplication applies here.


159-176: Duplication of api.smile construction – refer to earlier suggestion.


185-202: Duplication of api.smile construction – refer to earlier suggestion.


211-228: Duplication of api.smile construction – refer to earlier suggestion.


237-253: Duplication of api.smile construction – refer to earlier suggestion.


263-279: Duplication of api.smile construction – refer to earlier suggestion.


289-305: Duplication of api.smile construction – refer to earlier suggestion.

🧹 Nitpick comments (1)
tests/components/plugwise/conftest.py (1)

105-117: Nice refactor – but extract the repeated smile mock construction

Switching to a nested api.smile object aligns tests with the integration changes – good!
However, the same block (api.smile = Munch(); …) is duplicated in every fixture. Consider a tiny helper:

+# tests/components/plugwise/helpers.py
+from munch import Munch
+
+def build_smile(**attrs):
+    smile = Munch()
+    for k, v in attrs.items():
+        setattr(smile, k, v)
+    return smile

and then:

-api.smile = Munch()
-api.smile.hostname = "smile12345"
-...
+api.smile = build_smile(
+    hostname="smile12345",
+    model="Test Model",
+    model_id="Test Model ID",
+    name="Test Smile Name",
+    version="4.3.2",
+)

reducing ~70 duplicated lines.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 69b9bc0 and 600e093.

📒 Files selected for processing (13)
  • CHANGELOG.md (1 hunks)
  • custom_components/plugwise/__init__.py (2 hunks)
  • custom_components/plugwise/climate.py (2 hunks)
  • custom_components/plugwise/config_flow.py (3 hunks)
  • custom_components/plugwise/coordinator.py (3 hunks)
  • custom_components/plugwise/entity.py (1 hunks)
  • custom_components/plugwise/manifest.json (1 hunks)
  • pyproject.toml (1 hunks)
  • tests/components/plugwise/conftest.py (9 hunks)
  • tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json (1 hunks)
  • tests/components/plugwise/snapshots/test_diagnostics.ambr (1 hunks)
  • tests/components/plugwise/test_config_flow.py (1 hunks)
  • tests/components/plugwise/test_init.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
  • pyproject.toml
  • custom_components/plugwise/entity.py
  • tests/components/plugwise/test_init.py
  • custom_components/plugwise/manifest.json
  • tests/components/plugwise/test_config_flow.py
  • tests/components/plugwise/snapshots/test_diagnostics.ambr
  • custom_components/plugwise/init.py
  • custom_components/plugwise/climate.py
  • custom_components/plugwise/coordinator.py
  • custom_components/plugwise/config_flow.py
  • CHANGELOG.md
  • tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: bouwew
PR: plugwise/plugwise-beta#671
File: custom_components/plugwise/switch.py:82-83
Timestamp: 2024-10-08T15:35:25.180Z
Learning: User bouwew prefers to ignore exception handling suggestions for the `pw-beta` branch in the `custom_components/plugwise/switch.py` file.
Learnt from: bouwew
PR: plugwise/plugwise-beta#671
File: custom_components/plugwise/switch.py:82-83
Timestamp: 2024-06-22T08:05:56.791Z
Learning: User bouwew prefers to ignore exception handling suggestions for the `pw-beta` branch in the `custom_components/plugwise/switch.py` file.
Learnt from: bouwew
PR: plugwise/plugwise-beta#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.
Learnt from: CoMPaTech
PR: plugwise/plugwise-beta#0
File: :0-0
Timestamp: 2025-01-25T20:42:24.862Z
Learning: The linting rules in plugwise-beta have been updated to use TC001/TC002/TC003 instead of TCH001/TCH002/TCH003 for type-checking related rules.
Learnt from: bouwew
PR: plugwise/plugwise-beta#734
File: tests/components/plugwise/test_config_flow.py:58-58
Timestamp: 2024-09-27T09:48:30.890Z
Learning: In `tests/components/plugwise/test_config_flow.py`, the versions are mocked firmware versions for testing purposes and do not need to match the software version in `manifest.json`.
Learnt from: bouwew
PR: plugwise/plugwise-beta#734
File: tests/components/plugwise/test_config_flow.py:58-58
Timestamp: 2024-10-08T15:35:25.180Z
Learning: In `tests/components/plugwise/test_config_flow.py`, the versions are mocked firmware versions for testing purposes and do not need to match the software version in `manifest.json`.
tests/components/plugwise/conftest.py (2)
Learnt from: bouwew
PR: plugwise/plugwise-beta#734
File: tests/components/plugwise/test_config_flow.py:58-58
Timestamp: 2024-09-27T09:48:30.890Z
Learning: In `tests/components/plugwise/test_config_flow.py`, the versions are mocked firmware versions for testing purposes and do not need to match the software version in `manifest.json`.
Learnt from: bouwew
PR: plugwise/plugwise-beta#734
File: tests/components/plugwise/test_config_flow.py:58-58
Timestamp: 2024-10-08T15:35:25.180Z
Learning: In `tests/components/plugwise/test_config_flow.py`, the versions are mocked firmware versions for testing purposes and do not need to match the software version in `manifest.json`.
🪛 Gitleaks (8.26.0)
tests/components/plugwise/conftest.py

138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


139-139: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


164-164: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


165-165: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


191-191: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


192-192: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


217-217: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


218-218: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


294-294: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Setup for HA-core (dev)
  • GitHub Check: Setup for HA-core (release/master)
🔇 Additional comments (1)
tests/components/plugwise/conftest.py (1)

20-20: Verify availability of the new munch test-dependency

munch is not part of the standard library.
Please make sure it is already pinned in requirements_test.txt / requirements_dev.txt; otherwise CI will break when the test runner tries to import it.

@sonarqubecloud
Copy link

@bouwew bouwew merged commit 2c1a008 into main Jun 29, 2025
13 checks passed
@bouwew bouwew deleted the pw_1_7_7 branch June 29, 2025 06:12
@coderabbitai coderabbitai bot mentioned this pull request Oct 4, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 15, 2025
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