Skip to content

Fix missed typing update - #909

Closed
bouwew wants to merge 2 commits into
mainfrom
select_schedule
Closed

Fix missed typing update#909
bouwew wants to merge 2 commits into
mainfrom
select_schedule

Conversation

@bouwew

@bouwew bouwew commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Corrected the schedule selection data type to accurately indicate that a value is always provided.
  • Documentation
    • Added a changelog entry describing the typing correction.
  • Chores
    • Updated the project version to 1.14.3-1.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR changes GwEntityData.select_schedule from str | None to str. It updates the package version to 1.14.3-1 and adds the corresponding changelog entry.

Changes

Typing release update

Layer / File(s) Summary
Corrected typing and release metadata
plugwise/constants.py, pyproject.toml, CHANGELOG.md
GwEntityData.select_schedule now requires str. The package version and changelog use 1.14.3-1.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested labels: 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.
Title check ✅ Passed The title clearly describes the main change: correcting a missed typing update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch select_schedule

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.

@coderabbitai
coderabbitai Bot requested a review from CoMPaTech August 2, 2026 07:30
@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot added the python Pull requests that update Python code label Aug 2, 2026
@bouwew bouwew closed this Aug 2, 2026

@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

🤖 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/constants.py`:
- Line 587: Update the select_schedule field in GwEntityData and the
_climate_data() construction path to support the Garage fixture’s null value,
either by typing it as str | None or normalizing null before use; preserve
existing behavior for non-null schedules.
🪄 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: 8b9e7a7a-2a7d-4163-84ab-a9868c272334

📥 Commits

Reviewing files that changed from the base of the PR and between 8b41c85 and 84f0ec2.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • plugwise/constants.py
  • pyproject.toml

Comment thread plugwise/constants.py
# Schedules:
available_schedules: list[str]
select_schedule: str | None
select_schedule: str

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg '(^|/)constants\.py$|fixtures/m_adam_multiple_devices_per_zone/data\.json$|TypedDict|GwEntityData' || true

echo "== constants snippet =="
sed -n '560,600p' plugwise/constants.py 2>/dev/null || true

echo "== fixture select_schedule occurrences =="
python3 - <<'PY'
import json
from pathlib import Path
p = Path('fixtures/m_adam_multiple_devices_per_zone/data.json')
if p.exists():
    data = json.loads(p.read_text())
    for k,v in data.items():
        if isinstance(v, dict):
            for kk, vv in v.items():
                if kk == 'select_schedule':
                    print(k, kk, type(vv).__name__, repr(vv)[:240])
else:
    print('fixture missing')
PY

echo "== GwEntityData usages =="
rg -n "class GwEntityData|GwEntityData\(|select_schedule" plugwise fixtures -S || true

Repository: plugwise/python-plugwise

Length of output: 7254


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== GwEntityData definition and surrounding helpers =="
sed -n '440,595p' plugwise/constants.py

echo "== data.py select_schedule construction context =="
sed -n '250,295p' plugwise/data.py

echo "== smile.py select_schedule parser context =="
sed -n '225,265p' plugwise/smile.py

echo "== fixture Garage entity context =="
python3 - <<'PY'
import json
from pathlib import Path
p = Path('fixtures/m_adam_multiple_devices_per_zone/data.json')
data = json.loads(p.read_text())
for cid, entity in data.items():
    if entity.get('device_name') == 'Garage':
        print(json.dumps(entity, indent=2, ensure_ascii=False)[:2500])
        break
PY

echo "== static shape check for presence of select_schedule keys =="
python3 - <<'PY'
import json
from pathlib import Path

for path in sorted(Path('fixtures').rglob('data.json')):
    data = json.loads(path.read_text())
    for cid, entity in data.items():
        if isinstance(entity, dict) and 'select_schedule' in entity:
            val = entity['select_schedule']
            if val is None and str(entity.get('device_name')) != 'Garage':
                other = {k: entity.get(k) for k in ('device_name', 'device_type', 'firmware_version')}
                print(f'{path}:{cid}: device={repr(other)} select_schedule=None')
PY

Repository: plugwise/python-plugwise

Length of output: 8069


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== constants.py full GwEntityData excerpt =="
sed -n '530,610p' plugwise/constants.py

echo "== data.py construction excerpt around GwEntityData creation =="
sed -n '1,130p' plugwise/data.py
echo "---"
sed -n '260,350p' plugwise/data.py

echo "== all exact GwEntityData calls and TypedDict imports =="
rg -n "^from typing import .*TypedDict|TypedDict|GwEntityData\(" plugwise -S || true

echo "== fixture entity body for select_schedule null entity =="
python3 - <<'PY'
import json
from pathlib import Path
p = Path('fixtures/m_adam_multiple_devices_per_zone/data.json')
data = json.loads(p.read_text())
target = '446ac08dd04d4eff8ac57489757b7314'
print(json.dumps({target: data[target]}, indent=2, ensure_ascii=False))
PY

Repository: plugwise/python-plugwise

Length of output: 11041


Keep select_schedule aligned with the Garage fixture.

GwEntityData and _climate_data() require a selected schedule during zone data construction, but fixtures/m_adam_multiple_devices_per_zone/data.json stores "select_schedule": null for the Garage thermostat. If this fixture represents valid gateway data, preserve str | None or normalize null before using this value.

🤖 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/constants.py` at line 587, Update the select_schedule field in
GwEntityData and the _climate_data() construction path to support the Garage
fixture’s null value, either by typing it as str | None or normalizing null
before use; preserve existing behavior for non-null schedules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant