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

luftdaten integration component and data from Madavi. #27493

Closed vtashev closed 4 years ago

vtashev commented 5 years ago

Hello dear team, I'm looking how to get temperature and data from sensor that report data to Madavi using luftdaten integration. However the integration get only p1,p2 data from https://api.luftdaten.info, but the temp and humity are on Madavi api.

Am I missing something?

Regards, Vasil

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

frenck commented 5 years ago

Could you share your configuration snippet for this integration?

My initial guess is that you need to add the other sensors to the sensors option list (see integration documentation).

vtashev commented 5 years ago

Intially I did use Configuration-> integrations -> luftdaten which bring out just p1,p2 data My sensor I'd on luftdaten is 10705, and the sensor Id on madavi is 32115

Problem really is that there is no place to specify the two IDs for the two platforms, as one host P1/P2 data, second host temp/humidity data

Here is my conf

luftdaten: sensor_id: 10705 show_on_map: true sensors: monitored_conditions:

Mariusthvdb commented 5 years ago

Yes, encountered likewise issue and reported /asked here https://community.home-assistant.io/t/how-to-setup-multiple-sensors-for-luftdaten/128858

Still not resolved how to do this in confirmation

vtashev commented 5 years ago

It's strange that the readme says you can get data from Madavi, but as far as I see it only query the luftdaten servers

fabaff commented 5 years ago

The luftdaten integration only support P1 and P2. I removed the temperature and the humidity in the underlying module because only a handful of stations supported it in the past.

At first glance I would say that the proper solution would be to merge the data from Madavi with the Luftdaten results.

vantop77 commented 5 years ago

Hello, Since I also have issues getting temperature, humidity and pressure from the luftdaten I did some research. On luftdaten the ID (16450) for the PM is different from the ID for temp, hum and press. I did tried: https://api.luftdaten.info/v1/sensor/16450/

and the browser returns an answer from https://data.sensor.community/airrohr/v1/sensor/16450/

and the answer is: [{"location":{"exact_location":0,"indoor":0,"altitude":"552.5","longitude":"23.31","id":12243,"latitude":"42.708","country":"BG"},"sensordatavalues":[{"value_type":"P1","id":10999327462,"value":"19.70"},{"value":"14.33","id":10999327463,"value_type":"P2"}],"sampling_rate":null,"sensor":{"sensor_type":{"manufacturer":"Nova Fitness","id":14,"name":"SDS011"},"id":16450,"pin":"1"},"timestamp":"2019-10-15 08:20:49","id":5181693300},{"location":{"indoor":0,"exact_location":0,"country":"BG","latitude":"42.708","altitude":"552.5","longitude":"23.31","id":12243},"timestamp":"2019-10-15 08:18:17","id":5181674466,"sensordatavalues":[{"value":"19.90","id":10999287475,"value_type":"P1"},{"value_type":"P2","id":10999287480,"value":"13.03"}],"sampling_rate":null,"sensor":{"sensor_type":{"name":"SDS011","manufacturer":"Nova Fitness","id":14},"id":16450,"pin":"1"}}]

This is all correct and I can use this integration in Hassio without any issues.

If we try the ID (16451) for temp, hum and press of the same station, which is usually +1, again from luftdaten API with the request: https://api.luftdaten.info/v1/sensor/16451/

the received data is from: https://data.sensor.community/airrohr/v1/sensor/16451/

and the answer is: [{"location":{"exact_location":0,"indoor":0,"country":"BG","latitude":"42.708","altitude":"552.5","longitude":"23.31","id":12243},"sensordatavalues":[{"value_type":"temperature","id":10999408624,"value":"18.37"},{"value_type":"humidity","id":10999408628,"value":"49.46"},{"value":"95574.97","id":10999408630,"value_type":"pressure"},{"value_type":"pressure_at_sealevel","value":101926.51}],"sensor":{"sensor_type":{"name":"BME280","manufacturer":"Bosch","id":17},"id":16451,"pin":"11"},"sampling_rate":null,"timestamp":"2019-10-15 08:25:56","id":5181731533},{"id":5181712661,"timestamp":"2019-10-15 08:23:24","sensordatavalues":[{"id":10999368560,"value_type":"temperature","value":"18.21"},{"value":"49.83","id":10999368562,"value_type":"humidity"},{"value":"95570.50","value_type":"pressure","id":10999368564},{"value_type":"pressure_at_sealevel","value":101925.32}],"sensor":{"sensor_type":{"name":"BME280","manufacturer":"Bosch","id":17},"pin":"11","id":16451},"sampling_rate":null,"location":{"altitude":"552.5","id":12243,"longitude":"23.31","country":"BG","latitude":"42.708","indoor":0,"exact_location":0}}]

And here the data is correct because I have direct access to this station.

In my Hassio, if I enter an ID 16451 (this is the ID for temp, hum and press) for luftdaten integration, the integration is saved but no values are displayed, empty integration and I get the following errors:

Error while setting up platform luftdaten Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/src/homeassistant/homeassistant/components/luftdaten/sensor.py", line 38, in async_setup_entry name, icon, unit = SENSORS[sensor_type] KeyError: 'pressure_at_sealevel'

For me, luftdaten is returning information, just Hassio can't manipulate it properly.

I am using Home Assistant 0.100.2

How can this issue be overcomed?

vtashev commented 5 years ago

@fabaff is there Madavi sensor that can be used or shall I manually parse the csv files that they host as API at eg. https://www.madavi.de/sensor/csvfiles.php?sensor=esp8266-699056

vtashev commented 5 years ago

@fabaff actually a friend of mine just told me that the temperature and humidity is present at luftaden, the trick is that you have to increase the id+1

http://api.luftdaten.info/v1/sensor/{apiID}/ for p1 & p2 http://api.luftdaten.info/v1/sensor/{apiID+1}/ for temp, humidity

vantop77 commented 5 years ago

@fabaff could you please make a fix, so the hassio integration can grab from luftdaten also temperature, humidity and pressure?

fabaff commented 5 years ago

If that's the case then I should re-add it.

tomecki88 commented 4 years ago

Hi @fabaff. When are you planning to re-add? I'm also fighting with reading temperature, humidity and pressure (BME280). Thanks in advance!

Tamadite commented 4 years ago

@fabaff & @vtashev, as I understand it, it shouldn't be done automatically (apiID+1) because there is no guarantee that sensor (apiID+1) is on the same device. In other words, a given node UID e.g. esp8266-14115702, can be composed of multiple sensors, e.g. particle matter sensor with SensorID 34030 and temperature/humidity/pressure sensor with SensorID 34031. Unfortunately there is no possibility of polling at node UID level therefore the solution should come by allowing multiple sensor ID definitions.

vtashev commented 4 years ago

@Tamadite having the option to add two sensors or have a copy of luftdaten sensor would be awesome

Lars-P commented 4 years ago

Due to changes in the python-luftdaten library, with the BME280 there is a new value "pressure_at_sealevel". As there is no corresponding sensor, the whole integration fails on those sensors. I just added a pull request to fix that issue. After these changes, it's possible to add both sensors.

vantop77 commented 4 years ago

I do confirm, Home Assistant can grab data from Luftdaten for temperature, humidity, pressure and pressure at see level.