Skip to content

Implement boiler_temperature dict for legacy Anna - #893

Merged
bouwew merged 6 commits into
mainfrom
legacy-max-boiler
Jul 11, 2026
Merged

Implement boiler_temperature dict for legacy Anna#893
bouwew merged 6 commits into
mainfrom
legacy-max-boiler

Conversation

@bouwew

@bouwewbouwew commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Enhanced legacy Anna heater telemetry parsing by consolidating water/boiler temperature into a single boiler_temperature structure that includes a live current value.
  • Bug Fixes
    • Normalized legacy payloads so temperature readings no longer appear redundantly in the sensors map when represented in the consolidated structure.
  • Tests
    • Updated legacy Anna test fixtures to match the revised temperature payload shape and formatting.
  • Chores
    • Bumped the package version and updated the changelog entry for this release.

@coderabbitai

coderabbitaiBot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f9080589-da86-4615-b952-80e71f63ef5c

📥 Commits

Reviewing files that changed from the base of the PR and between 43f7da0 and a53b02a.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • plugwise/common.py
  • plugwise/helper.py
  • plugwise/legacy/helper.py
  • pyproject.toml
💤 Files with no reviewable changes (1)
  • plugwise/helper.py
✅ Files skipped from review due to trivial changes (2)
  • pyproject.toml
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

Legacy Anna boiler data is migrated from maximum_boiler_temperature plus a separate water sensor to a dedicated boiler_temperature object containing the current value. Fixtures, release metadata, and the changelog reflect the new representation.

Changes

Legacy Anna boiler temperature

Layer / File(s)Summary
Boiler temperature mapping
plugwise/common.py, plugwise/legacy/helper.py
Actuator processing now normalizes temperature keys and moves matching sensor readings into the current field of the returned temperature dictionary.
Fixture and release alignment
fixtures/legacy_anna*/data.json, tests/data/anna/*, CHANGELOG.md, pyproject.toml
Legacy Anna fixtures, test formatting, changelog entries, and package version reflect the updated release and temperature structure.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels:enhancement

Suggested reviewers:CoMPaTech

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly matches the main change: adding a boiler_temperature dict for legacy Anna.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch legacy-max-boiler

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.

@coderabbitai
coderabbitaiBot requested a review from CoMPaTechJuly 10, 2026 17:41
@coderabbitaicoderabbitaiBot added the enhancement New feature or request label Jul 10, 2026
@codecov

codecovBot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d2a92e5) to head (a53b02a).

Additional details and impacted files
@@ Coverage Diff @@## main #893 +/- ##
=========================================
Coverage 100.00% 100.00% =========================================
Files 21 21 Lines 3502 3503 +1 =========================================
+ Hits 3502 3503 +1 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

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)
plugwise/legacy/helper.py (1)

344-376: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reduce cognitive complexity to satisfy SonarCloud threshold.

SonarCloud reports cognitive complexity 17 (limit 15) for _get_actuator_functionalities. Extracting the boiler-temperature migration logic into a small helper method would reduce complexity and improve testability. This also resolves the scoping concern raised above.

♻️ Suggested extraction
+ def _migrate_boiler_temperature(+ self, temp_dict: ActuatorData, data: GwEntityData+ ) -> None:+ """Move water_temperature sensor into boiler_temperature.current."""+ if "water_temperature" in data["sensors"]:+ temp_dict["current"] = data["sensors"]["water_temperature"]+ data["sensors"].pop("water_temperature")+
def _get_actuator_functionalities(
self, xml: etree.Element, data: GwEntityData
) -> None:
...
if temp_dict:
if item == "maximum_boiler_temperature":
item = "boiler_temperature"
- if "water_temperature" in data["sensors"]:- temp_dict["current"] = data["sensors"]["water_temperature"]- data["sensors"].pop("water_temperature")+ self._migrate_boiler_temperature(temp_dict, data)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plugwise/legacy/helper.py` around lines 344 - 376, Reduce cognitive
complexity in _get_actuator_functionalities by extracting the boiler-temperature
migration and water_temperature transfer into a dedicated helper method. Have
the helper update the actuator item and temp_dict, then invoke it before casting
and storing the actuator data; preserve the existing behavior and make the
helper independently testable.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugwise/legacy/helper.py`:
- Around line 369-374: The water_temperature migration currently runs for
unrelated items and may remove the sensor prematurely. In the item-processing
logic, scope the water_temperature lookup, temp_dict["current"] assignment, and
sensor removal inside the if item == "maximum_boiler_temperature" branch,
alongside the item rename to boiler_temperature.
---
Nitpick comments:
In `@plugwise/legacy/helper.py`:
- Around line 344-376: Reduce cognitive complexity in
_get_actuator_functionalities by extracting the boiler-temperature migration and
water_temperature transfer into a dedicated helper method. Have the helper
update the actuator item and temp_dict, then invoke it before casting and
storing the actuator data; preserve the existing behavior and make the helper
independently testable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f63dd7a5-7c19-4148-8b56-78f1e9c04e23

📥 Commits

Reviewing files that changed from the base of the PR and between d2a92e5 and 43f7da0.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • fixtures/legacy_anna/data.json
  • fixtures/legacy_anna_2/data.json
  • plugwise/legacy/helper.py
  • tests/data/anna/legacy_anna.json
  • tests/data/anna/legacy_anna_2.json

Comment threadplugwise/legacy/helper.py Outdated
@sonarqubecloud

Copy link
Copy Markdown

@bouwew
bouwew marked this pull request as ready for review July 11, 2026 06:12
@bouwew
bouwew requested a review from a team as a code ownerJuly 11, 2026 06:12
@bouwew
bouwew merged commit 2c64b0d into mainJul 11, 2026
18 checks passed
@bouwew
bouwew deleted the legacy-max-boiler branch July 11, 2026 06:22
@coderabbitaicoderabbitaiBot mentioned this pull request Jul 31, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@bouwew