Skip to content

RedisTimeSeries/redis-weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grafana Smart Weather Dashboard

Grafana 7 RedisTimeSeries Grafana-Redis-Datasource

Introduction

The purpose of this software is export current, hourly and daily weather forecast from https://openweathermap.org and display it on Grafana dashboards in the various numeric and graphs forms for a precise vision of the weather in the multiple locations, by multiple parameters, including temperature, wind speed, amount of precipitation, percent of cloudiness, a distance of visibility, etc.

There are a lot of interesting locations within a couple of hours drive from my house, and the weather can be very different from one to another. What I really want is a dashboard that shows the weather in a dozen locations on one screen, so I can compare conditions at a glance. And I don’t just want to compare locations near each other, but understand, which is good for particular type of activity: bike ride, rock climbing, drone fly, landscape photography, hiking, etc.

So, additionaly to the current weather and forecast, the dashboard maps for every type of defined activity and show detailed forecast for each activity at particular location. You can customize the activites and their parameters in the config file (see below).

The Docker container runs the following applications:

  • openweather_redis_exporter.py - app to get weather metrics from https://openweathermap.org
  • Redis database with RedisTimeSeries module - to store historical weather data and future forecasts
  • Grafana with Redis Data Source - to display the weather data

The top section of the dashboard shows the current conditions for one location, which can be the primary or favorite or just selected from the list of available places (there is a Grafana template variable selection list in the top left corner of the dashboard). The bottom section shows weather conditions for a few different locations, so you can instantly compare the weather in various places.
Grafana allows me to highlight low/high zones for temperature, dangerous zones for wind speed, display the degree of cloudiness, and mark periods of daytime and nighttime.

Configuration

openweather_redis_exporter.py script comes together with the configuration file openweather_redis_exporter.json, which has a number of mandatory and optional parameters:

{
	"units":"imperial"|"metric", #units format retrieving data from openweathermap.org. The default is "imperial", if you change it to "metric", you also need to update the units in Grafana dashboard
	"open_weather_api":"<api_key>", #provide your API key, which you will receive after the registration at openweathermap.org
	"redis_host":"host.docker.internal", #default Redis host
	"redis_port":6379, #default Redis port
	"pull_freq":1800, #default frequesncy of pulling data from openweathermap.org
	"places": #the list of locations to get the wether for
	[
		{
		    "name":"NewYork", #Location name. Please note, current version doesn't support spaces in the names
		    "lat":40.71274, #lattitude
		    "lon":-74.005974, #longtitude
		    "activity":[ "Bike" ] #list of activities to monitor for this location
		},
		...
	],
	"activity:Hiking": #definition of activity "Hiking". You can include any number of the metrics with minimum and maximum values accepted for this activity 
    [
        {
            "name":"temp",
            "min":20,
            "max":90
        },
        {
            "name":"rain",
            "min":0,
            "max":1
        },
		...
    ],
	"activity:<activity_name>":
    [
		...
    ],
	...
}

There's nothing to configure in Redis.

Grafana comes with necessary default settings, including the Grafana Weather dashboard (you can modify this dashboard yourself later). The only thing you need to change in Grafana: Dashboard timezone setting should be UTC. This will ensure the data from locations in different time zone are displayed correctly: in a location local time.

Run using docker-compose

The project provides docker-compose.yml to start Redis with RedisTimeSeries module, Grafana 7.0 and OpenWeather data exporter.

docker-compose up

Feedback

We love to hear from users, developers and the whole community interested by this plugin. These are various ways to get in touch with us:

  • Ask a question, request a new feature and file a bug with GitHub issues.
  • Star the repository to show your support.

Contributing

  • Fork the repository.
  • Find an issue to work on and submit a pull request
  • Could not find an issue? Look for documentation, bugs, typos, and missing features.

Other interesting resources

License

  • Apache License Version 2.0, see LICENSE