malinovsku / ha-keenetic_api

MIT License
43 stars 2 forks source link

attributeError: 'list' object has no attribute 'get' #1

Open andrewjswan opened 3 months ago

andrewjswan commented 3 months ago

Эта ошибка возникла в пользовательской интеграции.

Регистратор: homeassistant Источник: custom_components/keenetic_api/binary_sensor.py:51 интеграция: Keenetic API (документация, проблемы) Первое сообщение: 14 августа 2024 г. в 14:26:51 (6108 сообщений) Последнее сообщение: 19:02:36

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 533, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 293, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/keenetic_api/binary_sensor.py", line 114, in is_on
    return self.entity_description.value_fn(self.coordinator, self._obj_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/keenetic_api/binary_sensor.py", line 51, in <lambda>
    value_fn= lambda coordinator, obj_id: coordinator.data.show_media.get(obj_id, False),
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'get'