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.82k stars 30.51k forks source link

Luftdaten integration can't grab data #33355

Closed vantop77 closed 4 years ago

vantop77 commented 4 years ago

The problem

Since last night I have problems getting data from luftdaten. The usual JSON address is https://api.luftdaten.info/v1/sensor/{sensorID}/ and it is not responding. I guess luftdaten has made some changes to their API because I don't find it any more on the API Wiki https://github.com/opendata-stuttgart/meta/wiki/EN-APIs. In my HA I have setup 4 different sensors and all of them are experiencing the same issue. I have included the error log.

Environment

Problem-relevant configuration.yaml

Traceback/Error logs

2020-03-28 11:15:52 ERROR (MainThread) [luftdaten] Can not load data from luftdaten.info 2020-03-28 11:15:52 ERROR (MainThread) [homeassistant.components.luftdaten] Unable to retrieve data from luftdaten.info 2020-03-28 11:16:24 ERROR (MainThread) [luftdaten] Can not load data from luftdaten.info 2020-03-28 11:16:24 ERROR (MainThread) [homeassistant.components.luftdaten] Unable to retrieve data from luftdaten.info 2020-03-28 11:16:56 ERROR (MainThread) [luftdaten] Can not load data from luftdaten.info 2020-03-28 11:16:56 ERROR (MainThread) [homeassistant.components.luftdaten] Unable to retrieve data from luftdaten.info 2020-03-28 11:17:28 ERROR (MainThread) [luftdaten] Can not load data from luftdaten.info 2020-03-28 11:17:28 ERROR (MainThread) [homeassistant.components.luftdaten] Unable to retrieve data from luftdaten.info

Additional information

probot-home-assistant[bot] commented 4 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!

vantop77 commented 4 years ago

Hello @fabaff , I would like to give you some more feedback regarding the problem. When I created the ticket there has been a problem with the servers of luftdaten. Since yesterday the issue is resolved and the server responds but they have changed the method and server URL used for grabbing the data. As it is written on https://github.com/opendata-stuttgart/meta/wiki/EN-APIs the new API for getting readings from one particular sensor is: https://data.sensor.community/airrohr/v1/sensor/{apiID}/ - all measurements of the last 5 minutes for one sensor. Where {apiID} is the sensor ID. For tries, you can use the ID of my sensor which is online and returns data, 16450 for Particulate Matter readings and 16451 for Temperature, Humidity, Pressure and Pressure at Sea Level. Here are the complete URLs: https://data.sensor.community/airrohr/v1/sensor/16450/ https://data.sensor.community/airrohr/v1/sensor/16451/

In the last version of the API, the request URL is the same as the responding one.

I am not sure if the JSON response structure is the same as the old version of the API. You should check it yourself.

Could you please make the required changes in the luftdaten integration using the new API description?

fabaff commented 4 years ago

See https://github.com/fabaff/python-luftdaten/pull/8

vantop77 commented 4 years ago

Thank you. I guess we should see the fix in next release of HA.

fabaff commented 4 years ago

I will update the requirements of the dependency.

vantop77 commented 4 years ago

Just to let know @fabaff that the old API URL started working 2 days ago, but anyway we should move to the new URL which is working.