Skip to content

Fetch WG5 thermostat control data per zone - #701

Merged
robbinjanssen merged 1 commit into
mainfrom
perf/wg5-zone-control
Oct 17, 2026
Merged

robbinjanssen merged 1 commit into
mainfrom
perf/wg5-zone-control

Conversation

@robbinjanssen

Copy link
Copy Markdown
Owner

Proposed Changes

The WG5 API fetched three resources per thermostat on every update: its control data, its details and its schedule. This reduces the number of requests:

  • Control data per zone. zones/{zoneId}/control/thermostats returns the same control data as thermostats/{id}/control, for all thermostats in a zone. A user shared an (anonymized) response in Request - Add support for UWG5 home-assistant-ojmicroline-thermostat#302, and its fields match the existing control fixture exactly. One request per zone now replaces one request per thermostat. The endpoint is paginated, so all pages are fetched (100 thermostats per page).
  • Schedules once per update. Thermostats that share a schedule no longer fetch it again. Each thermostat still gets its own copy.
  • Empty zones are skipped, without a request.
  • Details stay per thermostat, as only thermostats/{id} provides the floor and room temperature and the software version.

For a building with one zone and three thermostats sharing a schedule, an update goes from 12 to 8 requests. The savings grow with the number of thermostats per zone.

The new wg5_zone_thermostats.json fixture wraps the existing control fixture in the zone response. Tests cover the zone endpoint, pagination, a shared schedule and empty zones. Coverage stays at 100%.

Note for the Home Assistant integration

The integration's tests mock thermostats/{id}/control for WG5. When bumping to the release that includes this change, they need to mock the zone endpoint with the new fixture instead.

🤖 Generated with Claude Code

`zones/{id}/control/thermostats` returns the same control data as
`thermostats/{id}/control` for all thermostats in a zone, so one request
per zone replaces one request per thermostat. Schedules are fetched once
per update, also when thermostats share a schedule, and zones without
thermostats are skipped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@robbinjanssen robbinjanssen added the performance Improving performance, not introducing new features. label Oct 17, 2026
@robbinjanssen
robbinjanssen merged commit f8baaa7 into main Oct 17, 2026
11 checks passed
@robbinjanssen
robbinjanssen deleted the perf/wg5-zone-control branch October 17, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Improving performance, not introducing new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant