Weather & Air Quality plugin for Bubble
Introduction
Elevate your Bubble.io applications with the ultimate environmental awareness tool. The "Weather & Air Quality" plugin seamlessly integrates comprehensive weather forecasts and real-time air quality data into your projects, empowering users with actionable insights right at their fingertips.
How to set up:
Obtain your api key at https://openweathermap.org/appid (opens in a new tab)
You can use the plugin both with data calls and actions, also I created an action that will transform unix to data, as the openweather gives only unix with thier calls.
You can check my demo page(the links are above) to see an example what can you do with this plugin
For more information, you can write me on email: stefanchiciuc@gmail.com
Thanks and hope you'll like this plugin :))
Actions/Data Calls
This plugin works with API Calls. For API Calls to work you need a working API Key from Open Weather.
The plugin contains the following Data Calls and actions:
Current Weather Data
Access current weather data for any location on Earth! The weather data is collected and processed from different sources such as global and local weather models, satellites, radars and a vast network of weather stations. Data is available in JSON, XML, or HTML format.
Parameter | Required/Optional | Description |
---|---|---|
lat | required | Latitude. If you need the geocoder to automatically convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API (opens in a new tab). |
lon | required | Longitude. If you need the geocoder to automatically convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API (opens in a new tab). |
appid | required | Your unique API key (you can always find it on your account page under the "API key" tab) (opens in a new tab). |
mode | optional | Response format. Possible values are xml and html. If you don't use the mode parameter, the format is JSON by default. Learn more (opens in a new tab) |
units | optional | Units of measurement. standard, metric, and imperial units are available. If you do not use the units parameter, standard units will be applied by default. Learn more (opens in a new tab) |
lang | optional | You can use this parameter to get the output in your language. Learn more (opens in a new tab) |
Call 5 day / 3 hour forecast data
You can search weather forecast for 5 days with data every 3 hours by geographic coordinates. All weather data can be obtained in JSON and XML formats.
Parameter | Required/Optional | Description |
---|---|---|
lat | required | Latitude. If you need the geocoder to automatically convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API. |
lon | required | Longitude. If you need the geocoder to automatically convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API. |
appid | required | Your unique API key (you can always find it on your account page under the "API key" tab). |
units | optional | Units of measurement. Standard, metric, and imperial units are available. If you do not use the units parameter, standard units will be applied by default. Learn more (opens in a new tab) |
mode | optional | Response format. JSON format is used by default. To get data in XML format use mode=xml. Learn more (opens in a new tab) |
cnt | optional | A number of timestamps, which will be returned in the API response. Learn more (opens in a new tab) |
lang | optional | You can use the lang parameter to get the output in your language. Learn more (opens in a new tab) |
Coordinates by location name
Direct geocoding allows to get geographical coordinates (lat, lon) by using name of the location (city name or area name). If you use the limit parameter in the API call, you can cap how many locations with the same name will be seen in the API response (for instance, London in the UK and London in the US).
Parameter | Required/Optional | Description |
---|---|---|
city_name | required | City name, state code (only for the US), and country code divided by a comma. Please use ISO 3166 country codes. |
appid | required | Your unique API key (you can always find it on your account page under the "API key" tab). |
limit | optional | Number of the locations in the API response (up to 5 results can be returned in the API response). |
units | optional | Units of measurement. Standard, metric, and imperial units are available. If you do not use the units parameter, standard units will be applied by default. Learn more (opens in a new tab) |
Get City name by coordinates
Reverse geocoding allows to get name of the location (city name or area name) by using geografical coordinates (lat, lon). The limit parameter in the API call allows you to cap how many location names you will see in the API response.
Parameter | Required/Optional | Description |
---|---|---|
lat, lon | required | Geographical coordinates (latitude, longitude). |
appid | required | Your unique API key (you can always find it on your account page under the "API key" tab). |
limit | optional | Number of the location names in the API response (several results can be returned in the API response). |
Current air pollution data
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 4 days with hourly granularity. Historical data is accessible from 27th November 2020.
Here is a description of OpenWeather scale for Air Quality Index levels:
| Qualitative name | Index | Pollutant concentration in μg/m³ |
Qualitative name | Index | SO₂ | NO₂ | PM₁₀ | PM₂.₅ | O₃ | CO |
---|---|---|---|---|---|---|---|
Good | 1 | [0; 20) | [0; 40) | [0; 20) | [0; 10) | [0; 60) | [0; 4400) |
Fair | 2 | [20; 80) | [40; 70) | [20; 50) | [10; 25) | [60; 100) | [4400; 9400) |
Moderate | 3 | [80; 250) | [70; 150) | [50; 100) | [25; 50) | [100; 140) | [9400; 12400) |
Poor | 4 | [250; 350) | [150; 200) | [100; 200) | [50; 75) | [140; 180) | [12400; 15400) |
Very Poor | 5 | ≥350 | ≥200 | ≥200 | ≥75 | ≥180 | ≥15400 |
The action/call structure:
Parameter | Required/Optional | Description |
---|---|---|
lat | required | Latitude. If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API. |
lon | required | Longitude. If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API. |
appid | required | Your unique API key |
Forecast air pollution data
The forecast air pollution maintain the same structure as the previous Current air pollution, the only difference is that it will return a list of air pullution data each with a timestamp for the next 5 days with a step of 1 hour.
Historical air pollution data
Historical air polution allows you to get air quality data for a specific date or period of time.
Parameter | Required/Optional | Description |
---|---|---|
lat | required | Latitude. If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API. |
lon | required | Longitude. If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API. |
start | required | Start date (unix time, UTC time zone), e.g. start=1606488670. |
end | required | End date (unix time, UTC time zone), e.g. end=1606747870. |
appid | required | Your unique API key (you can always find it on your account page under the "API key" tab). |
Get Weather Icons
This call allows you to call and display the native OpenWeatherMap weather icons in your app, with every you call you use you get a code such as this:
"weather": [
{
"id": 500,
"main":"Rain",
"description": "light rain",
"icon": "10n"
}
],
And you can use the icon code to automatically display the icon, you can read more about them here: https://openweathermap.org/weather-conditions#Icon-list (opens in a new tab)
Icon List:
Day icon | Night icon | Description |
---|---|---|
01d.png | 01n.png | clear sky |
02d.png | 02n.png | few clouds |
03d.png | 03n.png | scattered clouds |
04d.png | 04n.png | broken clouds |
09d.png | 09n.png | shower rain |
10d.png | 10n.png | rain |
11d.png | 11n.png | thunderstorm |
13d.png | 13n.png | snow |
50d.png | 50n.png | mist |
Unix to Date
This action allows you to transform UNIX timestamps used in data you receive from weather or air quality calls. It requires a number type of input and returns a Bubble date type of result.
Example of usage you can find on demo page:
Date to Unix
This action is the inverse of the previous action, transforming a Bubble date type value into a UNIX timestamp.
Need a hand?
For inquiries please send an email to stefanchiciuc@gmail.com
Help us improve
Support us by rating the plugin at Bubble