Fix watch complication gauge ignoring edited min/max range - #5322
Conversation
The editor's Minimum/Maximum fields store only the edited bound in the per-family options, but gaugeRange(for:) required both per-family bounds before using them — so setting just Maximum (e.g. 40 over the default 0-100) silently kept gauging against the base range, leaving the gauge dot at value/100 instead of value/max. Resolve each bound independently (per-size override, then base), which matches exactly what the editor's fields display. A resolved range that is invalid (max <= min) now hides the gauge instead of falling back to the base range the user no longer sees.
There was a problem hiding this comment.
🟢 Ready to approve
The change is narrowly scoped, aligns with the described bug, and is backed by targeted unit tests for the regression and related edge cases.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Fixes how Apple Watch complication gauge ranges are resolved when only one of Minimum/Maximum is edited in per-family options, ensuring the gauge scales against the range the editor actually displays.
Changes:
- Update
WatchComplicationConfig.gaugeRange(for:)to resolve min/max independently (per-family override → base) and validate the final range. - Add unit tests covering base range, full override, partial override (min-only / max-only), per-family isolation, and invalid resolved ranges.
File summaries
| File | Description |
|---|---|
| Tests/Shared/WatchComplicationConfigGaugeRange.test.swift | Adds regression + coverage tests for gauge range resolution across override scenarios. |
| Sources/HAModels/Sources/WatchComplicationConfig.swift | Fixes gauge range resolution logic to correctly combine per-family overrides with base bounds. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
Found 4 unused localization strings in the codebase. Click to see detailsTo remove them, run the |
AI Policy
Select exactly one option that describes AI usage in this contribution:
Summary
Fixes the watch complication gauge not respecting an edited Minimum/Maximum range. The editor stores only the bound the user actually edited in the per-size options, but
gaugeRange(for:)required both per-size bounds before using them — so setting just Maximum (e.g. 40 over the default 0–100) silently kept scaling the gauge against 0–100, leaving the dot at value/100 instead of value/max.Each bound now resolves independently (per-size override → base), matching exactly what the editor's fields display. Added unit tests covering the regression and the surrounding range-resolution cases.
Screenshots
Reported via in-app feedback: with Minimum 0 / Maximum 40 and a value of 31, the gauge dot sat at ~31% of the arc instead of ~77%. After the fix the dot position matches the configured range.
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
Bug fix only — no documentation change needed.
Generated by Claude Code