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
72.9k stars 30.52k forks source link

Error updating Luftdaten sensors (line 138, in refresh_sensors) #25057

Closed hudecitydave closed 5 years ago

hudecitydave commented 5 years ago

Home Assistant release with the issue: 0.95.4

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):

arch | x86_64 dev | false docker | true hassio | true os_name | Linux python_version | 3.7.3 timezone | Europe/Berlin version | 0.95.4 virtualenv | false

Component/platform: https://www.home-assistant.io/components/luftdaten/ Configured via frontend

Description of problem:

Randomly my sensors switch to the state "unknown" in the frontend, the following is happening in the log:

2019-07-10 10:35:52 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/luftdaten/__init__.py", line 138, in refresh_sensors
    await luftdaten.async_update()
  File "/usr/src/homeassistant/homeassistant/components/luftdaten/__init__.py", line 178, in async_update
    await self.client.get_data()
  File "/usr/local/lib/python3.7/site-packages/luftdaten/__init__.py", line 62, in get_data
    for measurement in self.values.keys():
AttributeError: 'NoneType' object has no attribute 'keys'
2019-07-10 10:35:52 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/luftdaten/__init__.py", line 138, in refresh_sensors
    await luftdaten.async_update()
  File "/usr/src/homeassistant/homeassistant/components/luftdaten/__init__.py", line 178, in async_update
    await self.client.get_data()
  File "/usr/local/lib/python3.7/site-packages/luftdaten/__init__.py", line 62, in get_data
    for measurement in self.values.keys():
AttributeError: 'NoneType' object has no attribute 'keys'

Sometimes it is possible to restart ha, sometimes I have to delete and reconfigure the sensors via frontend.

For me, my sensors are working well via direct API call: https://api.luftdaten.info/v1/sensor/8608/

ghost commented 5 years ago

Hey there @fabaff, mind taking a look at this issue as its been labeled with a integration (luftdaten) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

stale[bot] commented 5 years 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 now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.