Skip to content

Implement Core PR #163713#1024

Merged
bouwew merged 9 commits intomainfrom
core-163713
Feb 24, 2026
Merged

Implement Core PR #163713#1024
bouwew merged 9 commits intomainfrom
core-163713

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Feb 24, 2026

Summary by CodeRabbit

  • New Features

    • Enhanced HVAC mode management with improved handling of heating, cooling, and automatic modes.
    • Improved climate state preservation and restoration during transitions.
    • Better preset and temperature control operations.
  • Version

    • Updated to v0.63.1 with Core integration improvements.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

This PR bumps the Plugwise integration to v0.63.1, introduces direct API access in climate entities via a dedicated _api attribute, and significantly expands HVAC mode handling logic to support schedule restoration and regulation state management across different climate operating modes.

Changes

Cohort / File(s) Summary
Version Bumps
CHANGELOG.md, custom_components/plugwise/manifest.json, pyproject.toml
Version updated from 0.63.0 to 0.63.1 across manifest and project configuration; changelog entry added documenting Core PR integration via PR #1024 and Core PR #163713.
Climate Entity API Refactoring
custom_components/plugwise/climate.py
Introduced _api attribute for direct API access, replacing coordinator.api references. Updated PlugwiseClimateExtraStoredData.as_dict() to use asdict(self). Significantly expanded async_set_hvac_mode to handle OFF mode, manual modes (HEAT/COOL/HEAT_COOL) with/without schedule preservation, and AUTO mode with schedule restoration and error handling. Added helper methods for mode mapping and manual/auto mode setting logic.
Climate Test Updates
tests/components/plugwise/test_climate.py
Updated test fixtures and assertions to reflect new state restoration behavior. Changed parameter names in test functions (init_integration → mock_config_entry). Expanded test scenarios to validate schedule restoration paths, regulation state management, and HVAC mode transitions from restored states.

Sequence Diagram

sequenceDiagram
    participant User as Climate Entity
    participant API as Plugwise API
    participant Schedule as Schedule Manager
    participant Regulation as Regulation Manager

    User->>API: set_hvac_mode(mode)
    
    alt Mode is OFF
        API->>Regulation: set_regulation_mode(OFF)
        Regulation-->>API: confirmed
    else Mode is HEAT/COOL/HEAT_COOL
        alt Schedule exists
            API->>Schedule: set_schedule_state(enabled=true)
            Schedule-->>API: confirmed
            API->>Regulation: set_regulation_mode(manual_mode)
            Regulation-->>API: confirmed
        else No schedule
            API->>Regulation: set_regulation_mode(manual_mode)
            Regulation-->>API: confirmed
        end
    else Mode is AUTO
        alt Last active schedule available
            API->>Schedule: set_schedule_state(last_active_schedule)
            Schedule-->>API: confirmed
            API->>Regulation: set_regulation_mode(AUTO)
            Regulation-->>API: confirmed
        else No schedule available
            API->>User: error_no_schedule
        end
    end
    
    API-->>User: mode_set_complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

  • Store the last_used_schedule for reuse #945: Both PRs modify climate entity state restoration logic, specifically handling last_active_schedule and previous_action_mode in PlugwiseClimateExtraStoredData and updating async_set_hvac_mode behavior.
  • Bump Plugwise to v1.6.4 and adapt #793: Both PRs refactor HVAC mode and action logic in the climate integration, altering how modes are set and managed within PlugwiseClimateEntity.
  • Remove homekit option #1023: Both PRs modify climate entity construction and async_set_hvac_mode implementation, introducing changes to how the entity accesses and applies HVAC state.

Suggested reviewers

  • CoMPaTech
  • github-actions
🚥 Pre-merge checks | ✅ 3
✅ 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 'Implement Core PR #163713' directly references the core upstream PR being implemented, which aligns with the PR objectives and the changelog entry documenting the Core PR integration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch core-163713

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.

@coderabbitai coderabbitai bot requested a review from CoMPaTech February 24, 2026 17:11
@coderabbitai coderabbitai bot added enhancement New feature or request needs_upstreaming Things that are here in -beta but must be upstreamed to HA-core labels Feb 24, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@custom_components/plugwise/translations/en.json`:
- Around line 1-347: The JSON file's keys are not sorted/formatted per the
project's Prettier/JSON sorting CI rule (affecting top-level keys like "config",
"entity", "exceptions", "options", "services" and nested keys such as
"config.abort", "entity.sensor", etc.); re-run the project's formatter (Prettier
or the repository's JSON sorting tool) on this file (and any other JSON you
modified), stage the updated sorted/formatted JSON, and commit that change so CI
no longer reports sorting differences.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8951131 and 705b28a.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • custom_components/plugwise/climate.py
  • custom_components/plugwise/manifest.json
  • custom_components/plugwise/translations/en.json
  • pyproject.toml
  • tests/components/plugwise/test_climate.py

@sonarqubecloud
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@custom_components/plugwise/climate.py`:
- Around line 306-347: When handling HVACMode.OFF in set_hvac_mode, first
disable any active schedule before calling self._api.set_regulation_mode to
avoid the schedule re-enabling and overriding the OFF state on next refresh;
specifically, read the current schedule from self.device.get("select_schedule"),
store it to self._last_active_schedule if it isn’t already "off", call the API
to set the schedule to "off" (or use the existing schedule API call) and only
then call self._api.set_regulation_mode(hvac_mode.value); follow the same
pattern used by _set_manual_hvac_mode and _set_auto_hvac_mode to ensure
_last_active_schedule is preserved and schedules are turned off before setting
regulation to OFF.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 705b28a and 50bf592.

📒 Files selected for processing (1)
  • custom_components/plugwise/climate.py

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

@bouwew bouwew marked this pull request as ready for review February 24, 2026 18:29
@bouwew bouwew requested a review from a team as a code owner February 24, 2026 18:29
@bouwew bouwew merged commit 34a4b23 into main Feb 24, 2026
13 checks passed
@bouwew bouwew deleted the core-163713 branch February 24, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs_upstreaming Things that are here in -beta but must be upstreamed to HA-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants