fix(climate): make program→settings sync tolerant, drop eager state writes on AC turn_on/off - #4
Merged
Merged
Conversation
…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>
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.
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:
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.
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