Repository navigation
Fetch WG5 thermostat control data per zone - #701
Merged
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
zones/{zoneId}/control/thermostatsreturns the same control data asthermostats/{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).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.jsonfixture 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}/controlfor 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