Skip to content

Add a typed weekly-schedule API for ZHA climate entities - #1032

Draft
ICEMANno1 wants to merge 1 commit into
zigpy:devfrom
ICEMANno1:copilot/bosch-trv-weekly-schedule
Draft

ICEMANno1 wants to merge 1 commit into
zigpy:devfrom
ICEMANno1:copilot/bosch-trv-weekly-schedule

Conversation

@ICEMANno1

@ICEMANno1 ICEMANno1 commented Nov 17, 2026 •

Copy link
Copy Markdown

Proposed change

Add a typed weekly-schedule provider API to ZHA climate entities and implement the standard ZCL Thermostat-cluster schedule commands. Quirks opt in by declaring a registered schedule capability; device-family transport differences can be implemented behind the shared provider interface.

The provider supports fresh reads, explicit cache-only reads, schedule snapshots, validated seven-day uploads, per-day read-back verification, and clear operations. Uploads first read fresh heat limits and all seven days, then write and verify days serially. Partial failures report changed, unknown, and unattempted days; the library does not automatically retry or roll back. The thermostat's mode and clock are not changed.

The existing raw cluster-command API gains an opt-in response return, leaving calls that do not request a response unchanged.

Tests

  • Weekly-schedule climate tests: 56 passed.
  • Raw cluster-command response tests: 3 passed.
Architecture and design decisions
  • Bosch-specific API vs reusable library API: use a generic WeeklyScheduleProvider and capability registry, with standard ZCL operations in a reusable provider; keep model-specific support in quirks.
  • New schedule entity vs climate API: expose schedule methods through the existing ZHA climate entity API; do not create a separate climate or calendar entity in the library.
  • Fresh reads vs cache: fresh reads are the default. Cache-only reads are explicit, include timestamps, and distinguish unknown (null) from known-empty ([]) days. The in-memory cache does not claim to detect changes made outside ZHA.
  • Upload safety: validate the full week before writes; read fresh device heat limits and the pre-write schedule; write and verify one day at a time; surface partial outcomes without application-level retries or automatic rollback.
  • Transition limits: do not enforce unverified device-reported maxima. Enforce representability and transport constraints, and surface device errors.
  • Heat/cooling: the current standard provider is heat-only. Clearing uses the standard clear command, which clears the whole device schedule; the snapshot and verification cover heat only.
  • Raw response compatibility: raw-command responses are opt-in so existing service behavior remains unchanged by default.
Related pull requests

Existing Bosch support:

Weekly-schedule series:

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@puddly

puddly commented Nov 17, 2026

Copy link
Copy Markdown
Member

Thanks for the PR.

What calls Thermostat.async_set_weekly_schedule and Thermostat.async_get_weekly_schedule? These aren't used by Home Assistant's climate entity.

@ICEMANno1

Copy link
Copy Markdown
Author

Hi @puddly and thanks for the reply.

wrt

we first need to discuss this as an architectural change

I usually would agree, but I didn't see any other reasonable way. Which is why I documented "Architecture and design decisions" in each of the PRs to document the possibilities and thoughts and why some of them got discarded.

Nevertheless, I'm very much open minded to any suggestions and discussions to simplify the whole topic and create PRs which are reasonable to merge.

Feel free to ask anything and I'll either point you into one of the existing PRs descriptions or will answer it.

Looking forward to a gr8 collaboration 💪

P.S: Thee PRs here are related to some other "Existing Bosch support" mentioned as well as the timezone PR we did in the past. Order was: first timezone, then common "bosch thermostat missing support" and then grand finale "weekly schedule" 😇

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

Labels

new feature Adds new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants