A Home Assistant custom component that fetches air pollution sensor data from Vilnius city's air quality monitoring network at miestoplauciai.vilnius.lt/orotarsa.
This custom component integrates Vilnius city air quality sensors into Home Assistant, providing real-time particulate matter (PM) measurements from selected monitoring stations across the city.
- Fetches air pollution data from Vilnius city's official air quality monitoring API
- Supports selection of specific air quality sensor stations by sensor ID
- Automatically detects and creates sensors for all available pollutants at the selected station
- Measures various air quality parameters including:
- Particulate matter (PM1, PM2.5, PM10)
- Sulfur dioxide (SO2)
- Carbon monoxide (CO)
- Volatile organic compounds (VOC)
- Ammonia (NH3)
- Nitrogen oxides (NO2, NO)
- Ozone (O3)
- Automatic updates every hour
- Cloud polling integration with Vilnius OpenCity API
- Supports multiple sensor stations - add the integration multiple times with different sensor IDs
- Make sure you have HACS installed in your Home Assistant instance
- Open HACS in your Home Assistant instance
- Click on Integrations
- Click the three dots in the top right corner
- Select Custom repositories
- Add the repository URL:
https://github.com/untitledlt/ha-miesto-plauciai - Select category: Integration
- Click Add
- Find "Vilnius Air Quality" in HACS and click Download
- Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration
- Search for "Vilnius Air Quality"
- Enter the sensor index for your chosen monitoring station
- Download the latest release from GitHub
- Extract the archive
- Copy the
custom_components/vilnius_airdirectory to your Home Assistant'scustom_componentsfolder - Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration
- Search for "Vilnius Air Quality"
- Enter the sensor index for your chosen monitoring station
- Navigate to your Home Assistant configuration directory (where
configuration.yamlis located) - If you don't have a
custom_componentsdirectory, create it:mkdir custom_components cd custom_components - Clone this repository:
git clone https://github.com/untitledlt/ha-miesto-plauciai.git cd ha-miesto-plauciai - Copy the integration to your custom_components folder:
cp -r custom_components/vilnius_air ../vilnius_air
- Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration
- Search for "Vilnius Air Quality"
- Enter the sensor index for your chosen monitoring station
The integration is configured through the Home Assistant UI:
- Navigate to Settings → Devices & Services
- Click Add Integration
- Search for "Vilnius Air Quality"
- Enter the sensor_index for your preferred air quality monitoring station
To find the sensor index for a specific monitoring station:
- Visit miestoplauciai.vilnius.lt/orotarsa
- Select a sensor location on the map
- Note the sensor index/ID for that location
- Use this ID during integration setup
| Sensor Index | Name | Latitude | Longitude |
|---|---|---|---|
| 87539 | Zujūnai | 54.72728 | 25.169634 |
| 97695 | Vilniaus Maironio progimnazija | 54.71449 | 25.237741 |
| 91147 | Vinco Kudirkos aikštė | 54.68735 | 25.279945 |
| 92611 | Vilniaus Taikos progimnazija | 54.715042 | 25.21283 |
| 97681 | Vilniaus Joachimo Lelevelio inžinerijos gimnazija | 54.70567 | 25.29908 |
| 97687 | Vilniaus Aleksandro Puškino gimnazija | 54.731033 | 25.222054 |
| 97731 | Vilniaus kunigaikščio Gedimino progimnazija | 54.692867 | 25.266613 |
| 97893 | Vilniaus Baltupių progimnazija | 54.730103 | 25.272648 |
| 97903 | Vilniaus Lazdynų vidurinė mokykla | 54.675785 | 25.212624 |
| 97905 | Vilniaus Martyno Mažvydo progimnazija | 54.70702 | 25.180683 |
| 97749 | Grigiškių Šviesos gimnazija | 54.667286 | 25.098402 |
| 97915 | Vilniaus Žaliakalnio darželis-mokykla | 54.686897 | 25.412926 |
| 90315 | Vilniaus Sietuvos progimnazija | 54.72162 | 25.227186 |
| 97919 | Vilniaus Ryto progimnazija | 54.694225 | 25.210457 |
| 97957 | Vilniaus Jono Basanavičiaus progimnazija | 54.679886 | 25.255571 |
| 97959 | Vilniaus Prano Mašioto pradinė mokykla | 54.715786 | 25.307705 |
| 97963 | Vilniaus Naujininkų progimnazija | 54.660263 | 25.268192 |
| 97967 | Vilniaus Naujamiesčio mokykla | 54.67775 | 25.267 |
| 97969 | Vilniaus Gerosios Vilties progimnazija | 54.671345 | 25.251398 |
| 97973 | Vilniaus Antano Vienuolio progimnazija | 54.673107 | 25.28931 |
| 97977 | Vilniaus Antakalnio progimnazija | 54.701992 | 25.310047 |
| 97979 | Vilniaus lopšelis-darželis "Eglutė" | 54.70372 | 25.248451 |
| 98015 | Vilniaus Fabijoniškių gimnazija | 54.732414 | 25.240326 |
| 30366 | Vėtrungių / S. Neries g. 7 (2 sensorius) | 54.733122 | 25.237299 |
| 30416 | Vėtrungių / S. Neries g. 7 (1 sensorius) | 54.73299 | 25.236736 |
Once configured, the integration creates sensor entities for all available pollutants from your selected monitoring station. Different stations may provide different measurements:
| Sensor | Description | Unit |
|---|---|---|
| PM1 | PM1 particulate matter concentration | µg/m³ |
| PM2.5 | PM2.5 particulate matter concentration | µg/m³ |
| PM10 | PM10 particulate matter concentration | µg/m³ |
| Sensor | Description | Unit |
|---|---|---|
| SO2 | Sulfur dioxide concentration | µg/m³ |
| CO | Carbon monoxide concentration | mg/m³ |
| VOC | Volatile organic compounds | ppb |
| NH3 | Ammonia concentration | µg/m³ |
| NO2 | Nitrogen dioxide concentration | µg/m³ |
| NO | Nitrogen monoxide concentration | µg/m³ |
| O3 | Ozone concentration | µg/m³ |
Note: The integration automatically creates sensors only for pollutants that are measured by your selected monitoring station. Entity names include the sensor ID (e.g., sensor.vilnius_air_30416_pm2_5) to support multiple sensor stations.
Data is fetched from the Vilnius OpenCity API:
https://opencity.idvilnius.lt/atviras/rest/services/Aplinka/Oro_tarsa/MapServer/4/query
The component queries the API every hour to retrieve the latest air quality measurements from your selected monitoring station.
- 0-10 µg/m³ - Good
- 10-25 µg/m³ - Moderate
- 25-50 µg/m³ - Unhealthy for sensitive groups
- 50-75 µg/m³ - Unhealthy
- 75+ µg/m³ - Very unhealthy
- 0-20 µg/m³ - Good
- 20-50 µg/m³ - Moderate
- 50-100 µg/m³ - Unhealthy for sensitive groups
- 100-200 µg/m³ - Unhealthy
- 200+ µg/m³ - Very unhealthy
Example automation to send notification when air quality is poor:
automation:
- alias: "Alert on Poor Air Quality"
trigger:
- platform: numeric_state
entity_id: sensor.vilnius_pm2_5
above: 50
action:
- service: notify.mobile_app
data:
title: "Poor Air Quality Alert"
message: "PM2.5 levels are unhealthy. Consider staying indoors."- Ensure the custom component folder is correctly placed in
config/custom_components/vilnius_air - Check Home Assistant logs for any error messages
- Verify your sensor_index is valid
- Verify the sensor_index corresponds to an active monitoring station
- Check if the Vilnius OpenCity API is accessible
- The API may occasionally be down for maintenance
Contributions are welcome! Please feel free to submit issues or pull requests on the GitHub repository.
This project is provided as-is for community use.
- Air quality data provided by Vilnius City Municipality
- Data source: miestoplauciai.vilnius.lt
