Skip to content

vNext: Automatic half-degree temperature handling - #574

Open
RobHofmann wants to merge 3 commits into
5.0-devfrom
feat/569-half-degree
Open

RobHofmann wants to merge 3 commits into
5.0-devfrom
feat/569-half-degree

Conversation

@RobHofmann

@RobHofmann RobHofmann commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Fixes #569, following Pedro's design in the issue. Related to #568 and #537 (master). Rebased onto 5.0-dev after #573 merged (5.0.0-alpha.110), then updated for Twintop's review.

Change

  • One checkbox: the temperature step option is replaced by "Use half-degrees °C" (half_degrees). It is off by default, except on a zone of a zone controller, and offered only when the unit answers TemRec, StFahFlg, Add0.5 or Add0.1.
  • Sending: a target is sent on every half-degree column the unit answers. A half degree sends the bit as 1, Add0.5 as 1 and Add0.1 as 5. A whole degree sends 0 on all of them.
  • Reading: a value reads as a half degree when any of those columns is set.
  • Step: the climate step is 0.5 only in °C with the option on, and 1 otherwise.
  • Unit select: a unit is °C only, with no Temperature Units select, unless it answers TemUn and a bit column (TemRec or StFahFlg). The AC unit of a zone controller keeps its select.
  • Migration: existing entries move to config entry minor version 2, where a step like 0.5 becomes half_degrees: true. YAML still accepts target_temp_step, with a warning. The 4.x migration maps the 4.x step and the 4.0.13 Add0.5 switch to half_degrees.
  • Zones: a zone without a stored choice uses half degrees, so existing zone setups keep their 0.5 step after the upgrade. Zones only answer StFahFlg, which they take. The option also carries over to the next device in the same setup, so one tick covers all zones.
  • Translations (en, nl, pt) and the docs.

Why every column, and not one by preference: the known units each need a different column. Pedro's unit and ours answer all three, but do not support all of them. So any fixed preference breaks one kind of unit.

The retry trap from the issue: in vNext nothing resends a value that the unit ignores. A value is only held until HELD_VALUE_TTL runs out. Two tests in tests/test_half_degrees.py prove that nothing resends.

Testing

  • Real unit (firmware U-CS532Z(LT)V3.75, half_degrees: true in YAML):
    • The step is 0.5. The unit answers TemRec, Add0.5 and Add0.1.
    • Target 22.5 sent SetTem 22, TemRec 1, Add0.5 1, Add0.1 5, and the unit answered all four. The next polls read TemRec 1, Add0.5 1, Add0.1 0: the unit drops Add0.1 by itself, which still reads as 22.5.
    • Target 23 sent 0 on all three, and the polls read SetTem 23 with all three at 0.
    • No command was sent between the polls.
  • Offline harness with fake units in the dev container: 75/75 checks pass. It covers six units: TemRec only, StFahFlg only, Add0.5 only, an Add0.1 gateway that behaves as measured in Support Add0.1 tenths-digit half degrees #568, one with no half column, and one that answers Add0.5 but ignores it and takes TemRec. Each unit is checked for the offer, the step, the sent columns, the read back, Fahrenheit, and that three polls send no command.
  • Zone controller (Twintop, LE60-13/GH): sending and reading back work in °C and °F, see his review.
  • pytest: 425 passed. ruff: check and format pass.
  • The HA 2026.10 test pin cannot create the climate entity of this branch, so pytest does not cover the step wiring or the unit select filter. The real unit covers the step.

Risk

The unit from #537 now gets TemRec=1 together with Add0.5=1. #537 forced TemRec to 0 there. Nobody has tested that combination on that unit.

Questions

  1. Is TemRec=1 with Add0.5=1 safe on the Support Add0.5 half-degree control and fix temperature-step restoration #537 unit? Could the author of Support Add0.5 half-degree control and fix temperature-step restoration #537 test it?
  2. Zones lose their automatic 0.5 step until the user ticks the box. Answered: zones default to on.
  3. Is the exception that keeps the unit select on the AC unit of a zone controller OK? Answered: fine and needed.
  4. Support Add0.1 tenths-digit half degrees #568 on master: if its step change is not stored in the 4.x state, an Add0.1 gateway migrates with the option off. Close Support Add0.1 tenths-digit half degrees #568 in favour of this, or merge it as a 4.x-only fix?

@p-monteiro

Copy link
Copy Markdown
Contributor

Looks good. My only concern is the behaviour of zone controllers. Maybe @Twintop can give some help there.

Base automatically changed from fix/ha-2026-11-compat to 5.0-dev November 12, 2026 23:30
@Twintop

Twintop commented Nov 13, 2026

Copy link
Copy Markdown

Looks good. My only concern is the behaviour of zone controllers. Maybe @Twintop can give some help there.

Tested this on my zone controller (LE60-13/GH, WiFi module ME31-00/C13, fw U-W05SA v1.27) on HA 2026.11.1. Short version: everything was sent and read back correctly. There's one thing I'd change for zones.

  1. Zones lose their automatic 0.5 step until the user ticks the box. Is that OK?

I'd rather not have that as the default for zones. After the upgrade, all four zone numbers went from step 0.5 to 1, and a 19.5 from HA goes out as StTem 4, StFahFlg 0 (20).

The migration can't keep the old behaviour here. Zones never had the step option (the old form only offered it on SetTem), so their 0.5 came from has_target_temperature_bit. That means every existing zone controller setup ends up on whole degrees after the update.

The reason for off by default (a unit that answers a column but ignores it) doesn't apply to zones. StFahFlg is the only half-degree column they answer, and it's verified on the hardware for both the half degree and the °F table.

Suggestions:

  • Default half_degrees to on for DeviceType.ZONE
  • Add CONF_HALF_DEGREES to _COPIED_OPTIONS, so ticking it on one zone carries over to the next. Right now it's four ticks on setup, and one edit per zone in reconfigure.
  1. Is the exception that keeps the unit select on the AC unit of a zone controller OK?

Fine, and needed. The AC unit answers TemUnit but drops StTem/StFahFlg by type, so without the exception HA can't switch the system's unit at all.

  • Only the AC unit has the select, zones still don't
  • °F sent TemUnit 1 to sub 00, and every sub-unit followed
  • Zones went through the table: 67 °F → StFahFlg 1, StTem 3, 66 °F → 0, 3
  • Zones with the option on drop to step 1 in °F
  • Going back to °C was clean

As for everything else:

  • The entry migrated from minor 1 to 2 without errors. YAML target_temp_step: 0.5 on a zone became half_degrees: true in the stored entry, with step 0.5.
  • Options form (PR code bound to the real controller): each zone offers the checkbox, the AC unit doesn't, and target_temp_step is gone.
  • No sub-unit answers Add0.5/Add0.1 (or TemRec, SetTem, TemUn). Both drop after the first poll, and then the polls are the same as before (6 columns per zone, 4 on the AC unit).
  • Option on: 18.5 → StFahFlg 1, StTem 2, 19 → 0, 3. Both held through the next polls.
  • Option off with 19.5 set directly on the controller: HA shows 19.5 (step 1) and sends nothing back.
  • One command per HA action, nothing resent, and no commands at startup or reload.
  • Full test suite had all 361 pass and ruff is clean here too.

Replace the device option target_temp_step with one checkbox, "Use
half-degrees °C" (half_degrees, off by default). The form offers it only
when the unit answers TemRec, StFahFlg, Add0.5 or Add0.1.

Add0.5 and Add0.1 are now normal polled columns. A target temperature
writes every half degree column the unit answers: bit 1, Add0.5 1 and
Add0.1 5 for a half degree in Celsius, and 0 in all of them for a whole
degree. Known units each use a different column and some answer columns
they ignore, so one preferred column would break one of them. A value
reads as a half degree when any answered column is set. Nothing resends
a column the unit ignores; a sub-unit hold still ends at the TTL.

With the option off, Celsius rounds to the nearest whole degree, a half
going up. The climate entity and the zone number take their step from
the device: 0.5 in Celsius with the option on, 1 otherwise.

A unit is Celsius only, without the Temperature Units select, unless it
answers TemUn or TemUnit and a bit column. SetTem is always Celsius, so
only the bit tells the Fahrenheit degrees apart. The AC unit of a zone
controller keeps its select.

Config entry minor version 2: async_migrate_entry turns a step that is
not a whole number into half_degrees and drops the step. YAML still
accepts target_temp_step with a warning. The 4.x migration maps the
step number and the 4.0.13 Add0.5 switch to half_degrees.
A zone of a zone controller only answers StFahFlg as its half degree
column, which it takes, and zones always used half degrees before the
option existed. So a zone without a stored choice now uses half degrees,
and an existing zone keeps its 0.5 step after the upgrade.

The option now also carries over to the next device in the same setup,
so one choice covers all zones.
@RobHofmann

Copy link
Copy Markdown
Owner Author

Thanks @Twintop, both suggestions are in, and the branch is rebased onto 5.0-dev (5.0.0-alpha.110).

  • Zones default to on. A zone without a stored choice now uses half degrees, so existing zone setups keep their 0.5 step after the upgrade. The options form starts ticked for a zone. A saved choice still wins, so a zone you turn off stays off. Every other unit stays off by default.
  • The option carries over. half_degrees is in _COPIED_OPTIONS, so the choice on the first zone fills the form of the next one.

New tests: a zone without a stored choice has step 0.5 and sends 19.5 as StTem 3, StFahFlg 1; the ducted unit does not default to on; the option is copied. pytest: 425 passed. ruff: check and format pass. My test unit still binds at 29 columns and keeps step 1. It is not a zone, so the zone default is only covered by the fake controller. A check on your controller after the upgrade would be welcome.

@Twintop

Twintop commented Nov 15, 2026

Copy link
Copy Markdown

A check on your controller after the upgrade would be welcome.

Thanks for the quick turnaround!

Set up as a real upgrade: the config entry put back at minor 1 from before this PR, zones with no stored choice, plus half_degrees: false in YAML on one zone. All good.

  • The entry migrated from minor 1 to 2. Nothing was stored for the zones without a choice, and the explicit false was kept.
  • The zones without a choice came up at step 0.5, and the one with false stayed at 1. The AC unit has no option and still has its select.
  • 19.5 from HA on a zone with no stored choice went out as StFahFlg 1, StTem 3 and held through the next polls. 19 went out as 0, 3.
  • Form and copy (PR code bound to the real controller): the checkbox starts ticked on every zone and isn't there on the AC unit. A zone after the AC unit starts ticked, and a zone after one you unticked starts unticked.
  • No commands at startup or reload, one command per HA action, and nothing resent. Polls are the same as before (6 columns per zone, 4 on the AC unit), and the new alpha.110 columns drop after the first poll too.
  • 425 passed and ruff is clean here as well.

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.

3 participants