Skip to content

FlatPepsi17/MMM-forecast-io

 
 

Repository files navigation

MMM-Forecast-IO

NOTE: this module is no longer being updated. I have replaced it with a much better module: https://github.com/FlatPepsi17/MMM-WeatherGraph

This an extension for MagicMirror that adds localized weather using OpenWeatherMap.org - formerly Dark Sky API (and originally Forecast.io).

To use the module, you'll need a new API key from OpenWeatherMap.org. Creating one, and migration info from DarkSky can be found at: https://openweathermap.org/darksky-openweather

This module makes use of the geolocation API to determine the location of the mirror. This can be turned off by setting latitude and longitude in the module's config (see Configuration options below).

Unfortunately, Geolocation will currently not work with MagicMirror's Electron-based browser wrapper because of a known issue: electron/electron#6648 If you are using MagicMirror headless with your own browser this shouldn't be a problem.

Graph supports both Fahrenheit and Celsius, easily selectable in the config options.

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.

screenshot

Using the module

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

modules: [
  {
    module: 'MMM-forecast-io',
    position: 'top_right',  // This can be any of the regions.
    config: {
      // See 'Configuration options' for more information.

      // get API key at:  https://openweathermap.org/home/sign_up
      apiKey: 'abcde12345abcde12345abcde12345ab',

      updateInterval: 900000,  // 15 minutes ( 15 * 60 * 1000 )
      showWind: true,
      showSunrise: true, 
      showSummary: true,
      showPrecipitationGraph: true,
      precipitationGraphWidth: 400,
      showForecast: true,

      language: 'en',
      units: 'imperial',   // or 'metric'

      latitude:   37.2431,
      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

Forecast.io Module for MagicMirror

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.9%
  • CSS 6.1%