Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Jul 16, 2025

Summary by CodeRabbit

  • New Features

    • Added schedule-related fields to climate zone and device data, ensuring "available_schedules" and "select_schedule" are always present.
  • Bug Fixes

    • Improved handling of mode-related fields so they only appear when relevant configuration is available.
  • Tests

    • Updated test data and assertions to reflect changes in schedule and mode fields, ensuring alignment with the new data structure.
  • Chores

    • Updated project version to 1.7.8.
    • Refined changelog to reflect stable release and fixes related to select-platform-data for Home Assistant Core integrations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 16, 2025

"""

Walkthrough

The changes update how schedule-related fields are handled in fixture, source, and test data. Schedule keys are now always present with default values, and mode-related fields are conditionally included based on allowed modes. Test assertions and type annotations are adjusted to match these data structure changes.

Changes

Files/Paths Change Summary
fixtures/adam_jip/data.json
fixtures/m_adam_jip/data.json
Added "available_schedules": [] and "select_schedule": null to multiple climate zone objects.
fixtures/legacy_anna/data.json Added "available_schedules": [] and "select_schedule": null to a device object.
fixtures/adam_multiple_devices_per_zone/data.json
fixtures/adam_zone_per_device/data.json
fixtures/adam_plus_anna/data.json
tests/data/adam/adam_multiple_devices_per_zone.json
tests/data/adam/adam_zone_per_device.json
tests/data/adam/adam_plus_anna.json
Removed "select_regulation_mode": "heating" from specific device objects.
fixtures/m_adam_multiple_devices_per_zone/data.json Added schedule keys to one device; removed "select_regulation_mode" from another.
plugwise/constants.py Made select_schedule type annotation optional (`str
plugwise/data.py
plugwise/legacy/data.py
Always initialize schedule keys with default values in data dictionaries; moved/incremented count logic accordingly.
plugwise/helper.py Only set mode-related fields if corresponding allowed modes are present; reordered a condition for clarity.
scripts/manual_fixtures.py Retain schedule keys in fixture, set to empty/neutral values instead of removing.
tests/test_adam.py
tests/test_legacy_anna.py
Adjusted expected entity_items counts in test assertions.

Sequence Diagram(s)

sequenceDiagram
    participant SourceData
    participant DataBuilder
    participant Consumer

    SourceData->>DataBuilder: Provide device/zone data
    DataBuilder->>DataBuilder: Initialize available_schedules = []\nselect_schedule = None
    alt Schedules available
        DataBuilder->>DataBuilder: Update keys with actual schedules and selection
    end
    DataBuilder->>Consumer: Return data with consistent schedule keys
Loading

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • CoMPaTech

Poem

In the warren of code, a schedule appears,
With empty lists and None—no more fears!
Mode keys now check if they're truly allowed,
Test counts adjusted, the rabbits are proud.
Consistency hops through each JSON field,
A bug-free meadow, the changes revealed! 🐇
"""


📜 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 d359f28 and a3297f3.

📒 Files selected for processing (1)
  • plugwise/helper.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugwise/helper.py
⏰ 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: Check commit
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-avail-schedules

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e8be5d9) to head (a3297f3).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #771   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         3382      3388    +6     
=========================================
+ Hits          3382      3388    +6     

☔ 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.

@sonarqubecloud
Copy link

@bouwew bouwew changed the title Fix for pw-beta issue #897 Implement fixes related to the select-platform-data provided to the HA Core integrations, part of solving pw-beta issue #897 Jul 16, 2025
@bouwew bouwew marked this pull request as ready for review July 16, 2025 14:00
@bouwew bouwew requested a review from a team as a code owner July 16, 2025 14:00
@bouwew bouwew merged commit 71df2e3 into main Jul 16, 2025
17 checks passed
@bouwew bouwew deleted the fix-avail-schedules branch July 16, 2025 14:06
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