Fix missed typing update - #909
Conversation
📝 WalkthroughWalkthroughThe PR changes ChangesTyping release update
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
CHANGELOG.mdplugwise/constants.pypyproject.toml
| # Schedules: | ||
| available_schedules: list[str] | ||
| select_schedule: str | None | ||
| select_schedule: str |
There was a problem hiding this comment.
🗄️ 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 || trueRepository: 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')
PYRepository: 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))
PYRepository: 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.



Summary by CodeRabbit