home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.55k stars 30.72k forks source link

Error while setting up tradfri platform for sensor #110941

Closed Kev0123 closed 5 months ago

Kev0123 commented 8 months ago

The problem

tradfi integration won't recognise the air purifier sensors

What version of Home Assistant Core has the issue?

2024.2.2

What was the last working version of Home Assistant Core?

new setup

What type of installation are you running?

Home Assistant Container

Integration causing the issue

tradfri

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tradfri

Diagnostics information

config_entry-tradfri-db2f72dccce9a984f24d370a48943a5e.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:344
Integration: Sensor (documentation, issues)
First occurred: 18. Februar 2024 um 21:16:52 (5 occurrences)
Last logged: 13:27:46

Error while setting up tradfri platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/tradfri/sensor.py", line 171, in async_setup_entry
    TradfriSensor(
  File "/usr/src/homeassistant/homeassistant/components/tradfri/sensor.py", line 205, in __init__
    self._refresh()  # Set initial state
    ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tradfri/sensor.py", line 209, in _refresh
    self._attr_native_value = self.entity_description.value(self.coordinator.data)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tradfri/sensor.py", line 59, in _get_air_quality
    device.air_purifier_control.air_purifiers[0].air_quality == 65535
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pytradfri/device/air_purifier.py", line 64, in air_quality
    return self.raw[ATTR_AIR_PURIFIER_AIR_QUALITY]
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '5907'

Additional information

No response

home-assistant[bot] commented 8 months ago

tradfri documentation tradfri source

issue-triage-workflows[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.