Skip to content

Implement boiler_temperature dict for legacy Anna#893

Draft
bouwew wants to merge 6 commits into
mainfrom
legacy-max-boiler
Draft

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

Conversation

@bouwew

@bouwew bouwew commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Improved legacy Anna heater data handling by representing the current boiler temperature directly within boiler temperature details.
    • Preserved boiler temperature limits, resolution, and setpoint information in the updated format.
  • Tests

    • Updated legacy Anna test scenarios and sample data to reflect the revised temperature representation.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@bouwew, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 50cc5f51-559b-4044-b2e7-d1a3d15d7794

📥 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
📝 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 and the changelog reflect the new representation.

Changes

Legacy Anna boiler temperature

Layer / File(s) Summary
Boiler temperature mapping
plugwise/legacy/helper.py
Actuator data now uses boiler_temperature, with sensors.water_temperature moved into its current field and removed from sensors.
Fixture and changelog alignment
fixtures/legacy_anna/data.json, fixtures/legacy_anna_2/data.json, tests/data/anna/*, CHANGELOG.md
Legacy Anna fixtures and changelog entries reflect the dedicated boiler temperature structure; unrelated array formatting is also expanded in test fixtures.

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 name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a boiler_temperature dict for legacy Anna.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 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 coderabbitai Bot requested a review from CoMPaTech July 10, 2026 17:41
@coderabbitai coderabbitai Bot added the enhancement New feature or request label Jul 10, 2026
@codecov

codecov Bot 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.

@coderabbitai coderabbitai Bot 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 thread plugwise/legacy/helper.py Outdated
@sonarqubecloud

Copy link
Copy Markdown

@bouwew bouwew deployed to testpypi July 10, 2026 17:54 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant