This custom component for Home Assistant integrates your (own) local Luftdaten sensor (air quality/particle sensor) without using the cloud. If you want to know more about the sensor and how to build one check this website: https://luftdaten.info/en/home-en/
If you use HACS you can install and update this component easily via the default repository. Go into HACS -> Integrations and search for luftdaten.
Download and unzip or clone this repository and copy local_luftdaten/ from custom_components/ to ~/.homeassistant/custom_components/.
This integration now uses Home Assistant UI config flow.
- Go to Settings -> Devices & Services -> Add Integration.
- Search for Local Luftdaten.
- Fill in host, monitored conditions, and optional settings.
Existing YAML platform config is automatically imported into a config entry at startup.
After import, remove the sensor: - platform: local_luftdaten block from configuration.yaml.
| Parameter | Type | Necessity | Description |
|---|---|---|---|
host |
string | required | IP address of the sensor |
scan_interval |
number | default: 180 | Frequency (in seconds) between updates |
name |
string | required | Name of the sensor |
monitored_conditions |
list | required | List of the monitored sensors |
# Legacy format (auto-imported once):
sensor:
- platform: local_luftdaten
host: 192.168.0.123
scan_interval: 180
name: Feinstaubsensor
monitored_conditions:
- SDS_P1
- SDS_P2
- temperature
- humidityAt the moment following sensor data can be read:
- BME280_humidity
- BME280_pressure
- BME280_temperature
- BMP_pressure
- BMP_temperature
- BMP280_pressure
- BMP280_temperature
- DS18B20_temperature
- HECA_humidity
- HECA_temperature
- HPM_P1
- HPM_P2
- HTU21D_humidity
- HTU21D_temperature
- humidity
- SDS_P1
- SDS_P2
- PMS_P0
- PMS_P1
- PMS_P2
- SHT3X_humidity
- SHT3X_temperature
- SPS30_P0
- SPS30_P1
- SPS30_P2
- SPS30_P4
- SEN5X_P0
- SEN5X_P1
- SEN5X_P2
- SEN5X_P4
- SEN5X_NOX
- SEN5X_VOC
- temperature
- signal
Sensor type signal gives the wifi signal strength of the sensor device.
Please open an issue if you want to see other attributes and provide me with a sample of your sensor data by calling http://192.168.x.y/data.json.
Use Template Sensors to round the values or to give them an offset.
template:
- sensor:
- name: Temperature
unit_of_measurement: '°C'
state: '{{ (states("sensor.feinstaubsensor_temperature") | float) | round(1) - 2 }}'To adjusted the atmospheric pressure to the equivalent sea level pressure you need to use the barometric formula which depends on the altitude and the current temperature.
In this example we use an altitude of 300m and receive the temperature from our sensor sensor.feinstaubsensor_temperature.
atmospheric_pressure:
value_template: >-
{% set temperature_gradient = 0.0065 %}
{% set exponent = 0.03416 / temperature_gradient %}
{% set altitude_meters = 300 %}
{% set temperature_celsius = states('sensor.feinstaubsensor_temperature') | float %}
{% set temperautre_at_sealevel_kelvin = temperature_celsius + (temperature_celsius * temperature_gradient) + 273.15 %}
{% set air_pressure_hpa = (states('sensor.feinstaubsensor_pressure') | float / 100) | round(1) %}
{{ (air_pressure_hpa / (1 - ((temperature_gradient * altitude_meters) / temperautre_at_sealevel_kelvin)) ** exponent) | round(1) }}
friendly_name: 'Atmospheric pressure'
unit_of_measurement: 'hPa'