fix(climate): stop syncing start/stopProgram params into settings on AC turn_on/off - #3
Merged
Merged
Conversation
…AC turn_on/off climate.turn_on / turn_off failed with ValueError: Allowed values: ['2', '4', '5', '6', '7', '8'] But was: 0 because sync_command copies every startProgram/stopProgram parameter into the settings command; params without a defaultValue read as "0" in pyhon, which is not a valid enum value for the settings counterpart (windDirectionVertical and friends). The API command itself was already sent, so the AC toggled but HA surfaced the error. Apply the same approach upstream used for async_set_hvac_mode (mmalolepszy/hon-revived 4c44f6d): only sync settings.onOffStatus. 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.
Problem
climate.turn_on/climate.turn_offon AC units fail with:The AC actually toggles (the API command is sent before the failure), but HA surfaces the error on every on/off press.
Root cause
HonACClimateEntity.async_turn_on/offcallsync_command("startProgram"/"stopProgram", "settings"), which copies every command parameter into thesettingscommand. Parameters lacking adefaultValueread as"0"in pyhon, which is not a valid enum value for theirsettingscounterpart (e.g.windDirectionVertical) →ValueErrorfromHonParameterEnum.Upstream commit 4c44f6d fixed the same issue in
async_set_hvac_modeby replacing the sync with a directsettings.onOffStatusassignment — butasync_turn_on/async_turn_offkept the brokensync_commandcalls.Fix
Apply the same pattern: send the program command, then only sync
settings.onOffStatus("1"/"0") and schedule a state update.🤖 Generated with Claude Code