ha-smartthinq-sensors icon indicating copy to clipboard operation
ha-smartthinq-sensors copied to clipboard

Switching AC on and setting a temperature at the same time doesn't work

Open kwridan opened this issue 7 months ago • 8 comments

Describe the bug

I have an LG duct AirCon configured in homeassitant via this integration and exposed to HomeKit. When the AC is off, attempting to switch it on via HomeKit successfully switches it on, however doesn't respect the temperature selected (it defaults to 24℃), manually changing the temperature subsequently works.

Expected behavior The temperature selected should be respected.

Screenshots n/a

Environment details:

  • Environment (HASSIO, Raspbian, etc):
  • Home Assistant version installed: 2024.6.0
  • Component version installed: v0.39.2
  • Last know working version: n/a
  • LG device type and model with issue: DUCT_626301_WW-DUCT
  • LG devices connected (list):

Output of HA logs

2024-07-07 18:36:59.526 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall climate.set_temperature (c:...): entity_id=['climate.my_ac'], hvac_mode=cool, temperature=22.5>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in _run_service_call_catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 922, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/config/custom_components/smartthinq_sensors/climate.py", line 388, in async_set_temperature
    await self._device.set_target_temp(new_temp)
  File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 741, in set_target_temp
    await self.set(keys[0], keys[1], key=keys[2], value=conv_temp)
  File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 892, in set
    await super().set(
  File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 590, in set
    await self._set_control(
  File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 551, in _set_control
    await self._client.session.device_v2_controls(
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1322, in device_v2_controls
    res = await self.post2(cmd_path, payload)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1079, in post2
    return await self._auth.gateway.core.lgedm2_post(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 393, in lgedm2_post
    return self._manage_lge_result(out, is_api_v2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 406, in _manage_lge_result
    raise exc.APIError(message, code)
custom_components.smartthinq_sensors.wideq.core_exceptions.APIError: 0103 - {'data': ''}

Additional context

Testing this a bit further, it might not be specific to HomeKit, manually invoking the service in home assistant to set the temperature and hvac mode when the AC is switched off results in the same behaviour where the temperature defaults to 24℃ just doesn't produce the error above.

service: climate.set_temperature
target:
  device_id: #...<device-id>
data:
  temperature: 22.5
  hvac_mode: cool

Could it be that the ThinQ API doesn't support setting the hvac mode and temperature at the same time?

Thanks! 🙏

kwridan avatar Jul 07 '24 18:07 kwridan