ha-smartthinq-sensors: Fan speed control is exposed via HomeKit but does not change fan speed

Describe the bug

I have had my WH21SL-18 wired up with Home Assistant for about 6 months now and working well.

However, the “fan speed” control exposed to HomeKit (using the below configuration.yml snippet) doesn’t do anything.

I can change the slider in HomeKit (even all the way down to 0%), but this change is not reflected in Home Assistant nor propagated to the air conditioner.

IMG_CB9B4565BEF2-1

homekit:
  - name: Living room
    filter:
      include_entities:
        - climate.living_room_a_c
        - switch.living_room_a_c_jet_mode
        # ...

device.json

Expected behavior Changing the fan speed in HomeKit should change the fan speed of the device (HomeKit uses a fan speed %, but other climate integrations will map these percentage rages to discrete Low/mid/high etc modes).

To handle Auto (“NATURE”) fan speed, a boolean switch might need to be exposed, as I am not aware of any way for Apple’s slider interface to expose this.

Screenshots If applicable, add screenshots to help explain your problem.

Environment details:

  • Environment (HASSIO, Raspbian, etc): HassOS
  • Home Assistant version installed: 2023.5.4
  • Component version installed: latest
  • Last know working version: never noticed it working, but I haven’t always tried to use set fan speed via HomeKit
  • LG device type and model with issue: split system WH21SL-18
  • LG devices connected (list): none other

Output of HA logs

The ThinQ logs which show up when changing fan mode seem to indicate that it is using lowercase speed names:

Logger: homeassistant.core
Source: custom_components/smartthinq_sensors/climate.py:361
Integration: SmartThinQ LGE Sensors ([documentation](https://github.com/ollo69/ha-smartthinq-sensors), [issues](https://github.com/ollo69/ha-smartthinq-sensors/issues))
First occurred: 12:42:55 PM (3 occurrences)
Last logged: 12:43:02 PM

Error executing service: <ServiceCall climate.set_fan_mode (c:01H2VWHRS08GTE6HZYEEE51BTM): entity_id=['climate.living_room_a_c'], fan_mode=low>
Error executing service: <ServiceCall climate.set_fan_mode (c:01H2VWHXK8378GV4K94VZ0H62T): entity_id=['climate.living_room_a_c'], fan_mode=low>
Error executing service: <ServiceCall climate.set_fan_mode (c:01H2VWHZKEM6KMB6A9HDSJHC43): entity_id=['climate.living_room_a_c'], fan_mode=high>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1867, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1889, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 980, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
    await result
  File "/config/custom_components/smartthinq_sensors/climate.py", line 361, in async_set_fan_mode
    raise ValueError(f"Invalid fan mode [{fan_mode}]")
ValueError: Invalid fan mode [low]

Additional context

I’m not sure if the high/low/etc is statically defined within HomeKit, are the expected standard names in Home Assistant, or something that each climate integration has to define in a way that HomeKit can find. I couldn’t get it to trigger a mid but my old climate system did, so that makes me think it is some kind of changeable mapping.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 24

Commits related to this issue

Most upvoted comments

@bjeanes so I followed your great comment about them being lower case and made some changes to ac.py and now it works

in class ACFanSpeed(Enum) changed all of LOW-MID-HIGH words to lower case

still needs some work to do (homekit doesn’t have mid, 50% is low, anything higher is high) Screenshot 2023-06-26 090826

**Update Now works almost perfect a