Skip to content

Add v1.14.2 changes to main branch - #905

Merged
bouwew merged 3 commits into
mainfrom
mypy-fix-2
Jul 28, 2026
Merged

Add v1.14.2 changes to main branch#905
bouwew merged 3 commits into
mainfrom
mypy-fix-2

Conversation

@bouwew

@bouwew bouwew commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Expanded service controls to accept numeric or text states.
    • DHW mode duration is now optional and supports numeric or text input.
  • Bug Fixes
    • Added validation to reject unsupported DHW modes, missing durations, and invalid duration values.
  • Documentation
    • Added the v1.14.2 changelog entry.
  • Chores
    • Updated the package version to 1.14.2.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The release broadens service parameter annotations for integer and string values, adds DHW mode and length validation, updates wrapper forwarding, and bumps the package version to 1.14.2.

Changes

Service API updates

Layer / File(s) Summary
Common service parameter typing
plugwise/smile.py, plugwise/__init__.py, plugwise/legacy/smile.py
set_select and set_schedule_state accept int, str, or None state values across API layers.
DHW length handling and release metadata
plugwise/smile.py, plugwise/__init__.py, plugwise/legacy/smile.py, CHANGELOG.md, pyproject.toml
DHW length handling accepts optional string or integer input at wrappers, validates allowed modes and integer lengths in the core API, and records version 1.14.2.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: enhancement, python

Suggested reviewers: compatech

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the release-focused changeset and correctly indicates the v1.14.2 update.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mypy-fix-2

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.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai
coderabbitai Bot requested a review from CoMPaTech July 28, 2026 17:53
@coderabbitai coderabbitai Bot added enhancement New feature or request python Pull requests that update Python code labels Jul 28, 2026
@bouwew
bouwew marked this pull request as ready for review July 28, 2026 17:55
@bouwew
bouwew requested a review from a team as a code owner July 28, 2026 17:55
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f0a667a) to head (1e4aed1).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #905   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         3502      3502           
=========================================
  Hits          3502      3502           

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
plugwise/smile.py (1)

354-407: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Align integer schedule-state typing and runtime behavior across all layers.

set_schedule_state() accepts int | str | None, but rejects numeric inputs before normalizing state, while the wrapper keeps integer states in the typing contract. Keep narrowed string-only states/types, or normalize 0/1 (or accepted numeric values) to canonical "on"/"off" before validation, context construction, and storage/delivery to both current and legacy paths.

🤖 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/smile.py` around lines 354 - 407, Align schedule-state handling
across plugwise/smile.py:354-407, plugwise/smile.py:239-239,
plugwise/__init__.py:356-379, and plugwise/legacy/smile.py:176-199. In
set_schedule_state(), either narrow the accepted type to strings everywhere or
normalize supported integer values such as 0/1 to canonical STATE_OFF/STATE_ON
before validation, determine_contexts(), request delivery, and
_schedule_old_states storage; update the wrapper and both current and legacy
paths consistently, with no direct changes needed at sites already compatible
with the chosen contract.
🤖 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/smile.py`:
- Around line 260-274: Update the DHW setter validation in the relevant smile.py
method to always reject unsupported mode values when _dhw_allowed_modes is
available, while requiring length to be one of the device-supported integer
values. Align the public wrapper in plugwise/__init__.py with this contract by
accepting only the supported length representations and forwarding them
consistently.

---

Outside diff comments:
In `@plugwise/smile.py`:
- Around line 354-407: Align schedule-state handling across
plugwise/smile.py:354-407, plugwise/smile.py:239-239,
plugwise/__init__.py:356-379, and plugwise/legacy/smile.py:176-199. In
set_schedule_state(), either narrow the accepted type to strings everywhere or
normalize supported integer values such as 0/1 to canonical STATE_OFF/STATE_ON
before validation, determine_contexts(), request delivery, and
_schedule_old_states storage; update the wrapper and both current and legacy
paths consistently, with no direct changes needed at sites already compatible
with the chosen contract.
🪄 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 Plus

Run ID: 6aaa98cf-e007-4e06-a95c-92d9eefb34ae

📥 Commits

Reviewing files that changed from the base of the PR and between f0a667a and 1e4aed1.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • plugwise/__init__.py
  • plugwise/legacy/smile.py
  • plugwise/smile.py
  • pyproject.toml

Comment thread plugwise/smile.py
Comment on lines +260 to +274
self, key: str, appl_id: str, mode: str, length: int | str | None = None
) -> None:
"""Set the domestic hot water mode.

Two options are known:
- 2 modes, comfort and off, representing the dhw comfort mode on and off switch states,
- and the 5 modes available on the Loria.
"""
if self._dhw_allowed_modes and mode not in self._dhw_allowed_modes:
raise PlugwiseError("Plugwise: invalid dhw mode.")
if (
self._dhw_allowed_modes
and mode not in self._dhw_allowed_modes
or length is None
or not isinstance(length, int)
):
raise PlugwiseError("Plugwise: invalid dhw mode or invalid dhw modes list.")

@coderabbitai coderabbitai Bot Jul 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg '(^|/)plugwise/(smile\.py|__init__\.py)$' || true

echo "== relevant smile.py section =="
sed -n '220,290p' plugwise/smile.py

echo "== relevant __init__.py section =="
sed -n '430,490p' plugwise/__init__.py

echo "== dhw_allowed_modes and dhw method usages =="
rg -n "_dhw_allowed_modes|dhw_allowed_modes|set_dhw_mode|dh[ _]modes|length" plugwise -S

Repository: plugwise/python-plugwise

Length of output: 7019


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== helper.py dhw mode sections =="
sed -n '70,100p' plugwise/helper.py
sed -n '250,290p' plugwise/helper.py
sed -n '355,375p' plugwise/helper.py
sed -n '480,520p' plugwise/helper.py

echo "== tests mentioning dhw mode/length =="
git ls-files | rg -i 'test.*dhw|dhw.*test|smile|plugwise' | sed -n '1,120p'
rg -n "dhw_mode|dhw_modes|select_dhw_mode|length.*dhw|domestic_hot_water|domestic_hot_water_mode_control_functionality" . -S --glob '!*.pyc'

Repository: plugwise/python-plugwise

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== __init__.py docstring around set_dhw_mode with duration mention =="
rg -n -A 8 -B 8 "Set the domestic hot water heating regulation mode|duration|int| str | None = None" plugwise/__init__.py

echo "== legacy set_dhw_mode for comparison =="
sed -n '120,170p' plugwise/legacy/smile.py

echo "== behavioral model of current validation for missing allowed modes and string/integer lengths =="
python3 - <<'PY'
def current_validation(dhw_allowed_modes, mode, length):
    return (
        dhw_allowed_modes
        and mode not in dhw_allowed_modes
        or length is None
        or not isinstance(length, int)
    )

api_path_allowed = True
api_textual_accepted = False

cases = [
    ("no dhw metadata / mode='comfort' / length=2", None, "comfort", 2),
    ("no dhw metadata / mode='invalid' / length=2", None, "invalid", 2),
    ("no dhw metadata / mode='comfort' / length='short'", None, "comfort", "short"),
    ("lora modes / mode='invalid' / length=2", ["auto", "eco"], "invalid", 2),
    ("lora modes / mode='auto' / length='short'", ["auto", "eco"], "auto", "short"),
    ("supported length not two routes differently / length=3", ["comfort", "eco"], "comfort", 3),
]
for name, dhw_allowed_modes, mode, length in cases:
    print(f"{name}: core_rejected={current_validation(dhw_allowed_modes, mode, length)}")
PY

Repository: plugwise/python-plugwise

Length of output: 10980


Ensure DHW mode validation reaches the device layer.

plugwise/__init__.py allows textual length values, while plugwise/smile.py only rejects text and passes any integer through; when _dhw_allowed_modes is unavailable, invalid mode values bypass rejection on the length != 2 path. Require a supported mode when explicit modes are known and align the public wrapper’s length contract with the accepted values.

📍 Affects 2 files
  • plugwise/smile.py#L260-L274 (this comment)
  • plugwise/__init__.py#L464-L473
🤖 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/smile.py` around lines 260 - 274, Update the DHW setter validation
in the relevant smile.py method to always reject unsupported mode values when
_dhw_allowed_modes is available, while requiring length to be one of the
device-supported integer values. Align the public wrapper in
plugwise/__init__.py with this contract by accepting only the supported length
representations and forwarding them consistently.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignored for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bouwew, acknowledged. I’ll leave this finding unresolved for now. Would you like me to open a follow-up issue for the DHW validation and wrapper-contract alignment?

🐇💭

@bouwew
bouwew merged commit 04f2491 into main Jul 28, 2026
18 checks passed
@bouwew
bouwew deleted the mypy-fix-2 branch July 28, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant