Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mode and preset selection for Haier Aircons not working #265

Open
szczepuz999 opened this issue Nov 24, 2024 · 20 comments
Open

Mode and preset selection for Haier Aircons not working #265

szczepuz999 opened this issue Nov 24, 2024 · 20 comments
Assignees
Labels
bug Something isn't working

Comments

@szczepuz999
Copy link

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 szczepuz999 added the bug Something isn't working label Nov 24, 2024
@fiore68
Copy link

fiore68 commented Nov 25, 2024

same problem

@Hectorm53
Copy link

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

@Cornago
Copy link

Cornago commented Dec 2, 2024

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

@alfbas
Copy link

alfbas commented Dec 3, 2024

Same problem here :-)

@bvdf0251
Copy link

bvdf0251 commented Dec 5, 2024

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

@maLLoud86
Copy link

Same problem. :(

@Zaleo80
Copy link

Zaleo80 commented Dec 9, 2024

+1

@rpania
Copy link

rpania commented Dec 10, 2024

same problem here with 0.14.0 and 2024.12.1

@droeloe1818
Copy link

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

@gatlin-code
Copy link

+1

@bvdf0251
Copy link

@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.

@RenanAz
Copy link

RenanAz commented Dec 24, 2024

Same issue here with AS35X and AS50XCAHRA

@wbmk78
Copy link

wbmk78 commented Dec 26, 2024

Same problem using HA 14.1 and core 2024.12.5

@jmediciones
Copy link

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

@Do4bled
Copy link

Do4bled commented Dec 29, 2024

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.

@sgmckay25
Copy link

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!

@rpania
Copy link

rpania commented Jan 1, 2025

works for me too, great solution @sgmckay25
Thanksss

@danyrd92
Copy link

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?

@RenanAz
Copy link

RenanAz commented Jan 14, 2025

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

@danyrd92
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests