Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Nov 27, 2025

Summary by CodeRabbit

  • New Features

    • Extended Plugwise group support with new sensor types for monitoring electricity consumption, electricity production, and temperature across group devices.
  • Chores

    • Updated plugwise dependency to v1.11.0.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

The Plugwise integration is updated to require plugwise v1.11.0 instead of v1.10.0. Test fixtures for multiple Adam/Emma device configurations are updated to reflect new group entity types with electricity and temperature sensors. Test assertions and snapshots are updated accordingly.

Changes

Cohort / File(s) Change Summary
Dependency and changelog
CHANGELOG.md, custom_components/plugwise/manifest.json
Updated plugwise requirement from v1.10.0 to v1.11.0; added Ongoing entry for Plugwise groups feature (PR #976) and updated v0.61.0 release notes.
Test fixtures: Group entity enhancements
tests/components/plugwise/fixtures/adam_plus_anna_new/data.json, tests/components/plugwise/fixtures/m_adam_cooling/data.json, tests/components/plugwise/fixtures/m_adam_heating/data.json, tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json, tests/components/plugwise/fixtures/stretch_v31/data.json
Updated existing group entities changing model from "Switchgroup" to "Group"; added new group entities with electricity consumption/production and temperature sensors; introduced sensor blocks to track power metrics across various test scenarios.
Test snapshots
tests/components/plugwise/snapshots/test_diagnostics.ambr, tests/components/plugwise/snapshots/test_sensor.ambr
Added snapshot entries for new electricity and temperature sensors; updated diagnostics snapshot to reflect Group model and sensor blocks; expanded sensor registry entries with entity metadata (translation_key, unit_of_measurement, suggested_display_precision).
Test expectations
tests/components/plugwise/test_init.py
Updated assertion values for entity and device registry counts to reflect added group sensors (increments: 51→56, 10→11, 58→63, 11→12 across test scenarios).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify fixture data accuracy: new group entity structure (electricity_consumed, electricity_produced, temperature sensors) across multiple device configurations
  • Confirm snapshot entries match fixture definitions and expected sensor metadata
  • Validate assertion count increments reflect the correct number of new entities added

Possibly related PRs

Suggested labels

require-dev-pass

Suggested reviewers

  • CoMPaTech

Poem

🐰 With whiskers twitching, we hop and cheer,
Groups now shine with sensors clear!
From v1.10 to v1.11 we bound,
Electricity and warmth abound!
The fixtures dance in snapshots new,
Testing flows through and through! ✨

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 'Extend feature: extent/improve Plugwise groups' clearly describes the main change of enhancing Plugwise group support and updating dependencies.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pw-1_11_0

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21559d6 and 74a91ee.

📒 Files selected for processing (10)
  • CHANGELOG.md (1 hunks)
  • custom_components/plugwise/manifest.json (1 hunks)
  • tests/components/plugwise/fixtures/adam_plus_anna_new/data.json (2 hunks)
  • tests/components/plugwise/fixtures/m_adam_cooling/data.json (2 hunks)
  • tests/components/plugwise/fixtures/m_adam_heating/data.json (2 hunks)
  • tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json (2 hunks)
  • tests/components/plugwise/fixtures/stretch_v31/data.json (2 hunks)
  • tests/components/plugwise/snapshots/test_diagnostics.ambr (2 hunks)
  • tests/components/plugwise/snapshots/test_sensor.ambr (2 hunks)
  • tests/components/plugwise/test_init.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • tests/components/plugwise/fixtures/adam_plus_anna_new/data.json
  • tests/components/plugwise/fixtures/m_adam_cooling/data.json
  • custom_components/plugwise/manifest.json
  • tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json
  • tests/components/plugwise/fixtures/stretch_v31/data.json
  • tests/components/plugwise/fixtures/m_adam_heating/data.json
  • tests/components/plugwise/test_init.py
  • CHANGELOG.md
🧰 Additional context used
🧠 Learnings (1)
📓 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: 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: 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: 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.
⏰ 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 (4)
tests/components/plugwise/snapshots/test_diagnostics.ambr (2)

557-570: New pumping group diagnostics entry looks consistent

The new e117db6848394c8cb70d9c28e63d92d2 group entry uses the same structure as other groups (dev_class, members, model, sensors, vendor), and the sensor values/units align with the member devices already present in this snapshot. No issues from a schema or consistency perspective.


599-610: Updated “Test” group diagnostics align with extended group semantics

Changing the e8ef2a01ed3b4139a53bf749204fe6b4 model to "Group" and adding electricity_consumed / electricity_produced under sensors matches how other group entities expose aggregated power data. The structure and naming are consistent with nearby entries.

tests/components/plugwise/snapshots/test_sensor.ambr (2)

1219-1330: Group “Test” electricity sensors snapshots follow existing pattern

The new sensor.test_electricity_consumed and sensor.test_electricity_produced snapshots correctly mirror the structure of other electricity sensors: proper power device_class, MEASUREMENT state_class, W units, and electricity_* translation keys with unique_ids derived from the group id. Looks good.


1604-1771: “Vloerverwarming” group sensors are defined consistently

The added vloerverwarming electricity and temperature sensor snapshots use consistent entity_ids, friendly names, device_class, state_class, units, and unique_id prefixes tied to the new group id. They line up with how other zone/group-level sensors are modeled in this file.


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: 2

🧹 Nitpick comments (1)
tests/components/plugwise/snapshots/test_sensor.ambr (1)

1219-1329: New group‑level electricity/temperature and illuminance sensors match the extended group model

The added snapshots for sensor.test_electricity_*, sensor.vloerverwarming_*, and the new Anna illuminance sensors use:

  • unique_ids derived from the corresponding group/device IDs seen in diagnostics,
  • appropriate device_class, state_class, and units (W/kWh/°C/lx),
  • translation_keys consistent with existing single‑device sensors.

This looks correct for the new group feature. If you ever decide these group totals should be treated as diagnostics rather than primary sensors, you could optionally set their entity_category to DIAGNOSTIC as well, but it’s reasonable as‑is.

Also applies to: 1604-1771, 1772-1807

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9abb7f1 and d4cf922.

📒 Files selected for processing (11)
  • CHANGELOG.md (1 hunks)
  • custom_components/plugwise/manifest.json (1 hunks)
  • tests/components/plugwise/fixtures/adam_plus_anna_new/data.json (2 hunks)
  • tests/components/plugwise/fixtures/m_adam_cooling/data.json (2 hunks)
  • tests/components/plugwise/fixtures/m_adam_heating/data.json (2 hunks)
  • tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json (2 hunks)
  • tests/components/plugwise/fixtures/stretch_v31/data.json (2 hunks)
  • tests/components/plugwise/snapshots/test_binary_sensor.ambr (7 hunks)
  • tests/components/plugwise/snapshots/test_diagnostics.ambr (2 hunks)
  • tests/components/plugwise/snapshots/test_sensor.ambr (19 hunks)
  • tests/components/plugwise/test_init.py (3 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: 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.
📚 Learning: 2025-01-25T20:42:24.862Z
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.

Applied to files:

  • tests/components/plugwise/fixtures/stretch_v31/data.json
  • CHANGELOG.md
📚 Learning: 2024-12-12T19:48:34.652Z
Learnt from: bouwew
Repo: plugwise/plugwise-beta PR: 793
File: custom_components/plugwise/manifest.json:10-11
Timestamp: 2024-12-12T19:48:34.652Z
Learning: In the Plugwise integration, temporary use of alpha versions from test repositories is acceptable for testing purposes.

Applied to files:

  • CHANGELOG.md
📚 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:

  • custom_components/plugwise/manifest.json
  • tests/components/plugwise/test_init.py
📚 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:

  • custom_components/plugwise/manifest.json
🧬 Code graph analysis (1)
tests/components/plugwise/test_init.py (1)
tests/components/plugwise/conftest.py (1)
  • mock_config_entry (81-95)
🪛 markdownlint-cli2 (0.18.1)
CHANGELOG.md

7-7: No empty links

(MD042, no-empty-links)

⏰ 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 (9)
tests/components/plugwise/fixtures/stretch_v31/data.json (1)

88-116: Verify sensor block consistency across group fixtures.

The group model is renamed from "Switchgroup" to "Group" correctly. However, note that other fixtures in this PR (e.g., m_adam_heating, m_adam_cooling) add sensors blocks to their Group entries, while this fixture does not. Confirm whether this is intentional or whether sensor blocks should be added here as well.

tests/components/plugwise/fixtures/adam_plus_anna_new/data.json (1)

184-198: Group fixture updates are well-structured.

The new Group entry is properly formed with valid member references and consistent sensor aggregations. The existing entry is correctly updated with model rename and sensor block addition. The data integrity and structure look good.

Also applies to: 275-280

tests/components/plugwise/fixtures/m_adam_cooling/data.json (1)

94-108: Group fixture updates maintain consistency.

The new and updated Group entries are properly formed. Sensor values reflect the cooling scenario context, and the reuse of group ID c9293d1d68ee48fc8843c6f0dee2b6be across fixtures is consistent with the overall design.

Also applies to: 191-195

tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/data.json (1)

508-521: Group fixture updates are consistent with multi-device-per-zone scenario.

The new Group entry correctly aggregates member devices (CV pump and zone sensor). Note that electricity_produced is omitted from the new group's sensors; verify this is intentional based on the device capabilities.

Also applies to: 556-561

tests/components/plugwise/fixtures/m_adam_heating/data.json (1)

99-113: Group fixture updates are consistent with heating scenario.

The new and updated Group entries follow the established pattern. Sensor aggregations are consistent with the fixture's heating context.

Also applies to: 190-195

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

300-300: Incorrect entity count delta in review comment.

The review comment states entity registry increases by "+5 entries" per state, but the test expectations show a delta of +7 entities (63 − 56 = 7). The new Tom/Floor device adds 1 device + 6 entities (1 binary_sensor + 5 sensors), totaling 7 new entities. The device count delta of "+1" is correct. Correct the entity delta from "+5" to "+7" in the verification statement.

Likely an incorrect or invalid review comment.

tests/components/plugwise/snapshots/test_binary_sensor.ambr (1)

14-15: Binary sensors reclassified as DIAGNOSTIC are consistent and appropriate

The updated entity_category = EntityCategory.DIAGNOSTIC for notification and heating/heatpump state binary_sensors matches their diagnostic nature and aligns with the broader PR changes; the snapshots remain internally consistent.

Also applies to: 163-165, 553-555, 649-651, 745-747, 841-843, 889-891

tests/components/plugwise/snapshots/test_diagnostics.ambr (1)

557-570: New/extended diagnostics group entries look structurally sound

The added pumping group (e117db...) and updated switching group (e8ef2a... now model: 'Group' with electricity sensors) correctly mirror the existing diagnostics schema: member IDs are valid, sensor keys/units match other devices, and values are plausible. This matches the extended group feature described in the PR.

Also applies to: 599-615

tests/components/plugwise/snapshots/test_sensor.ambr (1)

16-17: Diagnostic entity_category assignments for sensors are coherent

Marking internal/battery/boiler/OpenTherm/outdoor and similar technical metrics as EntityCategory.DIAGNOSTIC while leaving main consumption and climate readings uncategorized is consistent and keeps primary dashboards focused on user‑relevant data; the snapshots remain self‑consistent.

Also applies to: 352-353, 570-571, 788-789, 1121-1122, 1177-1178, 1331-1346, 1565-1567, 1785-1787, 1951-1952, 2115-2116, 3231-3232, 3399-3400, 3508-3509, 3564-3565, 3669-3673, 3728-3730, 3784-3785, 3840-3841, 3896-3898

@sonarqubecloud
Copy link

@bouwew bouwew marked this pull request as ready for review November 28, 2025 16:39
@bouwew bouwew requested a review from a team as a code owner November 28, 2025 16:39
@bouwew bouwew merged commit eba08a3 into main Nov 28, 2025
13 checks passed
@bouwew bouwew deleted the pw-1_11_0 branch November 28, 2025 18:26
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