Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Dec 16, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved and more specific connectivity/authentication/firmware error messages and handling.
    • Removed CONFIG entity category from several select entities so they no longer appear as configuration items.
  • Tests

    • Updated tests to use the config-entry setup flow and assert entry setup states.
  • Chores

    • Updated translation keys/messages, changelog entry, and bumped version to 0.62.2.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

Walkthrough

Refactors Plugwise coordinator to defer connect until needed and centralize error mappings; updates tests to use config-entry setup flow; renames/remaps translation keys (invalid_xml_data → invalid_setup; adds response_error); updates snapshots entity_category; bumps version and adds changelog note.

Changes

Cohort / File(s) Summary
Tests — config-entry setup
tests/components/plugwise/test_init.py
Removed direct PlugwiseDataUpdateCoordinator instantiation and coordinator._connect() calls; tests now call mock_config_entry.add_to_hass(hass) and hass.config_entries.async_setup(...). test_coordinator_connect_exceptions now asserts ConfigEntryState outcomes. Removed unused imports.
Snapshots — entity metadata
tests/components/plugwise/snapshots/test_select.ambr
Changed entity_category for multiple select entities from EntityCategory.CONFIG to None in thermostat schedule/profile snapshots.
Coordinator logic
custom_components/plugwise/coordinator.py
Made connect lazy (defer _connect() until needed), simplified _connect() to direct connect + version check, consolidated exception-to-Home‑Assistant mappings (ConnectionFailedError/InvalidAuthentication/InvalidSetupError → UpdateFailed/ConfigEntryError; InvalidXMLError/ResponseError → response_error; UnsupportedDeviceError → unsupported_firmware), and return fetched data explicitly from _async_update_data().
Strings & translations
custom_components/plugwise/strings.json, custom_components/plugwise/translations/en.json, custom_components/plugwise/translations/nl.json
Removed invalid_xml_data; added invalid_setup and response_error keys; updated English and Dutch translations and relocated keys accordingly.
Metadata
CHANGELOG.md, pyproject.toml
Added an "Ongoing" changelog note reverting exception-move; bumped version 0.62.1 → 0.62.2.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant H as Home Assistant
  participant CE as ConfigEntry
  participant C as PlugwiseCoordinator
  participant P as Plugwise Library / Device
  Note right of C: lazy connect — connect deferred until update
  H->>CE: add_to_hass(entry)
  H->>CE: async_setup(entry_id)
  CE->>C: instantiate coordinator
  H->>C: trigger update cycle
  alt not connected
    C->>P: connect()
    P-->>C: version/info or raises error
  end
  alt connection success
    C->>P: fetch_data()
    P-->>C: data
    C->>H: return data (entities updated)
  else connection error
    P-->>C: raises specific error
    C->>H: map error → UpdateFailed or ConfigEntryError (invalid_setup / response_error / unsupported_firmware)
    H->>CE: set ConfigEntryState (SETUP_RETRY / SETUP_ERROR)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • CoMPaTech
  • github-actions

Poem

🐰 Hopped into the code so spry,

Lazy connects now wait to try.
Strings renamed, tests follow suit,
Snapshots tidy, version new and cute.
A rabbit cheers — hop, loop, deploy! 🎉

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 title accurately describes the main changes: reverting exception handling changes, aligning with Core Plugwise, and updating snapshots.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test-alt

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 88ba9d0 and f4f370e.

📒 Files selected for processing (1)
  • custom_components/plugwise/strings.json
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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
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.
Learnt from: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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.
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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.

Applied to files:

  • custom_components/plugwise/strings.json
📚 Learning: 2024-09-30T18:06:35.677Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 736
File: custom_components/plugwise/config_flow.py:82-110
Timestamp: 2024-09-30T18:06:35.677Z
Learning: In the `PlugwiseConfigFlow`, if required `user_input` is missing, the config flow should fail and display the data-input window again, allowing the user to identify and correct missing or misspelled data rather than handling missing keys within the `base_schema()` function.

Applied to files:

  • custom_components/plugwise/strings.json
⏰ 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). (2)
  • GitHub Check: Setup for HA-core (dev)
  • GitHub Check: Setup for HA-core (release/master)
🔇 Additional comments (2)
custom_components/plugwise/strings.json (2)

45-45: LGTM! Consistency issue resolved.

The response_error message now matches the exceptions section (line 330), resolving the inconsistency flagged in the previous review.


326-331: LGTM! Exception messages properly aligned with config errors.

Both exception blocks are correctly defined and consistent with their corresponding entries in the config.error section:

  • invalid_setup (line 327) matches line 42
  • response_error (line 330) matches line 45

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04c021f and b0f102f.

📒 Files selected for processing (1)
  • tests/components/plugwise/test_init.py (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
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.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 0
File: :0-0
Timestamp: 2025-01-25T20:42:24.862Z
Learning: In the plugwise-beta project, `uv` package manager was removed from core-testing.sh in favor of pip due to issues it was causing.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.
📚 Learning: 2025-08-23T16:26:34.700Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2025-12-03T10:16:54.887Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.

Applied to files:

  • tests/components/plugwise/test_init.py
🧬 Code graph analysis (1)
tests/components/plugwise/test_init.py (1)
tests/components/plugwise/conftest.py (1)
  • mock_config_entry (81-95)
🪛 Ruff (0.14.8)
tests/components/plugwise/test_init.py

139-142: pytest.raises() block should contain a single simple statement

(PT012)

⏰ 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

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 force-pushed the test-alt branch 3 times, most recently from 7f6128a to 66bf4c3 Compare December 16, 2025 11:14
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.

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.

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.

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)
tests/components/plugwise/test_init.py (1)

29-33: Remove commented-out imports instead of leaving dead code.

If ConfigEntryError and UpdateFailed are no longer needed, delete these lines entirely. Commented-out code clutters the codebase and creates confusion about whether it's intentionally disabled or accidentally left behind.

-
-# from homeassistant.exceptions import ConfigEntryError
 from homeassistant.helpers import device_registry as dr, entity_registry as er
-
-# from homeassistant.helpers.update_coordinator import UpdateFailed
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66bf4c3 and c7df6c0.

📒 Files selected for processing (1)
  • tests/components/plugwise/test_init.py (2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
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.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.
Learnt from: CoMPaTech
Repo: plugwise/plugwise-beta PR: 0
File: :0-0
Timestamp: 2025-01-25T20:42:24.862Z
Learning: In the plugwise-beta project, `uv` package manager was removed from core-testing.sh in favor of pip due to issues it was causing.
📚 Learning: 2025-08-23T16:26:34.700Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2025-12-03T10:16:54.887Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.

Applied to files:

  • tests/components/plugwise/test_init.py
🧬 Code graph analysis (1)
tests/components/plugwise/test_init.py (1)
tests/components/plugwise/conftest.py (2)
  • mock_config_entry (81-95)
  • mock_smile_anna (240-263)
⏰ 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). (2)
  • GitHub Check: Setup for HA-core (release/master)
  • GitHub Check: Setup for HA-core (dev)
🔇 Additional comments (1)
tests/components/plugwise/test_init.py (1)

119-143: LGTM!

The test correctly validates transient connection errors by using the config-entry setup flow and asserting SETUP_RETRY state. The separation of transient errors (ConnectionFailedError, InvalidXMLError, ResponseError) from fatal errors is appropriate.

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.

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.

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

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

30-32: Remove the commented-out import.

The commented-out UpdateFailed import is dead code. Remove it entirely rather than leaving it commented.

-
-# from homeassistant.helpers.update_coordinator import UpdateFailed
 from homeassistant.setup import async_setup_component
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7df6c0 and b01ffcb.

📒 Files selected for processing (2)
  • tests/components/plugwise/snapshots/test_select.ambr (6 hunks)
  • tests/components/plugwise/test_init.py (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
📚 Learning: 2025-08-23T16:26:34.700Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2025-12-03T10:16:54.887Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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.

Applied to files:

  • tests/components/plugwise/test_init.py
🧬 Code graph analysis (1)
tests/components/plugwise/test_init.py (1)
tests/components/plugwise/conftest.py (2)
  • mock_config_entry (81-95)
  • mock_smile_anna (240-263)
⏰ 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). (2)
  • GitHub Check: Setup for HA-core (dev)
  • GitHub Check: Setup for HA-core (release/master)
🔇 Additional comments (3)
tests/components/plugwise/snapshots/test_select.ambr (1)

144-144: Verify the intentional removal of entity_category: CONFIG for thermostat schedule entities.

All thermostat schedule select entities (bathroom_thermostat_schedule, living_room_thermostat_schedule, badkamer_thermostat_schedule, bios_thermostat_schedule, jessie_thermostat_schedule, woonkamer_thermostat_schedule) now have entity_category: None instead of EntityCategory.CONFIG.

This changes their visibility in the Home Assistant UI—they will now appear in the main entity list rather than being hidden under "configuration entities." Please confirm this is the intended behavioral change.

Also applies to: 266-266, 389-389, 454-454, 519-519, 584-584

tests/components/plugwise/test_init.py (2)

119-130: Well-structured parametrization for exception handling.

The mapping of exceptions to expected ConfigEntryState outcomes correctly distinguishes between fatal errors (SETUP_ERROR) and transient errors (SETUP_RETRY). This addresses the previous review feedback and provides clear, maintainable test coverage for the coordinator's exception translation logic.


131-146: LGTM!

The test now properly exercises the full config-entry setup flow rather than directly calling internal coordinator methods. This approach is more robust and tests the actual integration behavior users would experience.

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

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

129-144: Update the docstring to reflect the new test approach.

The test logic correctly verifies that exceptions from connect() are translated into appropriate ConfigEntryState values via the config-entry setup flow. However, the docstring states "Ensure _connect raises translated errors," which no longer accurately describes the test since it doesn't directly call _connect().

Update the docstring to something like:

-    """Ensure _connect raises translated errors."""
+    """Verify that connect exceptions are translated to appropriate config entry states."""
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b01ffcb and b2c0fb3.

📒 Files selected for processing (1)
  • tests/components/plugwise/test_init.py (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
📚 Learning: 2025-08-23T16:26:34.700Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2025-12-03T10:16:54.887Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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.

Applied to files:

  • tests/components/plugwise/test_init.py
⏰ 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). (2)
  • GitHub Check: Setup for HA-core (dev)
  • GitHub Check: Setup for HA-core (release/master)
🔇 Additional comments (1)
tests/components/plugwise/test_init.py (1)

118-127: LGTM!

The parametrization correctly maps each exception type to its appropriate ConfigEntryState. Fatal errors (authentication, setup, unsupported device) result in SETUP_ERROR, while transient errors (connection, XML, response) result in SETUP_RETRY, allowing for automatic retry logic.

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

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

129-144: Update the docstring to reflect the new test approach.

The test implementation is correct and properly uses the config-entry setup flow. However, the docstring at line 136 states "Ensure _connect raises translated errors," which no longer accurately describes what the test does. The test now validates that exceptions raised during the connect phase result in the correct config-entry state (SETUP_ERROR or SETUP_RETRY).

Apply this diff to update the docstring:

-    """Ensure _connect raises translated errors."""
+    """Test that connect exceptions result in the correct config-entry state."""
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b2c0fb3 and d7a7d56.

📒 Files selected for processing (1)
  • tests/components/plugwise/test_init.py (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.
📚 Learning: 2025-08-23T16:26:34.700Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2025-12-03T10:16:54.887Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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.

Applied to files:

  • tests/components/plugwise/test_init.py
🧬 Code graph analysis (1)
tests/components/plugwise/test_init.py (1)
tests/components/plugwise/conftest.py (2)
  • mock_config_entry (81-95)
  • mock_smile_anna (240-263)
🔇 Additional comments (2)
tests/components/plugwise/test_init.py (2)

104-104: LGTM - Minor docstring improvement.

The terminology change from "configuration entry" to "config-entry" improves consistency with the codebase.


118-127: LGTM - Correct exception-to-state mapping.

The parametrization correctly maps exceptions to their expected ConfigEntryState values:

  • Fatal errors (authentication, setup, unsupported device) → SETUP_ERROR
  • Transient errors (connection, XML, response, general) → SETUP_RETRY

This aligns with the coordinator's exception handling logic.

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

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

117-144: Consider updating the docstring to reflect the new test approach.

The test logic correctly verifies that exceptions raised by connect() result in appropriate ConfigEntryState values when exercising the full config-entry setup flow. The parametrization properly maps fatal errors (InvalidAuthentication, InvalidSetupError, UnsupportedDeviceError) to SETUP_ERROR and transient errors (ConnectionFailedError, InvalidXMLError, ResponseError, PlugwiseError) to SETUP_RETRY.

However, the docstring on line 136 still references _connect directly, which is no longer accurate since the test now exercises the complete config-entry initialization path.

Consider this minor docstring update:

-    """Ensure _connect raises translated errors."""
+    """Test that connect exceptions result in appropriate config entry states."""
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7a7d56 and b3423b2.

📒 Files selected for processing (1)
  • tests/components/plugwise/test_init.py (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.
📚 Learning: 2025-08-23T16:26:34.700Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2025-12-03T10:16:54.887Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.

Applied to files:

  • tests/components/plugwise/test_init.py
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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.

Applied to files:

  • tests/components/plugwise/test_init.py
🧬 Code graph analysis (1)
tests/components/plugwise/test_init.py (1)
tests/components/plugwise/conftest.py (2)
  • mock_config_entry (81-95)
  • mock_smile_anna (240-263)
⏰ 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). (2)
  • GitHub Check: Setup for HA-core (dev)
  • GitHub Check: Setup for HA-core (release/master)
🔇 Additional comments (1)
tests/components/plugwise/test_init.py (1)

104-104: LGTM: consistent terminology.

The docstring now uses "config-entry" which aligns with Home Assistant's standard terminology.

@bouwew bouwew changed the title Try alternative test-method Revert exception-changes, line up with Core Plugwise, missed snapshot-update Dec 16, 2025
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 b3423b2 and 3c1fbd6.

📒 Files selected for processing (4)
  • custom_components/plugwise/coordinator.py (3 hunks)
  • custom_components/plugwise/strings.json (1 hunks)
  • custom_components/plugwise/translations/en.json (1 hunks)
  • custom_components/plugwise/translations/nl.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
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.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
📚 Learning: 2025-12-03T10:16:54.887Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 982
File: custom_components/plugwise/coordinator.py:120-132
Timestamp: 2025-12-03T10:16:54.887Z
Learning: In Home Assistant integrations, when a coordinator extends DataUpdateCoordinator and defines an `_async_setup()` method, it is automatically called by the framework during `async_config_entry_first_refresh()` before the first data update. The framework calls `__wrap_async_setup()` which invokes `_async_setup()`, so there's no need to manually call it during coordinator initialization.

Applied to files:

  • custom_components/plugwise/coordinator.py
⏰ 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). (2)
  • GitHub Check: Setup for HA-core (release/master)
  • GitHub Check: Setup for HA-core (dev)
🔇 Additional comments (6)
custom_components/plugwise/translations/en.json (1)

309-311: LGTM!

The key rename from invalid_xml_data to response_error is consistent with the coordinator's updated exception handling and aligns with the parallel changes in strings.json and nl.json.

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

324-326: LGTM!

The Dutch translation is consistent with the English version and the key rename aligns with the coordinator changes.

custom_components/plugwise/strings.json (1)

326-328: LGTM!

The key rename and message update are consistent with the coordinator's exception handling changes.

custom_components/plugwise/coordinator.py (3)

85-101: Clean simplification of _connect.

Removing the per-exception try/except blocks in favor of handling errors in _async_update_data is a good refactor. Deriving _connected from the Version object type is appropriate.


116-126: Lazy connection pattern looks good.

The deferred connection within _async_update_data is clean, and the ConnectionFailedError handler appropriately raises UpdateFailed to allow retries on subsequent polling cycles.


142-151: The current exception handling order is correct. The test suite confirms that UnsupportedDeviceError produces ConfigEntryState.SETUP_ERROR with the "unsupported_firmware" message, not the PlugwiseError fallback behavior. This indicates UnsupportedDeviceError does not inherit from PlugwiseError, or if it does, the exception handling is working as intended. No changes needed.

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

🧹 Nitpick comments (1)
custom_components/plugwise/strings.json (1)

326-331: Minor indentation inconsistency, but content is correct.

The exception keys are properly added with clear messages matching the translations file. However, line 327 uses 8 spaces of indentation while the rest of the file (including line 330) uses 6 spaces for message values.

Apply this diff to align indentation:

     "invalid_setup": {
-        "message": "Add your Adam instead of your Anna, see the documentation"
+      "message": "Add your Adam instead of your Anna, see the documentation"
     },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0479e59 and cf11a5b.

📒 Files selected for processing (3)
  • custom_components/plugwise/strings.json (1 hunks)
  • custom_components/plugwise/translations/en.json (1 hunks)
  • custom_components/plugwise/translations/nl.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • custom_components/plugwise/translations/nl.json
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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
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.
Learnt from: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 906
File: tests/components/plugwise/test_binary_sensor.py:9-16
Timestamp: 2025-08-23T16:26:34.700Z
Learning: The Plugwise integration test files import utilities like `snapshot_platform`, `MockConfigEntry`, and `async_fire_time_changed` from `tests.common`, which is from the Home Assistant core repository at https://github.com/home-assistant/core/blob/master/tests/common.py, not from local test files.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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`.
📚 Learning: 2024-06-22T08:05:56.791Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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.

Applied to files:

  • custom_components/plugwise/translations/en.json
⏰ 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). (2)
  • GitHub Check: Setup for HA-core (release/master)
  • GitHub Check: Setup for HA-core (dev)
🔇 Additional comments (1)
custom_components/plugwise/translations/en.json (1)

309-313: LGTM! Exception keys added correctly.

The invalid_setup and response_error exception keys are properly structured and provide clear, actionable messages. Note that response_error has a more detailed message here ("...from the Plugwise Adam/Smile/Stretch") compared to the config.error.response_error on line 15, which may be intentional to provide more context for runtime exceptions versus setup errors.

@bouwew bouwew marked this pull request as ready for review December 23, 2025 09:01
@bouwew bouwew requested a review from a team as a code owner December 23, 2025 09:01
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: 2

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf11a5b and bc73872.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • custom_components/plugwise/strings.json
  • custom_components/plugwise/translations/nl.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 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
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.
Learnt from: CoMPaTech
Repo: plugwise/plugwise-beta PR: 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
Repo: plugwise/plugwise-beta PR: 671
File: custom_components/plugwise/select.py:86-87
Timestamp: 2024-10-08T15:35:25.180Z
Learning: Ignore suggestions related to exception handling in device retrieval for the pw-beta branch as per user's request.
📚 Learning: 2024-10-08T15:35:25.180Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 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.

Applied to files:

  • custom_components/plugwise/translations/nl.json
⏰ 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 (2)
custom_components/plugwise/translations/nl.json (1)

324-326: LGTM: Translation key renamed appropriately.

The invalid_setup key and its Dutch translation are clear and consistent with the same key in the config.error section (line 42).

custom_components/plugwise/strings.json (1)

326-328: LGTM: Translation key renamed appropriately.

The invalid_setup key and message are clear and consistent with the same key in the config.error section (line 42).

@sonarqubecloud
Copy link

@bouwew bouwew merged commit 510dcaf into main Dec 23, 2025
13 checks passed
@bouwew bouwew deleted the test-alt branch December 23, 2025 11:01
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.

2 participants