ollo69 / ha-smartthinq-sensors

HomeAssistant custom integration for SmartThinQ LG devices configurable with Lovelace User Interface.
Apache License 2.0
1.16k stars 159 forks source link

ThinQ APIv2 error while executing automation #653

Closed JBakers closed 7 months ago

JBakers commented 10 months ago

Describe the bug Automation fails when executing: I have an automation that turns the airco/heating on when the temp passes a certain threshold. It sometimes, not always, fails to execute properly, and the automation comes to a halt.

Expected behavior No error, automation succeeds.

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

Environment details:

Output of HA logs Paste the relevant output of the HA log here.

Logger: homeassistant.components.automation.airco_verwarming_aan
Source: helpers/script.py:468
Integration: Automatisering ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 11:32:03 (1 occurrences)
Last logged: 11:32:03

Airco verwarming aan: Error executing script. Unexpected error for device at pos 1: ThinQ APIv2 error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 720, in _async_device_step
    await device_action.async_call_action_from_config(
  File "/usr/src/homeassistant/homeassistant/components/device_automation/action.py", line 71, in async_call_action_from_config
    await platform.async_call_action_from_config(hass, config, variables, context)
  File "/usr/src/homeassistant/homeassistant/components/climate/device_action.py", line 97, in async_call_action_from_config
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/climate.py", line 303, in async_set_hvac_mode
    await self._device.set_op_mode(operation_mode)
  File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 687, in set_op_mode
    await self.set(keys[0], keys[1], key=keys[2], value=mode_value)
  File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 891, in set
    await super().set(
  File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 569, in set
    await self._set_control(
  File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 530, in _set_control
    await self._client.session.device_v2_controls(
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1193, in device_v2_controls
    res = await self.post2(cmd_path, payload)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1030, in post2
    return await self._auth.gateway.core.lgedm2_post(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 347, in lgedm2_post
    return self._manage_lge_result(out, is_api_v2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 359, in _manage_lge_result
    raise API2_ERRORS[code](message)
custom_components.smartthinq_sensors.wideq.core_exceptions.NotLoggedInError: ThinQ APIv2 error

and

Logger: homeassistant.components.automation.airco_verwarming_aan
Source: components/automation/__init__.py:655
Integration: Automatisering ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 11:32:03 (1 occurrences)
Last logged: 11:32:03

While executing automation automation.airco_verwarming_aan
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 655, in async_trigger
    await self.action_script.async_run(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 720, in _async_device_step
    await device_action.async_call_action_from_config(
  File "/usr/src/homeassistant/homeassistant/components/device_automation/action.py", line 71, in async_call_action_from_config
    await platform.async_call_action_from_config(hass, config, variables, context)
  File "/usr/src/homeassistant/homeassistant/components/climate/device_action.py", line 97, in async_call_action_from_config
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/climate.py", line 303, in async_set_hvac_mode
    await self._device.set_op_mode(operation_mode)
  File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 687, in set_op_mode
    await self.set(keys[0], keys[1], key=keys[2], value=mode_value)
  File "/config/custom_components/smartthinq_sensors/wideq/devices/ac.py", line 891, in set
    await super().set(
  File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 569, in set
    await self._set_control(
  File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 530, in _set_control
    await self._client.session.device_v2_controls(
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1193, in device_v2_controls
    res = await self.post2(cmd_path, payload)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1030, in post2
    return await self._auth.gateway.core.lgedm2_post(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 347, in lgedm2_post
    return self._manage_lge_result(out, is_api_v2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 359, in _manage_lge_result
    raise API2_ERRORS[code](message)
custom_components.smartthinq_sensors.wideq.core_exceptions.NotLoggedInError: ThinQ APIv2 error

Additional context Whenever the automation fails with the APIv2 error, it stops the automation. It stops at when starting the AC, and in the logs it looks like it failed, but the AC actually does start up. The fact that the rest of the automation fails results in the AC heating the room way too high.

config_entry-smartthinq_sensors-67c0cbd9556f496997e9b88ea7938035.json.txt

mfslena commented 10 months ago

Exact same issue here.

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days.

JBakers commented 9 months ago

!

github-actions[bot] commented 7 months ago

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 7 months ago

This issue was closed because it has been stalled for 7 days with no activity.