hon icon indicating copy to clipboard operation
hon copied to clipboard

KeyError: 'settings.onOffStatus' when calling climate.set_hvac_mode with version v0.14.0

Open acalantoni opened this issue 7 months ago • 7 comments

Hello Andre0512 (or relevant developers),

I am experiencing an issue with the Haier hOn integration, version v0.14.0, when trying to control my Haier air conditioner. When I attempt to set the HVAC mode (e.g., turn off the AC or change to cool/heat), I receive a KeyError: 'settings.onOffStatus' error.

Environment:

Haier hOn Integration Version: v0.14.0 (as shown in the attached screenshot from HACS) Home Assistant Core Version: [2025.5.1] Haier Air Conditioner Model: [AB35S2SC2FA-1] Haier Air Conditioner Firmware Version: [5.15.0] Problem Description: The climate entity for my Haier AC (climate.ced_server_condizionatore) appears correctly in Home Assistant with all standard attributes and modes. However, any attempt to change the HVAC mode via Home Assistant (e.g., calling climate.set_hvac_mode service with hvac_mode: 'off' or any other mode) results in an error.

Steps to Reproduce:

Navigate to Developer Tools > Services in Home Assistant. Call the climate.set_hvac_mode service. Select the Haier AC entity (e.g., climate.ced_server_condizionatore). Set an hvac_mode (e.g., off, cool). The service call fails, and the error below appears in the logs. Error Log:

Python

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 250, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<7 lines>... 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( ^^^^^^^^^^^^^^^^^^^^^^^^^^ hass, entity, func, data, call.context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ 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 677, in async_handle_set_hvac_mode_service await self.async_set_hvac_mode(hvac_mode) File "/config/custom_components/hon/climate.py", line 204, in async_set_hvac_mode self._device.settings["settings.onOffStatus"].value = "1" ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'settings.onOffStatus' Entity Attributes (from Developer Tools > States for climate.ced_server_condizionatore):

YAML

hvac_modes:

  • "off"
  • auto
  • cool
  • dry
  • heat
  • fan_only min_temp: 16 max_temp: 30 target_temp_step: 1 fan_modes:
  • auto
  • low
  • medium
  • high preset_modes:
  • iot_10_heating
  • iot_auto
  • iot_cool
  • iot_dry
  • iot_fan
  • iot_heat
  • iot_simple_start swing_modes:
  • "off"
  • vertical
  • horizontal
  • both current_temperature: 23 temperature: 23 fan_mode: auto preset_mode: null swing_mode: vertical icon: mdi:air-conditioner friendly_name: CED Server Condizionatore supported_features: 441 Additional Context: It seems the integration is trying to access self._device.settings["settings.onOffStatus"] to change the device state, but this key is not found, leading to the KeyError. This might be due to an API change, a specific behavior of my AC model/firmware, or an issue in how the settings are populated.

Thank you for your work on this integration and for any help you can provide.

acalantoni avatar May 11 '25 08:05 acalantoni

with my AS25S2SF1FA-W and Firmware Version 5.15.0 I can't turn it off and I get an error that hvac modу 0 is not supported

Monoboy4ik avatar May 22 '25 08:05 Monoboy4ik

I have the same error, too: hvac mod 0 is not supported

fatshotty avatar May 23 '25 10:05 fatshotty

I have the same error, too: hvac mod 0 is not supported

https://github.com/Andre0512/hon/issues/265#issuecomment-2567054495

Monoboy4ik avatar May 23 '25 11:05 Monoboy4ik

@Monoboy4ik thanks, i already saw that fix, but it is only for 'off' command. I mean: i have 2 custom programs on my ac; in HA I see those programs, but they are not selectable. If I select one of those program, I got the same previous error :/

fatshotty avatar Jun 03 '25 09:06 fatshotty

@Monoboy4ik thanks, i already saw that fix, but it is only for 'off' command. I mean: i have 2 custom programs on my ac; in HA I see those programs, but they are not selectable. If I select one of those program, I got the same previous error :/

yep, i’m too

Monoboy4ik avatar Jun 03 '25 09:06 Monoboy4ik

@Monoboy4ik thanks, i already saw that fix, but it is only for 'off' command. I mean: i have 2 custom programs on my ac; in HA I see those programs, but they are not selectable. If I select one of those program, I got the same previous error :/

yep, i’m too

I think it is not an "HA integration" issue; i think these errors come from pyhOn, so the library which this HA integration depends to

fatshotty avatar Jun 03 '25 10:06 fatshotty

I have the same problem. "Allowed values: ['2', '4', '5', '6', '8'] But was: 0" I have a script where I call a popular program from Hon.

mode: single sequence:

  • service: select.select_option target: entity_id: select.obyvaci_pokoj_program data: option: "chlad26"

Error Chyba: Allowed values: ['2', '4', '5', '6', '8'] But was: 0

params:domain: select service: select_option service_data:option: chlad26 entity_id:

  • select.obyvaci_pokoj_program target: entity_id:
  • select.obyvaci_pokoj_program running_script: false

Any solution?

Thx

mdolejsi1 avatar Jun 28 '25 05:06 mdolejsi1