Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Nov 2, 2025

Bump plugwise to v1.9.0, replace climate testcase using the anna_p1 test-fixture

Summary by CodeRabbit

  • New Features

    • Added support for Anna P1 devices
  • Chores

    • Bumped integration version to v0.60.0 and updated Plugwise library requirement to v1.9.0
  • Tests

    • Added fixtures and snapshot tests for a second Anna (P1) variant; removed an outdated heatpump fixture; refreshed climate and sensor snapshots
  • Documentation

    • Updated README and CHANGELOG to document Anna P1 support

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 2, 2025

Walkthrough

Bumps plugwise dependency and integration version, adds Anna P1 test fixture and data, removes an obsolete Anna heatpump fixture, updates sensor/climate snapshots and tests to use the new fixture and reflect Anna P1 behavior.

Changes

Cohort / File(s) Summary
Dependency / Metadata
custom_components/plugwise/manifest.json, pyproject.toml, CHANGELOG.md
Bumped plugwise requirement to plugwise==1.9.0, updated integration/project version to 0.60.0, and added changelog entry for Anna P1 support.
New Anna P1 test data
tests/components/plugwise/fixtures/anna_p1/data.json
Added fixture JSON describing four devices (thermostat, heater, gateway, smartmeter) and sensor readings for Anna P1.
Test fixtures & mocks
tests/components/plugwise/conftest.py
Added mock_smile_anna_2 pytest fixture that constructs a second Anna-type mock using the anna_p1 data.
Removed fixture
tests/components/plugwise/fixtures/m_anna_heatpump_idle/data.json
Deleted obsolete heat-pump fixture file.
Tests & snapshots
tests/components/plugwise/test_sensor.py, tests/components/plugwise/test_climate.py, tests/components/plugwise/snapshots/*
Added Anna P1 sensor snapshot test, updated climate tests to use mock_smile_anna_2, and expanded/adjusted sensor and climate snapshots (HVAC modes, preset order, unique_ids, current/target temps, and many new sensor entries).

Sequence Diagram(s)

(omitted — changes are metadata, test data, and snapshot updates; no new runtime control-flow to diagram)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to tests/components/plugwise/fixtures/anna_p1/data.json for completeness and shape expected by plugwise 1.9.0.
  • Review snapshot changes in tests/components/plugwise/snapshots/* to ensure they match intended device semantics (HVAC modes, preset order, unique_id changes).
  • Verify mock_smile_anna_2 in conftest.py is not duplicated and integrates cleanly with existing fixtures.

Possibly related PRs

Suggested labels

needs_upstreaming

Suggested reviewers

  • CoMPaTech
  • github-actions

Poem

🐇 A new Anna P1 hops into view, bright and spry,
Version bumped, fixtures fresh beneath the sky.
Old heatpump sleeps, snapshots wake to new song,
Mock smiles multiply — tests hum along. 🌿

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 PR title "Add support for Anna P1" directly aligns with the primary objective of the pull request, which is to add support for the Anna P1 device type. The title is specific, concise, and accurately reflects the main change across the changeset, including the new anna_p1 fixture data, test additions, documentation updates, and the dependency bump to plugwise v1.9.0 that enables this support. A teammate reviewing the git history would immediately understand that this PR introduces Anna P1 support without ambiguity.
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.9.0

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.

@bouwew bouwew marked this pull request as ready for review November 2, 2025 19:21
@bouwew bouwew requested a review from a team as a code owner November 2, 2025 19:21
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 2, 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: 0

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

5543-5710: Net electricity and voltage snapshots LGTM; tiny precision nit

  • Net cumulative (kWh) as total and point (W) as measurement look right.
  • Voltage uses suggested_display_precision: 0 but states include decimals (e.g., 234.6). If intended, fine; otherwise consider precision 1 for UI consistency.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2984226 and 5237d05.

📒 Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • README.md (1 hunks)
  • custom_components/plugwise/manifest.json (1 hunks)
  • pyproject.toml (1 hunks)
  • tests/components/plugwise/snapshots/test_sensor.ambr (1 hunks)
  • tests/components/plugwise/test_sensor.py (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • README.md
  • CHANGELOG.md
  • pyproject.toml
🧰 Additional context used
🧠 Learnings (3)
📓 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.
📚 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
📚 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
  • tests/components/plugwise/test_sensor.py
🧬 Code graph analysis (1)
tests/components/plugwise/test_sensor.py (1)
tests/components/plugwise/conftest.py (2)
  • mock_smile_anna_2 (267-291)
  • setup_platform (135-147)
🔇 Additional comments (7)
custom_components/plugwise/manifest.json (1)

10-11: LGTM! Version bumps align with Anna P1 support.

The dependency bump to plugwise 1.9.0 and the integration version increment to 0.60.0 are consistent with the PR objectives to add Anna P1 support.

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

98-108: LGTM! Clean test implementation for Anna P1 sensor snapshot.

The new test follows the established snapshot testing pattern and appropriately uses the mock_smile_anna_2 fixture to test Anna P1 sensor functionality. The test structure is consistent with other snapshot tests in the file.

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

4266-4430: Anna P1 base sensors look correct

Illuminance, setpoint, and temperature snapshots align on device_class, state_class, and units; names and unique_ids are consistent. Nice addition.


4431-4650: Verify OT water pressure fixture value (6.0 bar)

6.0 bar seems high for typical hydronic loops. If intentional to stress ranges, all good; otherwise consider a realistic value to avoid future confusion.


5435-5541: Gas sensors: confirm state_class choice

Gas cumulative is marked total (m³) and interval is measurement (m³/h). Many integrations use total_increasing for cumulative meters; if your source can reset or isn’t strictly monotonic, total is fine. Just confirm this matches Plugwise behavior.


5711-5766: Outdoor temperature for Smile Anna P1

Entity/state snapshots are consistent with other temperature sensors. No issues.


4651-5434: Snapshots confirmed as correct and complete

The verification confirms that:

  • Test test_anna_p1_sensor_snapshot exists at line 100 of tests/components/plugwise/test_sensor.py
  • Uses the mock_smile_anna_2 fixture as expected
  • The snapshot entries (lines 4651-5434) are properly structured with consistent sensor configurations, translation keys, and units across all P1 electricity sensor variants

All marked sensor behaviors are correct:

  • Cumulative sensors use total_increasing state class with kWh units
  • Interval sensors use total state class with Wh units
  • Point sensors use measurement state class with W units

@bouwew bouwew merged commit 7093646 into main Nov 3, 2025
13 checks passed
@bouwew bouwew deleted the pw-1.9.0 branch November 3, 2025 06:18
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