From b9247ebd370611e216fdee5433e407e6e8bfc932 Mon Sep 17 00:00:00 2001 From: Alexander Tihoniuk Date: Fri, 12 Jun 2026 17:06:25 +0300 Subject: [PATCH] fix(climate): stop syncing start/stopProgram params into settings on 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 --- custom_components/hon/climate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/custom_components/hon/climate.py b/custom_components/hon/climate.py index 9cbc2ce..b29906f 100644 --- a/custom_components/hon/climate.py +++ b/custom_components/hon/climate.py @@ -238,12 +238,17 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: self.schedule_update_ha_state() async def async_turn_on(self, **kwargs: Any) -> None: + # sync_command("startProgram", "settings") blows up on enum params whose + # startProgram default ("0") is not a valid settings value — mirror the + # upstream fix for async_set_hvac_mode and only sync onOffStatus await self._device.commands["startProgram"].send() - self._device.sync_command("startProgram", "settings") + self._device.settings["settings.onOffStatus"].value = "1" + self.schedule_update_ha_state() async def async_turn_off(self, **kwargs: Any) -> None: await self._device.commands["stopProgram"].send() - self._device.sync_command("stopProgram", "settings") + self._device.settings["settings.onOffStatus"].value = "0" + self.schedule_update_ha_state() @property def preset_mode(self) -> str | None: