Plugin screenshot thumbnail 1/1

Bolden OpenWeather Craft CMS 3 plugin

openWeathermap.org weather plugin for Craft CMS 3.x

Integrate weather information from any location right into your Craft CMS 3 website

Requirements

This plugin requires Craft CMS 3 or later and an active API key from openWeathermap.org

Overview

Access the weather information via TWIG functions or AJAX calls. You can choose between simplified and raw representation of weather data. Weather data is stored in your database and only updates when refresh interval has passed in order to save bandwidth and improve performance.

Configuration

  • Fill in the openWeathermap API key to use the plugin.
  • Setup the refresh interval (minutes) to setup when weather should be updated.
  • Use a default location (latitude, longitude) to get the weather.

Using

There are two ways to use the plugin, via twig functions and HTTP requests.

Twig functions

  • craft.openWeather.simplified(lat, lon)
    Given a latitude and longitude returns the simplified version of weather (array).
  • craft.openWeather.raw(lat, lon)
    Given a latitude and longitude returns the raw version of weather (array).
  • craft.openWeather.defaultLocation()
    Returns the latitude and longitude (as array) of the default location setup in the settings.

HTTP requests

  • /api/openWeather/lat-lon/<latitude>,<latitude>,<label>
    Given a latitude and longitude returns the simplified version of weather data; optionally pass a label parameter to set a custom label for the given location.
  • /api/openWeather/default
    Returns the simplified version of weather data of the default location as setup in the settings.
  • /api/openWeather/raw/lat-lon/<latitude>,<latitude>,<label>
    Given a latitude and longitude returns the raw version of weather data; optionally pass a label parameter to set a custom label for the given location.
  • /api/openWeather/raw/default
    Returns the raw version of weather data of the default location as setup in the settings

Example

Request
GET /api/openWeather/default

Response

{
  "status": "clear",
  "temperature": 22.30,
  "city": "Jordaan",
  "label": "Amsterdam",
  "country_iso": "NL",
  "clear": true,
  "partial-clear": false,
  "clouds": false,
  "hot": false,
  "mist": false,
  "rain": false,
  "thunderstorm": false,
  "snow": false,
  "ice": false,
  "wind": false,
  "wind_direction": "S",
  "text": "Clear",
  "day": true,
  "night": false
}

Request
GET /api/openWeather/raw/default

Response

{
  "status": "Clear",
  "city": "Jordaan",
  "label": "Amsterdam",
  "country_iso": "NL",
  "temperature": 22,
  "humidity": 56,
  "visibility": 10000,
  "wind_speed": 3,
  "wind_direction": 170,
  "sunrise": "2018-10-16T08:08:24+02:00",
  "sunset": "2018-10-16T18:42:41+02:00"
}

Credits

Made with ❤️ by Bolden and free to use!

Installation Instructions

To install this plugin, copy the command above to your terminal.

Reviews

This plugin doesn't have any reviews.

Active Installs
22
Version
1.0.2
License
MIT
Compatibility
Craft 3
Last release
July 9, 2019
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs