Implement boiler_temperature dict for legacy Anna by bouwew · Pull Request #893 · plugwise/python-plugwise · GitHub
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

bouwew merged 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
    • 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

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

@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 marked this pull request as ready for review July 11, 2026 06:12
@bouwew
bouwew requested a review from a team as a code owner July 11, 2026 06:12
@bouwew
bouwew merged commit 2c64b0d into main Jul 11, 2026
18 checks passed
@bouwew
bouwew deleted the legacy-max-boiler branch July 11, 2026 06:22
@coderabbitai coderabbitai Bot mentioned this pull request Jul 31, 2026

This branch was previously deployed

2 inactive deployments
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