Weather & Air Quality

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.

ParameterRequired/OptionalDescription
latrequiredLatitude. 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).
lonrequiredLongitude. 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).
appidrequiredYour unique API key (you can always find it on your account page under the "API key" tab) (opens in a new tab).
modeoptionalResponse 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)
unitsoptionalUnits 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)
langoptionalYou 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.

ParameterRequired/OptionalDescription
latrequiredLatitude. 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.
lonrequiredLongitude. 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.
appidrequiredYour unique API key (you can always find it on your account page under the "API key" tab).
unitsoptionalUnits 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)
modeoptionalResponse format. JSON format is used by default. To get data in XML format use mode=xml. Learn more (opens in a new tab)
cntoptionalA number of timestamps, which will be returned in the API response. Learn more (opens in a new tab)
langoptionalYou 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).

ParameterRequired/OptionalDescription
city_namerequiredCity name, state code (only for the US), and country code divided by a comma. Please use ISO 3166 country codes.
appidrequiredYour unique API key (you can always find it on your account page under the "API key" tab).
limitoptionalNumber of the locations in the API response (up to 5 results can be returned in the API response).
unitsoptionalUnits 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.

ParameterRequired/OptionalDescription
lat, lonrequiredGeographical coordinates (latitude, longitude).
appidrequiredYour unique API key (you can always find it on your account page under the "API key" tab).
limitoptionalNumber 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 nameIndexSO₂NO₂PM₁₀PM₂.₅O₃CO
Good1[0; 20)[0; 40)[0; 20)[0; 10)[0; 60)[0; 4400)
Fair2[20; 80)[40; 70)[20; 50)[10; 25)[60; 100)[4400; 9400)
Moderate3[80; 250)[70; 150)[50; 100)[25; 50)[100; 140)[9400; 12400)
Poor4[250; 350)[150; 200)[100; 200)[50; 75)[140; 180)[12400; 15400)
Very Poor5≥350≥200≥200≥75≥180≥15400

The action/call structure:

ParameterRequired/OptionalDescription
latrequiredLatitude. 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.
lonrequiredLongitude. 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.
appidrequiredYour 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.

ParameterRequired/OptionalDescription
latrequiredLatitude. 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.
lonrequiredLongitude. 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.
startrequiredStart date (unix time, UTC time zone), e.g. start=1606488670.
endrequiredEnd date (unix time, UTC time zone), e.g. end=1606747870.
appidrequiredYour 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 iconNight iconDescription
01d.png01n.pngclear sky
02d.png02n.pngfew clouds
03d.png03n.pngscattered clouds
04d.png04n.pngbroken clouds
09d.png09n.pngshower rain
10d.png10n.pngrain
11d.png11n.pngthunderstorm
13d.png13n.pngsnow
50d.png50n.pngmist

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: Alt text Alt text

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