Skip to content

Magic Mirror module to display weather information using the Dark Sky API

Notifications You must be signed in to change notification settings

rudibarani/MMM-DarkSkyForecast

 
 

Repository files navigation

MMM-DarkSkyForecast

This a module for MagicMirror
https://magicmirror.builders/
https://github.com/MichMich/MagicMirror

Screenshot

A weather module that displays current, hourly and daily forecast information using data from the Dark Sky API. This is a replacement module for MMM-MyWeather, now that Weather Underground no longer allows free API access. This a complete rewrite from scratch but maintains much of the same functionality.

Installation

  1. Navigate into your MagicMirror modules folder and execute
    git clone https://github.com/jclarke0000/MMM-DarkSkyForecast.git.
  2. Enter the new MMM-DarkSkyForecast directory and execute npm install.

Configuration

At a minimum you need to supply the following required configuration parameters:

  • apikey
  • latitude
  • longitude

You can request an API key to access Dark Sky data here: https://darksky.net/dev.

Free tier is fine -- this module will not make any where near 1000 request on one day.

Find out your latitude and longitude here: https://www.latlong.net/.

Other optional parameters

Option Description
updateInterval How frequently, in minutes, to poll for data. Be careful not to set this too frequent so that you don't exceed Dark Sky's 1000 free requests per day cap.

Type Number
Defaults to 10
requestDelay In milliseconds, how long to delay the request. If you have multiple instances of the module running, set one of them to a delay of a second or two to keep the API calls from being too close together.

Type Number
Defaults to 250
updateFadeSpeed How quickly in milliseconds to fade the module out and in upon data refresh. Set this to 0 for no fade.

Type Number
Defaults to 500 (i.e.: 1/2 second).
language The language to be used for display.

Type String
Defaults to the language set for Magic Mirror, but can be overridden with any of the language codes listed here: https://darksky.net/dev/docs#request-parameters.
colored Whether to present module in colour or black-and-white. Note, if set to false, the monochramtic version of your chosen icon set will be forced.

Type Boolean
Defaults to true
units One of the following: si, ca, uk2, or us.

Type String
Defaults to ca
See https://darksky.net/dev/docs#request-parameters for details on units.
showCurrentConditions Whether to show current temperaure and current conditions icon.

Type Boolean
Defaults to true
showExtraCurrentConditions Whether to show additional current conditions such as high/low temperatures, precipitation and wind speed.

Type Boolean
Defaults to true
showSummary Whether to show the forecast summary.

Type Boolean
Defaults to true
forecastTableHeaderText Show a header above the forecast table. Can be used instead of the regular header.

Type String
Defaults to ''
showForecastTableColumnHeaderIcons Whether to show icons for the columns of the forecast table.

Type Boolean
Defaults to true
showHourlyForecast Whether to show hourly forecast information. when set to true it works with the hourlyForecastInterval and maxHourliesToShow parameters.

Type Boolean
Defaults to true
hourlyForecastInterval How many hours apart each listed hourly forecast is.

Type Number
Defaults to 3
maxHourliesToShow How many hourly forecasts to list.

Type Number
Defaults to 3
showDailyForecast Whether to show daily forecast information. when set to true it works with the maxDailiesToShow parameter.

Type Boolean
Defaults to true
maxDailiesToShow How many daily forecasts to list.

Type Number
Defaults to 3
showPrecipitation Whether to show precipitation information. This affects current conditions, hourly and daily forecasts

Type Boolean
Defaults to true
showWind Whether to show wind information. This affects current conditions, hourly and daily forecasts

Type Boolean
Defaults to true
concise When set to true, this presents less information. (e.g.: shorter summary, no precipitation accumulation, no wind gusts, etc.)

Type Boolean
Defaults to true
iconset Which icon set to use. See below for previews of the icon sets.

Type String
Defaults to 1c
useAnimatedIcons Whether to use the Dark Sky's own animated icon set. When set to true, this will override your choice for iconset. However, flat icons will still be used in some instances. For example if you set the animateMainIconOnly parameter to true, daily and hourly forecasts will not be animated and instead will use your choice for iconset. Inline icons (i.e. used to prefix precipitation and wind information) will always be flat. A good iconset match for the animated set is 1c.

Type Boolean
Defaults to true
animateMainIconOnly When set to true, only the main current conditions icon is animated. The rest use your choice for iconset (1c is a good match for the animated icon). If you are running on a low-powered device like a Raspberry Pi, performance may suffer if you set this to false. In my testing on a Pi 3b, enabling this ramped up CPU temperature by 15° - 20°, and fade transitions were not smooth.

Type Boolean
Defaults to true
showInlineIcons Whether to prefix wind and precipitation information with an icon. Only affects the tiled layout.

Type Boolean
Defaults to true
forecastLayout Can be set to tiled or table. How to display hourly and forecast information. See below for screenshot examples of each.

Type String
Defaults to tiled
label_maximum The label you wish to display for prefixing wind gusts.

Type String
Defaults to "max".
label_high The label you wish to display for prefixing high temperature.

Type String
Defaults to "H".
label_low The label you wish to display for prefixing low temperature.

Type String
Defaults to "L".
label_timeFormat How you want the time formatted for hourly forecast display. Accepts any valid moment.js format (https://momentjs.com/docs/#/displaying/format/).
The short 24h format kann be displayed by "k[h]" (e.g.: 14h)

Type String
Defaults to "h a" (e.g.: 9 am)
label_days How you would like the days of the week displayed for daily forecasts. Assumes index 0 is Sunday.

Type Array of Strings
Defaults to ["Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"]
label_ordinals How you would like wind direction to be displayed. Assumes index 0 is North and proceeds clockwise.

Type Array of Strings
Defaults to ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]

Sample Configuration

{
  module: "MMM-DarkSkyForecast",
  header: "Weather",
  position: "top_right",
  classes: "default everyone",
  disabled: false,
  config: {
    apikey: "SUPER SECRET!!!",
    latitude: "51.506130",
    longitude: "-0.090270",      
    iconset: "4c",
    concise: false,
    forecastLayout: "table"
  }
},

Icon Sets

Icon Sets

Layouts

Layouts

About

Magic Mirror module to display weather information using the Dark Sky API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.5%
  • CSS 11.0%
  • HTML 3.5%