How to setup multiple sensors for Luftdaten

Hi,

Trying to setup a few Luftdaten station sensors, because not all stations provide all desired monitored conditions. The doc is a bi unclear on the possibility for that, so please help me and have a look how to do so?

this is the setup for 1 station:

luftdaten:
  sensor_id: 155
  show_on_map: true
  sensors:
    monitored_conditions:
      - temperature
      - humidity

but id like to have more so should we do that like this:

luftdaten:
  sensor_id: 155
  show_on_map: true
  sensors:
    monitored_conditions:
      - temperature
      - humidity

  sensor_id: 156
  show_on_map: true
  sensors:
    monitored_conditions:
      - P1
      - P2

  sensor_id: 156
  show_on_map: true
  sensors:
    monitored_conditions:
      - pressure

No replies? I’m trying to do the same thing. I can get the PM10 and PM2.5 data from one sensor, but not the P/T/H from what Luftdaten considers another entire sensor.

Hmmmmm… And now I ended here too. Same problem. Hope someone sees this. Ill check over at github too.

Edit: Many open issues registered on github. See: https://github.com/home-assistant/home-assistant/search?p=6&q=luftdaten&type=Issues

Seems fabaff is the only one maintaining this sensor. And fabaff has to handle a lot with home assistant. We have to be patient or start coding on our selves.

have you seen this: https://github.com/home-assistant/home-assistant/issues/27493?email_source=notifications&email_token=AH6PDHM6NG5MYHOX6QCEIELQOIINVA5CNFSM4I762REKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBCFNCA#issuecomment-541349512

there’s attention for all I can see, lets help as much as we can

The luftdaten: component configuration should allow (but it does not) the definition of multiple sensors. Something like:

luftdaten:
  - sensor_id: 12345
    show_on_map: false
    sensors:
      monitored_conditions:
        - P1
        - P2
  - sensor_id: 12346
    show_on_map: false
    sensors:
      monitored_conditions:
        - temperature
        - humidity
        - pressure

For more information, refer to this link (GitHub).

it appears not:

2019-11-08 23:20:25 ERROR (MainThread) [homeassistant.components.hassio] Package package_weather setup failed. Component luftdaten cannot be merged. Expected a dict.

Possibly you could set up REST sensors for the other values, and extract them from the JSON returned, e.g. from https://data.sensor.community/airrohr/v1/sensor/50322/ for temperature, humidity and pressure? That’s the approach I intend to take, as I am having the same problem too, with only being able to set up a single Luftdaten sensor in the config.

I will post an example later, once I have sussed the syntax.

Hey Ruth,
thanks for you post, I had forgotten about Luftdaten :wink:

just checked, and we now are able to setup more stations via the integration interface:


only p1 and p2 though, maybe these stations dont provide other data (renaming doesn’t change the sensor names…):

That’s cool! I’ve managed to get temperature, humidity and pressure through by setting up the following using REST sensors btw:

# Luftdaten Temperature
- platform: rest
  name: Luftdaten Temperature
  resource: https://data.sensor.community/airrohr/v1/sensor/50322/
  method: GET
  value_template: Luftdaten Temperature
  json_attributes_path: "$.[0].sensordatavalues[?(@.value_type=='temperature')]"
  json_attributes:
    - "value"

# Luftdaten Humidity
- platform: rest
  name: Luftdaten Humidity
  resource: https://data.sensor.community/airrohr/v1/sensor/50322/
  method: GET
  value_template: Luftdaten Humidity
  json_attributes_path: "$.[0].sensordatavalues[?(@.value_type=='humidity')]"
  json_attributes:
    - "value"

# Luftdaten Pressure
- platform: rest
  name: Luftdaten Pressure
  resource: https://data.sensor.community/airrohr/v1/sensor/50322/
  method: GET
  value_template: Luftdaten Pressure
  json_attributes_path: "$.[0].sensordatavalues[?(@.value_type=='pressure')]"
  json_attributes:
    - "value"

# Template sensors
- platform: template
  sensors:

    # Outside temperature
    outside_temperature:
      friendly_name: 'Outside Temperature'
      value_template: "{{ state_attr('sensor.luftdaten_temperature', 'value') | float }}"
      unit_of_measurement: '°C'

    # Outside humidity
    outside_humidity:
      friendly_name: 'Outside Humidity'
      value_template: "{{ state_attr('sensor.luftdaten_humidity', 'value') | float }}"
      unit_of_measurement: '%'

    # Outside pressure
    outside_pressure:
      friendly_name: 'Outside Pressure'
      value_template: "{{ state_attr('sensor.luftdaten_pressure', 'value') | float }}"
      unit_of_measurement: 'hPa'

That’s giving me what I need. Hope that helps if you want to get temperature, humidity and pressure from Luftdaten too.

Nice!

just found one indeed:

Had several issue in the past with rest sensors, causing all kinds of trouble down the HA instance, so I’ve taken them all out.
Could carefully add a few of these to have a peek :wink:

does this source you’re using have some kind of overview? I can find all my sensors individually, and get correct data, but an overview would be nice. Or are you also using https://deutschland.maps.luftdaten.info for that?
thanks.

Ah yes. I’ve just added some filter sensors incidentally:

# Outside filtered temperature
- platform: filter
  name: Outside Filtered Temperature
  entity_id: sensor.outside_temperature
  filters:
    - filter: outlier
      window_size: 10
      radius: 1.0

# Outside filtered humidity
- platform: filter
  name: Outside Filtered Humidity
  entity_id: sensor.outside_humidity
  filters:
    - filter: outlier
      window_size: 10
      radius: 1.0

# Outside filtered pressure
- platform: filter
  name: Outside Filtered Pressure
  entity_id: sensor.outside_pressure
  filters:
    - filter: outlier
      window_size: 10
      radius: 1.0

as I was getting a few zero values in for the air pressure, which was messing up my data.

Not sure what you mean by an overview - I’m only polling one Luftdaten station incidentally - as it’s one that’s on a drain pipe outside my house. But the data is going into InfluxDB so I can graph it in Grafana:

Although there’s very little from the (filtered) Luftdaten temperature, humidity and pressure sensors so far, as I have only just added them.

For temperature and humidity, there’s also a Met Office feed from the local Met Office weather station half a mile or so away, and data from various AM2302 temperature/humidity sensors attached to Raspberry Pi’s in various rooms of the house.

How do you add more than one in the UI?

simply add them via the integrations page