Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Integrate Air Pollution API from OpenWeatherMap. #198

Open
DoWenzl94 opened this issue Apr 2, 2021 · 3 comments
Open
Milestone

Comments

@DoWenzl94
Copy link

Hi, is there a possibility that you can integrate the Air Pollution API from OpenWeatherMap to get all this datas?


Air Pollution API concept
Air Pollution API provides current, forecast and historical air pollution data for any coordinates on the globe

Besides basic Air Quality Index, the API returns data about polluting gases, such as Carbon monoxide (CO), Nitrogen monoxide (NO), Nitrogen dioxide (NO2), Ozone (O3), Sulphur dioxide (SO2), Ammonia (NH3), and particulates (PM2.5 and PM10).

Air pollution forecast is available for 5 days with hourly granularity. Historical data is accessible from 27th November 2020.

Current air pollution data
API call

http://api.openweathermap.org/data/2.5/air_pollution?lat={lat}&lon={lon}&appid={API key}

@DoWenzl94 DoWenzl94 changed the title Integrate Air Pollution API from OpenWeatherMap. [Feature request] Integrate Air Pollution API from OpenWeatherMap. Apr 2, 2021
@purofy
Copy link

purofy commented Apr 13, 2021

*push

@problemss
Copy link

Would love to see this as well. For the original creator of this, may want to change the label to new feature.

@problemss
Copy link

problemss commented Sep 11, 2021

Not sure if you found a solution, but I ended up using another Homebridge plugin called HTTP-Advanced-Accessory and created an Air Quality Sensor using the OpenWeatherMap apis. The PM2.5 isn't being created in the plugin, but everything else is working. I put my config down below, just replace with your lon, lat, and id. Lastly Carbon Monoxide and some of the other values are not listed in the apple sensor characteristics, but are in other sensors, if you wanted them.

{
    "accessory": "HttpAdvancedAccessory",
    "service": "AirQualitySensor",
    "name": "Air Quality",
    "debug": true,
    "forceRefreshDelay": 1800,
    "optionCharacteristic": [
        "NitrogenDioxideDensity",
        "OzoneDensity",
        "PM10Density",
        "PM2_5Density",
        "SulphurDioxideDensity"
    ],
    "urls": {
        "getAirQuality": {
            "url": "http://api.openweathermap.org/data/2.5/air_pollution?lat={lat}&lon={lon}&appid={appid}",
            "httpMedthod": "",
            "body": "",
            "mappers": [
                {
                    "type": "jpath",
                    "parameters": {
                        "jpath": "$.list[0].main.aqi",
                        "index": 0
                    }
                }
            ]
        },
        "getNitrogenDioxideDensity": {
            "url": "http://api.openweathermap.org/data/2.5/air_pollution?lat={lat}&lon={lon}&appid={appid}",
            "httpMedthod": "",
            "body": "",
            "mappers": [
                {
                    "type": "jpath",
                    "parameters": {
                        "jpath": "$.list[0].components.no2",
                        "index": 0
                    }
                }
            ]
        },
        "getOzoneDensity": {
            "url": "http://api.openweathermap.org/data/2.5/air_pollution?lat={lat}&lon={lon}&appid={appid}",
            "httpMedthod": "",
            "body": "",
            "mappers": [
                {
                    "type": "jpath",
                    "parameters": {
                        "jpath": "$.list[0].components.o3",
                        "index": 0
                    }
                }
            ]
        },
        "getPM10Density": {
            "url": "http://api.openweathermap.org/data/2.5/air_pollution?lat={lat}&lon={lon}&appid={appid}",
            "httpMedthod": "",
            "body": "",
            "mappers": [
                {
                    "type": "jpath",
                    "parameters": {
                        "jpath": "$.list[0].components.pm10",
                        "index": 0
                    }
                }
            ]
        },
        "getPM2_5Density": {
            "url": "http://api.openweathermap.org/data/2.5/air_pollution?lat={lat}&lon={lon}&appid={appid}",
            "httpMedthod": "",
            "body": "",
            "mappers": [
                {
                    "type": "jpath",
                    "parameters": {
                        "jpath": "$.list[0].components.pm2_5",
                        "index": 0
                    }
                }
            ]
        },
        "getSulphurDioxideDensity": {
            "url": "http://api.openweathermap.org/data/2.5/air_pollution?lat={lat}&lon={lon}&appid={appid}",
            "httpMedthod": "",
            "body": "",
            "mappers": [
                {
                    "type": "jpath",
                    "parameters": {
                        "jpath": "$.list[0].components.so2",
                        "index": 0
                    }
                }
            ]
        }
    }
}

@naofireblade naofireblade added this to the 3.4.0 milestone May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants