Initially, like yourself, I thought I could use the luftdaten device’s own JSON interface to retrieve air quality data. However, running that over a longer period of time I noticed that the device was frequently unresponsive for a couple of seconds - I assume around the time the ESP was busy spinning up the SDS011 sensor. This in turn led to many failed attempts by the HA rest sensor to retrieve the data.
Eventually I decided to have the device upload its data into a local InfluxDB, and I configured some sensors to retrieve air quality data from InfluxDB.
More details can be found here:
I wonder if it would be possible to use the Send data to own API might be a good idea so we could just push it into home assistant, i just cant seem to find information on what is pushed
I briefly looked at that option, but I don’t think this would work with HA. My understanding is the key thing missing in the luftdaten device’s capability to send data to a random API is the ability to set the “Authorization” header with a token.
We could possibly have a php page or flask server running on the same machine as home assistant and then push that to home assistant making it a local push rather than a local poll making it a lot more reliable
I am running this setup now since I posted it first and i have had no problems with the setup in that time. Only once I had to manually restart the whole sensor box because the SDS did not measure anything anymore although the DHT in the same box kept on working.
So for me this is an optimal solution. No need for improvements.
I don’t see the advantage of this compared to going through InfluxDB.
Luftdaten sensor pushes to InfluxDB (built in capability), and HA pulls from InfluxDB (built in integration).