Implement boiler_temperature dict for legacy Anna#893
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughLegacy Anna boiler data is migrated from ChangesLegacy Anna boiler temperature
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
plugwise/legacy/helper.py (1)
344-376: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce 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
📒 Files selected for processing (6)
CHANGELOG.mdfixtures/legacy_anna/data.jsonfixtures/legacy_anna_2/data.jsonplugwise/legacy/helper.pytests/data/anna/legacy_anna.jsontests/data/anna/legacy_anna_2.json
|



Summary by CodeRabbit
boiler_temperaturestructure that includes a livecurrentvalue.