Skip to content

feat(climate): normalize setpoint when device temperature precision is 1°C#189

Open
nao-pon wants to merge 2 commits into
hristo-atanasov:masterfrom
nao-pon:settemp_normalize
Open

feat(climate): normalize setpoint when device temperature precision is 1°C#189
nao-pon wants to merge 2 commits into
hristo-atanasov:masterfrom
nao-pon:settemp_normalize

Conversation

@nao-pon
Copy link
Copy Markdown
Collaborator

@nao-pon nao-pon commented Apr 27, 2026

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

  • Adds _normalize_settemp() to coerce requested temperatures to valid integer
    values when _temp_precision >= 1.
  • Leaves existing behavior unchanged for devices with finer precision
    (e.g., 0.1°C or 0.5°C).
  • Uses directional rounding for .5°C inputs to preserve user intent:
    • Increasing requests round up.
    • Decreasing requests round down.
  • Applies normalization only before sending commands to the device.

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

  • Only affects devices configured with _temp_precision >= 1.
  • No impact on high-precision devices.
  • No changes to MQTT handling or state parsing.

Notes

This improves interoperability in mixed environments where Home Assistant acts
as a bridge between high-resolution control models (Matter) and discrete HVAC
hardware.

nao-pon and others added 2 commits April 27, 2026 17:48
 ### 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant