feat(climate): normalize setpoint when device temperature precision is 1°C#189
Open
nao-pon wants to merge 2 commits into
Open
feat(climate): normalize setpoint when device temperature precision is 1°C#189nao-pon wants to merge 2 commits into
nao-pon wants to merge 2 commits into
Conversation
### Summary
This change normalizes requested target temperatures to match the 1°C
resolution air conditioners when receiving values from Matter
controllers (e.g., Google Home).
Matter Thermostat clusters allow high-resolution setpoints (e.g.,
0.5°C), while
many HVAC devices only support integer temperature settings. This
mismatch
can lead to confusing UX where controllers accept fractional values but
the device
must coerce them to discrete steps.
### What this PR does
- Introduces `_normalize_settemp()` to convert requested temperatures
into valid
integer setpoints before sending them to the device.
- Applies direction-aware rounding for `.5°C` inputs:
- If the requested value increases relative to the previous setpoint,
it rounds up.
- If it decreases, it rounds down.
- Uses nearest-integer rounding for other fractional values.
- Ensures device behavior aligns with user intent when operating via
Matter bridges
or external controllers.
### Why this is needed
Some Matter controllers expose 0.5°C adjustment even when the
underlying HVAC only
supports 1°C steps. Without normalization:
- The device silently coerces values, appearing unresponsive.
- UI and actual device state can appear inconsistent.
- Users may perceive this as a synchronization bug.
By normalizing inside the integration, we provide deterministic behavior
and better
cross-platform interoperability.
### Scope
- No change for integrations already sending integer values.
- Only affects temperature writes (`async_set_temperature`).
- Does not modify device read/state logic.
### Notes
This is particularly relevant for multi-controller Matter environments
where
resolution differences between the abstract data model and physical HVAC
devices
become visible.
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.
Summary
Apply temperature normalization when the configured device precision is 1°C to
avoid mismatches between Matter controllers and HVAC devices that only support
integer temperature steps.
Some external controllers (e.g., Google Home via Matter bridges) allow fractional
temperature adjustments such as 22.5°C even when the underlying IR HVAC device
can only operate at whole-degree resolution. This may lead to confusing behavior
where a requested value cannot be represented by the physical device.
What this PR does
_normalize_settemp()to coerce requested temperatures to valid integervalues when
_temp_precision >= 1.(e.g., 0.1°C or 0.5°C).
.5°Cinputs to preserve user intent:Why this is needed
IR-based HVAC integrations often represent devices with configurable temperature
precision. When precision is 1°C, fractional values coming from Matter or other
controllers cannot be expressed directly and may appear as synchronization issues.
This change ensures consistent behavior while respecting device capability.
Scope
_temp_precision >= 1.Notes
This improves interoperability in mixed environments where Home Assistant acts
as a bridge between high-resolution control models (Matter) and discrete HVAC
hardware.