Homebridge plugin presenting information about air quality, temperature, humidity and pressure from Airly API.
By default measurement values are interpolated by averaging measurements from nearby sensors (up to 1,5km away from the given point). The returned value is a weighted average, with the weight inversely proportional to the distance from the sensor to the given point.
If you live outside of Poland or in case when the default approach to getting measurements won't work it's highly recommended to use nearest option to get measurements for an installation closest to a given location.
You can control the size of the area that will be scanned for the nearest installation by providing maxDistance
(number, double, kilometers) in the config file.
However, if for some reason you want to get measurements from particular location you should provide locationId
(number, integer) in the config file. You can obtain the locationId
by going to the Airly Map. The easiest way to find the location's id is to select particular location, clicking on "Add widget to your site". At the bottom of the panel you can find "Generated code" section. You can find the location's id out there.
You shouldn't have nearest
set to true
and locationId
at the same time as it may cause unexpected side effects.
Second (>= 2.00) version of the plugin works world-wide, please keep in mind that Airly coverage is slightly worse outside of Poland.
- Install Homebridge using:
(sudo) npm install -g --unsafe-perm homebridge
. - Install this plugin using:
(sudo) npm install -g homebridge-airly-v2-nubzor
. - Get API Key from Airly. Login here https://developer.airly.eu/login and generate it.
- Decide on the how you want to get the data, following options are available
- Default - Find out your coordinates (latitude and longitude). Based on that information Airly will show measurements from nearest sensor. You can use this page https://www.latlong.net/,
- Nearest - First, follow the
Default
steps, then setnereast
true and controlmaxDistance
to get measurements from the closest device to your position, - From particular
locationId
- Find out thelocationId
, you can use the tips from the first section of README.
- Update your configuration file like the example below.
This plugin is returning data such as: AQI (Air Quality Index), PM2.5, PM10, temperature, humidity and pressure.
Please, be advised that pressure is a custom characteristic which means it won't be present neither in Homebridge nor Home app. It's available in the apps which supports custom characteristics like Eve or Controller.
Example config.json
"accessories": [
{
"accessory": "Air",
"name": "Airly Air Quality",
"apikey": "YOUR_API_KEY",
"latitude": "YOUR_LATITUDE",
"longitude": "YOUR_LONGITUDE",
"nearest": false,
"maxDistance": 5,
"locationId": 0,
"characteristics": {
"PM25": true,
"PM10": true,
"temperature": true,
"humidity": true,
"pressure": true
}
}
]
Fields:
accessory
must be "Air" (required).name
Is the name of accessory (required).apikey
API key from Airly Developers (required).latitude
String with your latitude e.g."52.229676"
. Required for the default and nearest approach to obtaining measurements.longitude
String with your longitude e.g."21.012229"
. Required for the default and nearest approach to obtaining measurements.nearest
Default false. Boolean (true/false) to change the approach to obtain measurements.maxDistance
Default 5. Number (integer, value in kilometers). It controls the size of the area that will be scanned for installations. The closest one to your lat/lng will be choosen.locationId
Default 0. Providing any positive number will turn on obtaining measurements through the location's id.characteristics
an object that represents available characteristics (PM25, PM10, temperature. humidity
andpressure
). Use it to control which one you want to have present in the accessory. By default all are turned on.
This project is based on Homebridge-airly-v2 made by andrzejf1994 it contains several improvements as the original project seems to be abandoned
Project is based on homebridge-airly and homebridge-weather and homebridge-arinow.
The difference between the base version is: