TionAPI / HA-tion

Home assistant integration for Tion breezers
Apache License 2.0
72 stars 6 forks source link

Перестала работать служба fan.set_percentage #130

Closed tms320 closed 5 months ago

tms320 commented 5 months ago

Версия HA: 2024.5.5 Версия интеграции: 4.1.7. Бризер: Tion 4s.

При вызове службы 'fan.set_percentage' в логе HA такая ошибка:

Регистратор: homeassistant.helpers.script.websocket_api_script
Источник: helpers/script.py:501
Первое сообщение: 15:46:30 (5 сообщений)
Последнее сообщение: 15:52:14

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: object of type 'property' has no len()
Traceback (most recent call last):
  File "/config/custom_components/ha_tion_btle/fan.py", line 118, in percent2mode
    return self._percent_mode_mapping[percentage]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 17

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/ha_tion_btle/fan.py", line 137, in async_set_percentage
    await self.coordinator.set(fan_speed=self.percent2mode(percentage), is_on=percentage > 0)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ha_tion_btle/fan.py", line 122, in percent2mode
    for i in range(len(TionClimateEntity.attr_fan_modes())):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'property' has no len()
IATkachenko commented 5 months ago

где-то округления поехали. Локально можно в этот список https://github.com/TionAPI/HA-tion/blob/master/custom_components/ha_tion_btle/fan.py#L58 добавить

17: 1,

Про фикс в районе выходных подумаю.

IATkachenko commented 5 months ago

Поправил в v4.1.8