FlatPepsi17 / MMM-WeatherGraph

Magic Mirror module for detailed weather forecasts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MMM-WeatherGraph

This an extension for MagicMirror that displays current and forecasted weather.

This module started as a fork of 'MMM-forecast.io' by dmcinnes (https://github.com/dmcinnes/MMM-forecast-io), adding many new features and moving to a new data source since DarkSky discontinued API access. (Thanks Apple- so nice of you.)

Features:

-Current weather, including temp and wind

-Sunrise / sunset time

-7 day forecase with visual for temp ranges

-2 day precipation graph, with temp, wind, humidity, and cloudcover

-Lots of options to turn on/off any parts you want

-Impetial/metric and 12/24 hour time options

Installation:

-Get an API key from OpenWeatherMap.org. https://openweathermap.org/darksky-openweather

-Open a terminal window on your device

-Navigate to your MagicMirror's modules folder. If you are using the default installation directory, use the command:

cd ~/MagicMirror/modules

-Copy the module to your computer by executing the following command:

git clone https://github.com/FlatPepsi17/MMM-WeatherGraph

-If you're using a MagicMirror, you need to lookup your GPS coordinates. One way is to find your location is to open maps.google.com, and right-click on your location. Use these coordinates in the config file to ensure you get weather for your location.

-This module uses white icons by default. If you prefer color coded icons, merge the contents of the "Color-icons.md" file into your "css\custom.css" file.

Example screen shots: Rain is the filled blue graph, snow is the filled white graph

screenshot4

Turn off features to make a simple display.

screenshot1

Want to see everything? Here's temp, wind, humidity, and cloud cover. Legend in the bottom right corner.

screenshot2

Metric is supported, and the precipation graph can be adjusted. THis one shows 24 hours.

screenshot3

Daily precipition totals in the week's list is now an option. Rain or snow totals for that day are shown. Can be turned on or off.

screenshot5

Using the module

To use this module, add it to the modules array in the config/config.js file. Minimal setup:

modules: [
  {
    module: 'MMM-WeatherGraph',
    position: 'top_right',  // This can be any of the regions.
    config: {
      // get your API key at:  https://openweathermap.org/home/sign_up
      apiKey: 'abcde12345abcde12345abcde12345ab',

      latitude:   37.2431,   // replace with your GPS location 
      longitude: -115.7930
    }
  }
]

If you want to customize the module, here's one with more options for easier use. Add it to this in the config/config.js file and change settings to your liking:

modules: [
  {
    module: 'MMM-WeatherGraph',
    position: 'top_right',  // This can be any of the regions.
    config: {
      // get your API key at:  https://openweathermap.org/home/sign_up
      apiKey: 'abcde12345abcde12345abcde12345ab',

      showForecast: true,            // 7 day forecast list
      showForecastPrecip: true,      // show precip totals in 7 day list
      showGraph: true,               // enable all graphing of weather 
      precipitationGraphWidth: 400,  // width in pixels. Default=400
      precipitationGraphHeight: 150, // height in pixels. 0=auto-scales
      graphHourRange: 48,            // how many hours in the graph? Max 48
      showWind: true,                // current wind speed at top
      showGraphPrecip: true,         // on graph, show rain and snowfall
      showGraphTemp: true,           // on graph, show temp
      graphTempColor: 'white',       // on graph, color of temp line
      showGraphWind: true,           // on graph, show wind
      graphWindColor: 'grey',        // on graph, color of temp line
      showGraphHumid: true,          // on graph, show humidity
      humidWindColor: '#88CC88',     // on graph, color of humid line
      showGraphCloud: true,          // on graph, show cloud cover %
      graphCloudColor: '#dedb49',    // on graph, color of cloud line
      showSunrise: true,             // next sunrise or sunset at top
      showSummary: true,             // text of next hour's conditions
      showHotColdLines: true,        // blue line at freezing, red line at 80 F
      showGraphLegend: true,         // legend on bottom right of graph

      language: 'en', 
      units: 'imperial',             // or 'metric'
      time24hr: false,               // false for 12hr times, true for 24hr times

      updateInterval: 900000,        // 15 minutes ( 15 * 60 * 1000 )
      animationSpeed: 2000,          // 2 seconds (2*1000)
      initialLoadDelay: 0,           // 0 seconds (0*1000)
      retryDelay: 2500,              // 2.5 seconds (2*1000)

      latitude:   37.2431,           // replace with your GPS location 
      longitude: -115.7930
    }
  }
]

Configuration options

Option Description
apiKey The OpenWeatherMap API key, which can be obtained by creating an API account.

This value is REQUIRED
units What units to use. Specified by config.js

Possible values: metric = Celsius, imperial =Fahrenheit
Default value: imperial
language The language of the weather text.

Possible values: en, nl, ru, etc ...
Default value: uses value of config.language
updateInterval How often does the content needs to be fetched? (Milliseconds)

The API enforces a 1,000/day request limit, so if you run your mirror constantly, anything below 90,000 (every 1.5 minutes) may require payment information or be blocked.

Possible values: 1000 - 86400000
Default value: 300000 (5 minutes)
animationSpeed Speed of the update animation. (Milliseconds)

Possible values:0 - 5000
Default value: 2000 (2 seconds)
initialLoadDelay The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)

Possible values: 1000 - 5000
Default value: 0
retryDelay The delay before retrying after a request failure. (Milliseconds)

Possible values: 1000 - 60000
Default value: 2500
latitude The latitude location in decimal. Set this (and longitude) as the location for the forecast. If this is not set, the module will attempt to approximate using browser geolocation.

Example value: 16.77532
Default value: null
longitude The longitude location in decimal. Set this (and latitude) as the location for the forecast. If this is not set, the module will attempt to approximate using browser geolocation.

Example value: -3.008265
Default value: null
showForcast Toggles display of the seven-day weather forecast list.

Default value: true
showPrecipitationGraph Toggles display of the precipitation graph.

Default value: true
precipitationGraphWidth Width of the precipitation graph element in pixels. Scales height to 30 percent of width automatically.

Default value: 400
showWind Toggles display of current wind speed next.

Default value: true
showSunrise Toggles display of next sunrise or sunset time.

Default value: true
showSummary Toggles display of next hour's weather summary text.

Default value: true

About

Magic Mirror module for detailed weather forecasts


Languages

Language:JavaScript 95.5%Language:CSS 4.5%