Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Jan 1, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error messages now include underlying error details for improved troubleshooting
    • Improved validation for group and gateway entity handling to avoid empty or invalid groups
    • Refined data retrieval and availability checks with a safer processing order
    • Better notification management for gateway entities
  • Tests

    • Updated test data with new gateway configuration entries
  • Documentation

    • Added an "Ongoing" entry to the changelog

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 1, 2026

Walkthrough

Refactors group/member collection and thermostat/location helpers, reorders entity update logic, moves appliance offset helper between modules, and improves error messages to include original exception details; also updates test fixture data with two new thermostat group entries.

Changes

Cohort / File(s) Summary
Error message updates
plugwise/__init__.py, plugwise/legacy/smile.py, plugwise/smile.py
Raised errors now include the original exception details in their messages (e.g., DataMissingError / PlugwiseError message strings).
Group member collection & group entries
plugwise/common.py
Added _collect_members(element); _get_groups() now skips invalid/no-ID groups, uses _collect_members(), requires non-empty members and allowed group types, and stores name and vendor on group entries.
Entity update flow & notifications
plugwise/data.py
_add_or_update_notifications() constrained to gateway-only and deduplicates notifications; _get_entity_data() reorders availability checks (Adam/Anna processing, switching-group update, deferred OpenTherm/smartmeter checks).
Helper/location & thermostat ranking
plugwise/helper.py
_get_locations() now initializes minimal { "name": loc.name }; removed private _get_appliances_with_offset_functionality() from helper; _match_and_rank_thermostats() augments location dicts with primary, primary_prio, secondary during ranking.
Appliance offset helper moved / added
plugwise/smile.py
Added _get_appliances_with_offset_functionality() in SmileAPI; invoked from get_all_gateway_entities() to collect appliances supporting temperature_offset before thermostat-specific scanning.
Test fixture additions
tests/data/adam/adam_plus_anna_new_UPDATED_DATA.json
Added two new top-level entries containing thermostats.primary / thermostats.secondary assignments.
Changelog
CHANGELOG.md
Added an "Ongoing" entry referencing PR[#843].

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant SmileAPI as Smile API
  participant DataModule as data.py
  participant Gateway
  participant Adam
  participant Anna
  participant DB as EntitiesStore

  Note over Client,SmileAPI: Trigger: async_update / get_all_gateway_entities
  Client->>SmileAPI: request update
  SmileAPI->>Gateway: fetch XML / appliance list
  Gateway-->>SmileAPI: XML data
  SmileAPI->>SmileAPI: _get_appliances_with_offset_functionality()  %%#00A1D6 light blue
  SmileAPI->>DataModule: provide appliances + offset-capable list
  DataModule->>Adam: process Adam-specific data
  Adam-->>DataModule: Adam results
  DataModule->>DataModule: update switching-group status
  DataModule->>Anna: process Anna data
  Anna-->>DataModule: Anna results
  DataModule->>DataModule: deferred OpenTherm / smartmeter availability checks
  DataModule->>DB: write/update entities (groups, notifications, availability)
  DB-->>Client: consolidated update result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

quality

Suggested reviewers

  • CoMPaTech

Poem

🐰 I hopped through XML and code,

I gathered groups along the road,
Error tales now tell the why,
Offsets found beneath the sky,
A little hop — the tests now glow!

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'More improvements' is vague and generic, using non-descriptive language that fails to convey specific information about the substantial changes in this PR. Replace with a specific title that highlights the main change, such as 'Refactor thermostat location data and group member collection' or 'Improve error messages and consolidate entity update logic'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improve-6

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e939d8 and 501decb.

📒 Files selected for processing (1)
  • CHANGELOG.md
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run mypy

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.

@codecov
Copy link

codecov bot commented Jan 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4dc0121) to head (501decb).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #843   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         3435      3443    +8     
=========================================
+ Hits          3435      3443    +8     

☔ View full report in Codecov by Sentry.
📢 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.

@bouwew bouwew marked this pull request as ready for review January 2, 2026 18:31
@bouwew bouwew requested a review from a team as a code owner January 2, 2026 18:31
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 3, 2026

@bouwew bouwew merged commit 7075d16 into main Jan 3, 2026
18 checks passed
@bouwew bouwew deleted the improve-6 branch January 3, 2026 08:29
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