Skip to content

Conversation

bouwew
Copy link
Contributor

@bouwew bouwew commented Oct 8, 2025

All changes:

  • Fix entity-items counting
  • Refresh/complete test-data-json files

Summary by CodeRabbit

  • Bug Fixes

    • Corrected entity item counting for groups and thermostats, ensuring accurate totals in the interface.
  • Chores

    • Refreshed device datasets to include notifications, vendor, and model details across Adam/Anna/P1/Stretch variants.
    • Removed an obsolete switch group from sample data.
  • Tests

    • Updated expected entity counts across Adam, Anna (legacy), and Stretch scenarios to match corrected totals.
  • Documentation

    • Added changelog entry noting entity count fix and refreshed test data.

Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Walkthrough

Incremented internal entity counters in several processing paths and reordered a dictionary key. Test fixtures were updated with new metadata fields (notifications, vendor, model) and one switchgroup removed. Corresponding tests have been updated to expect higher entity counts to match the adjustments.

Changes

Cohort / File(s) Summary
Core counters & dict order
plugwise/common.py, plugwise/helper.py
Increased internal counters used during group-switch and thermostat-zone processing (group-switch +1; thermostat zone counter increment adjusted). Reordered zigbee_mac_address key placement in emitted gateway entities (no logic change).
Legacy Anna counter
plugwise/legacy/data.py
Added self._count increment in _get_anna_control_state.
Adam fixtures
tests/data/adam/*
Added notifications (often {}) to Adam gateway entries; added vendor: "Plugwise" and model: "ThermoZone" to several devices; removed one switchgroup in adam_multiple_devices_per_zone.json. Files: .../adam_heatpump_cooling.json, .../adam_jip.json, .../adam_multiple_devices_per_zone.json, .../adam_onoff_cooling_fake_firmware.json, .../adam_plus_anna*.json, .../adam_zone_per_device.json.
Anna fixtures
tests/data/anna/*
Added notifications: {} to Smile Anna gateway entries across multiple datasets. Files: .../anna_elga_2*.json, .../anna_elga_no_cooling.json, .../anna_heatpump_*.json, .../anna_loria_*.json, .../anna_v4*.json, .../anna_without_boiler_fw441.json.
P1 fixtures
tests/data/p1/p1v4_442_single.json, tests/data/p1/p1v4_442_triple.json
Added notifications (empty or with warning) to Smile P1 device objects.
Stretch fixtures
tests/data/stretch/*
Added vendor: "Plugwise" to switchgroup device entries and minor trailing-comma/field placement adjustments. Files: .../stretch_v23.json, .../stretch_v31.json.
Tests expected counts
tests/test_adam.py, tests/test_legacy_anna.py, tests/test_legacy_stretch.py
Updated expected entity_items numeric assertions upward to reflect counter increments and fixture additions.
Changelog
CHANGELOG.md
Added entry: "Fix entity_item counting, refresh/complete test-data-json files via [#794]".

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • CoMPaTech

Poem

I twitched my nose and counted twice,
A hop, a skip—an extra slice.
Gateways now carry tiny notes,
Models, vendors, softer votes.
Tests grew teeth and learned to sing—
Hooray! The bunny did a thing. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Fix entity-items counting” succinctly captures the core change by directly referencing the adjustment to entity item counting, which is the primary intent of the pull request.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_count

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58ea5ec and d8e45bd.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
✅ 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.

Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d20c3f3) to head (d8e45bd).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #794   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         3388      3389    +1     
=========================================
+ Hits          3388      3389    +1     

☔ 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 October 8, 2025 17:06
@bouwew bouwew requested a review from a team as a code owner October 8, 2025 17:06
@bouwew bouwew requested a review from CoMPaTech October 8, 2025 17:08
Copy link

sonarqubecloud bot commented Oct 8, 2025

Copy link
Member

@CoMPaTech CoMPaTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird that we never got feedback before on that?
Looking good though!

@bouwew bouwew merged commit c85ac4f into main Oct 8, 2025
18 checks passed
@bouwew bouwew deleted the fix_count branch October 8, 2025 18:00
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.

2 participants