Repository navigation
feat: add get_schedule/set_schedule for heating and hot water - #173
Conversation
Adds ScheduleMixin (src/devices/schedule.py), composed into HiveHeating and HiveHotwater. get_schedule returns an editable copy of the weekly schedule; set_schedule validates and normalises the week, posts all seven days (Hive only accepts full-week updates), then re-reads the product and returns False if Hive silently ignored the change. camelCase aliases getSchedule/setSchedule are included for HA compatibility. Verified live on a trvcontrol zone: slot edit stored and restored correctly. Closes Pyhass#19 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #173 +/- ##
======================================
Coverage ? 99.96%
======================================
Files ? 31
Lines ? 2717
Branches ? 323
======================================
Hits ? 2716
Misses ? 0
Partials ? 1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
🤖 Claude Code ReviewLooks good to merge. I found no blocking bugs, and the change is additive only. Bugs: none confirmed. Should fix (minor, not blocking):
Minor:
Home Assistant check: I fetched Not reviewed: I did not run the test suite and did not read Automated review by Claude Code · workflow run |
Summary
Adds schedule writing for heating and hot water, requested in #19.
ScheduleMixin(src/devices/schedule.py), composed intoHiveHeatingandHiveHotwater.get_schedule(device)returns an editable deep copy of the seven-day schedule.set_schedule(device, schedule)validates and normalises the week (drops extra keys the Hive web app adds, sorts slots, raisesValueErroron bad input), posts all seven days (Hive only accepts full-week updates), then re-reads the product and returnsFalseif Hive answered 200 but ignored the change.getSchedule/setScheduleinhelper/compat_aliases.py.examples/example_set_schedule.py, a round-trip example that edits one slot, verifies it, and restores the original.Home Assistant impact
Additive only. Nothing in the HA
hiveintegration calls these methods;climate.pyandwater_heater.pyondevusesetMode,setTargetTemperature,setBoostOn/Offonly. No existing method, return shape ordevice.statuskey changes.Testing
trvcontrolzone: slot edit stored and restored correctly (set_schedulereturnedTrueboth times, re-read schedules matched).hotwaterproduct to test against. Someone with a Hive hot water zone could confirm with the example (swaphive.heatingforhive.hotwater).Note: running the example against the live service today also needs #169, since the Hive SSO login page changed on 2026-10-20.
Closes #19
🤖 Generated with Claude Code