Skip to content

fix(climate): make program→settings sync tolerant, drop eager state writes on AC turn_on/off - #4

Merged
Dekkee merged 1 commit into
mainfrom
fix/ac-toggle-state-regression
Jun 12, 2026
Merged

fix(climate): make program→settings sync tolerant, drop eager state writes on AC turn_on/off#4
Dekkee merged 1 commit into
mainfrom
fix/ac-toggle-state-regression

Conversation

@Dekkee

@Dekkee Dekkee commented Jun 12, 2026

Copy link
Copy Markdown
Owner

The hotfix3 change for the 'Allowed values … But was: 0' error introduced a
regression: the card power icon only ever turned the AC off, and turning
off reset displayed settings (silent etc).

Two causes:

  • pyhon's send() copies command params over device attributes with a 10s
    shield (sync_command_to_params), so right after start/stopProgram the
    attributes hold command defaults, not device truth. The added
    schedule_update_ha_state() painted that garbage into HA state and the
    shield then rejected the correcting MQTT push; hvac_mode stayed != OFF,
    so climate.toggle always picked turn_off.
  • dropping sync_command entirely left the settings command stale, so a
    later settings.send() could push outdated params to the device.

Restore the original semantics minus the crash: sync program params into
the settings command per-parameter, skipping values the settings enum
rejects (program params without defaultValue read as "0"), and write no
HA state — the next push/poll paints real device state, as before hotfix3.
Also use the tolerant sync in async_set_preset_mode, which had the same
ValueError landmine.

Verified against pyhon-revived 0.18.3: sync_parameter on enum 2,4,5,6,7,8
with base "0" raises exactly the reported error; valid params still sync.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

…rites on AC turn_on/off

The hotfix3 change for the 'Allowed values … But was: 0' error introduced a
regression: the card power icon only ever turned the AC off, and turning
off reset displayed settings (silent etc).

Two causes:
- pyhon's send() copies command params over device attributes with a 10s
  shield (sync_command_to_params), so right after start/stopProgram the
  attributes hold command defaults, not device truth. The added
  schedule_update_ha_state() painted that garbage into HA state and the
  shield then rejected the correcting MQTT push; hvac_mode stayed != OFF,
  so climate.toggle always picked turn_off.
- dropping sync_command entirely left the settings command stale, so a
  later settings.send() could push outdated params to the device.

Restore the original semantics minus the crash: sync program params into
the settings command per-parameter, skipping values the settings enum
rejects (program params without defaultValue read as "0"), and write no
HA state — the next push/poll paints real device state, as before hotfix3.
Also use the tolerant sync in async_set_preset_mode, which had the same
ValueError landmine.

Verified against pyhon-revived 0.18.3: sync_parameter on enum 2,4,5,6,7,8
with base "0" raises exactly the reported error; valid params still sync.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Dekkee
Dekkee merged commit ac77eba into main Jun 12, 2026
0 of 4 checks passed
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