hon icon indicating copy to clipboard operation
hon copied to clipboard

Mode and preset selection for Haier Aircons not working

Open szczepuz999 opened this issue 1 year ago • 24 comments

Describe the bug till yesterday all was working fine, but now when I am trying to select preset mode "iot_heat" I am getting this error:

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Allowed values: ['2', '4', '5', '6', '7', '8'] But was: 0

To Reproduce Steps to reproduce the behavior: in HA go to Developer settings and trigger Action - Climate: Set preset mode with value iot_heat

Expected behavior the preset heating shall be set, instead I am getting unknown error I was thinking that it was caused by HA itself but I did the same thing with Tuya Thermostat (set HVAC preset/mode) and all is ok with this. So seems that it is only related to way how Haier controls the appliance mode

Screenshots

image

Environment (please complete the following information):

  • Core 2024.11.3
  • Supervisor 2024.11.4
  • Operating System 13.2
  • hOn Integration Version 0.14.0
  • pyhOn Version 0.17.5

Additional context Add any other context about the problem here.

Home Assistant Logs Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 816, in handle_execute_script script_result = await script_obj.async_run( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1801, in async_run return await asyncio.shield(create_eager_task(run.async_run())) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 528, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 558, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 800, in async_handle_set_preset_mode_service await self.async_set_preset_mode(preset_mode) File "/config/custom_components/hon/climate.py", line 232, in async_set_preset_mode self._device.sync_command("startProgram", "settings") File "/usr/local/lib/python3.12/site-packages/pyhon/appliance.py", line 311, in sync_command self.sync_parameter(base_param, target_param) File "/usr/local/lib/python3.12/site-packages/pyhon/appliance.py", line 326, in sync_parameter target.value = main.value ^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/parameter/enum.py", line 51, in value raise ValueError(f"Allowed values: {self._values} But was: {value}") ValueError: Allowed values: ['2', '4', '5', '6', '7', '8'] But was: 0

szczepuz999 avatar Nov 24 '24 06:11 szczepuz999

same problem

fiore68 avatar Nov 25 '24 19:11 fiore68

Same problem, Used to work before, yesterday I made the upgrade from HA Core 2024.11.1 to 2024.11.3 and since then, error I get this error in hon

Hectorm53 avatar Nov 26 '24 21:11 Hectorm53

Same problem. with HA core v2023.11.1 works correctly but after update to v2024.11.2 does not work. when i try to turn off my air conditioning, HA reports following error: climate/set_hvac_mode Allowed values: ['2', '4', '5', '6', '7', '8'] But was: 0

Cornago avatar Dec 02 '24 21:12 Cornago

Same problem here :-)

alfbas avatar Dec 03 '24 15:12 alfbas

Same here, airco does turn off though. But HA still shows as 'on'

bvdf0251 avatar Dec 05 '24 20:12 bvdf0251

Same problem. :(

maLLoud86 avatar Dec 06 '24 21:12 maLLoud86

+1

Zaleo80 avatar Dec 09 '24 10:12 Zaleo80

same problem here with 0.14.0 and 2024.12.1

rpania avatar Dec 10 '24 11:12 rpania

Same problem, hope you could take a look at it @Andre0512 🤗

droeloe1818 avatar Dec 12 '24 21:12 droeloe1818

+1

gatlin-code avatar Dec 22 '24 17:12 gatlin-code

@Andre0512 do we need to start looking for an other integration?

Tried the Givroux one, but it's missing sensors and entities.

Could you please let us all know.

bvdf0251 avatar Dec 22 '24 20:12 bvdf0251

Same issue here with AS35X and AS50XCAHRA

RenanAz avatar Dec 24 '24 16:12 RenanAz

Same problem using HA 14.1 and core 2024.12.5

wbmk78 avatar Dec 26 '24 20:12 wbmk78

Same problem. with HA core v2023.11.1 works correctly but after update to v2024.11.2 does not work. when i try to turn off my air conditioning, HA reports following error: climate/set_hvac_mode Allowed values: ['2', '4', '5', '6', '7', '8'] But was: 0

jmediciones avatar Dec 27 '24 16:12 jmediciones

I'm having the same problem, but I'm not sure if this is related to an HA upgrade. I'm still running HA V2024.10.3 in a docker container that does not auto update. Both HON en PYHON are not updated since august 2024 and Hacks is from september.

Is it possible that the Haier API is returning a different return code for turning off? I think that a 0 is a normal return code for this state. According to the Apple App store there are a serie of small bugfixes done on the Hon APP and in november they updated from 2.13 to 2.14.

I looked in the code but I can't find the valid enum values, I think if we update the enum value for turning off to the correct value instead of 0 it will be fixed.

Do4bled avatar Dec 29 '24 08:12 Do4bled

I encountered the issue with turning off the AC using the hon integration and found a solution that works for me. The fix involves modifying the climate.py file:

Replace:

self._device.sync_command("stopProgram", "settings")

With:

self._device.settings["settings.onOffStatus"].value = "0"

This resolves the problem and ensures the AC turns off correctly.

For anyone interested, I’ve shared my patched version of the integration here:
https://github.com/sgmckay25/hon/tree/patch-1

Please note that this fork is not actively maintained. I hope this helps others facing the same issue!

sgmckay25 avatar Jan 01 '25 15:01 sgmckay25

works for me too, great solution @sgmckay25 Thanksss

rpania avatar Jan 01 '25 17:01 rpania

your fix work @sgmckay25 thanks!!!

But I continue with this problem when I want to define a custom program (favorite program in hOn app) do you guys have the same error?

danyrd92 avatar Jan 14 '25 10:01 danyrd92

Thanks for the fix! There are 2 instances of the original string so be sure to replace both.

RenanAz avatar Jan 14 '25 10:01 RenanAz

Can someone please confirm if the fix allows starting custom programs on an air conditioner?

danyrd92 avatar Jan 14 '25 11:01 danyrd92

I have performed the fix and turning the air conditioning on/off works fine with the fix thnx. But choosing a favorite program that is created in the HON app itself gives this error message. It also wants to turn on the air conditioning and apply the preset settings. That gives this error message.

"Action climate/set_preset_mode could not be performed. Allowed values: ['2', '4', '5', '6', '7', '8'] But was: 0"

Image

thephantom avatar Jan 27 '25 22:01 thephantom

I have the same problem with Haier AS35S2SF1FA-MW3

ingcicala avatar Feb 09 '25 21:02 ingcicala

I encountered the issue with turning off the AC using the hon integration and found a solution that works for me. The fix involves modifying the climate.py file:

Replace:

self._device.sync_command("stopProgram", "settings") With:

self._device.settings["settings.onOffStatus"].value = "0" This resolves the problem and ensures the AC turns off correctly.

For anyone interested, I’ve shared my patched version of the integration here: https://github.com/sgmckay25/hon/tree/patch-1

Please note that this fork is not actively maintained. I hope this helps others facing the same issue!

It works for me tnks

ingcicala avatar Feb 09 '25 21:02 ingcicala

I have performed the fix and turning the air conditioning on/off works fine with the fix thnx. But choosing a favorite program that is created in the HON app itself gives this error message. It also wants to turn on the air conditioning and apply the preset settings. That gives this error message.

"Action climate/set_preset_mode could not be performed. Allowed values: ['2', '4', '5', '6', '7', '8'] But was: 0"

Image

have this issue too...

Monoboy4ik avatar May 22 '25 14:05 Monoboy4ik