panasonic_cc icon indicating copy to clipboard operation
panasonic_cc copied to clipboard

Error when setting horizontal swing modes

Open bakoscsaba opened this issue 10 months ago • 2 comments

Checklist

  • [x] I have verified that the account and device works in the Comfort Cloud App.
  • [x] This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • [x] This issue is not a duplicate issue of currently previous issues..

What version of Home Assistant Core?

2025.1.4

Describe the issue

When I try to set horizontal swing modes I receive the following error message:

[281472164596608] Horizontal swing mode is not valid. Valid horizontal swing modes are: Auto, Left, LeftMid, Mid, RightMid, Right

When trying to set CenterLeft: ValueError: 5 is not a valid AirSwingAutoMode

When trying to set CenterRight: ValueError: 4 is not a valid AirSwingAutoMode

Error/Debug Logs

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:245
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: January 25, 2025 at 14:44:34 (2 occurrences)
Last logged: 10:20:31

[281472164596608] Unexpected exception
[281472177044016] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2795, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2838, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1006, 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 1078, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 709, in async_handle_set_swing_horizontal_mode_service
    await self.async_set_swing_horizontal_mode(swing_horizontal_mode)
  File "/config/custom_components/panasonic_cc/climate.py", line 426, in async_set_swing_horizontal_mode
    self._update_attributes(builder)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/config/custom_components/panasonic_cc/climate.py", line 285, in _update_attributes
    if builder.horizontal_swing:
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aio_panasonic_comfort_cloud/changerequestbuilder.py", line 70, in horizontal_swing
    return constants.AirSwingAutoMode(self._request["airSwingLR"])
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/enum.py", line 726, in __call__
    return cls.__new__(cls, value)
           ~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/enum.py", line 1199, in __new__
    raise ve_exc
ValueError: 5 is not a valid AirSwingAutoMode

bakoscsaba avatar Jan 26 '25 09:01 bakoscsaba

It seems like it's trying to set the value based on the translated text instead of the underlying value. Might be an issue in 2025.1.4, I don't get the error when trying the dedicated horizontal select.

sockless-coding avatar Jan 26 '25 19:01 sockless-coding

I'm on HA 2025.2.4 now and still receiving the same error message:

Logger: homeassistant.components.automation.open_window_ac_bedroom_off Source: helpers/script.py:526 integration: Automation (documentation, issues) First occurred: February 16, 2025 at 10:29:43 (2 occurrences) Last logged: 07:31:57

Open window AC Bedroom off: Error executing script. Unexpected error for call_service at pos 1: 5 is not a valid AirSwingAutoMode Traceback (most recent call last): 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 762, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<9 lines>... ) ^ 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 2794, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2837, 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/scene/init.py", line 118, in _async_activate await self.async_activate(**kwargs) File "/usr/src/homeassistant/homeassistant/components/homeassistant/scene.py", line 366, in async_activate await async_reproduce_state( ...<4 lines>... ) File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 69, in async_reproduce_state await asyncio.gather( *(worker(domain, data) for domain, data in to_call.items()) ) File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 63, in worker await platform.async_reproduce_states( hass, states_by_domain, context=context, reproduce_options=reproduce_options ) File "/usr/src/homeassistant/homeassistant/components/climate/reproduce_state.py", line 107, in async_reproduce_states await asyncio.gather( ...<6 lines>... ) File "/usr/src/homeassistant/homeassistant/components/climate/reproduce_state.py", line 85, in _async_reproduce_states await call_service( SERVICE_SET_SWING_HORIZONTAL_MODE, [ATTR_SWING_HORIZONTAL_MODE] ) File "/usr/src/homeassistant/homeassistant/components/climate/reproduce_state.py", line 52, in call_service await hass.services.async_call( DOMAIN, service, data, blocking=True, context=context ) File "/usr/src/homeassistant/homeassistant/core.py", line 2794, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2837, 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 710, in async_handle_set_swing_horizontal_mode_service await self.async_set_swing_horizontal_mode(swing_horizontal_mode) File "/config/custom_components/panasonic_cc/climate.py", line 426, in async_set_swing_horizontal_mode self._update_attributes(builder) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/config/custom_components/panasonic_cc/climate.py", line 285, in _update_attributes if builder.horizontal_swing: ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aio_panasonic_comfort_cloud/changerequestbuilder.py", line 70, in horizontal_swing return constants.AirSwingAutoMode(self._request["airSwingLR"]) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/enum.py", line 726, in call return cls.new(cls, value) ~~~~~~~~~~~^^^^^^^^^^^^ File "/usr/local/lib/python3.13/enum.py", line 1199, in new raise ve_exc ValueError: 5 is not a valid AirSwingAutoMode

bakoscsaba avatar Feb 17 '25 10:02 bakoscsaba

I was having this issue too and have just now raised a PR I have tested which fixes this.

codyc1515 avatar May 02 '25 23:05 codyc1515