/MMM-MyWeather

Upgraded weather forecast module using WeatherUnderground

Primary LanguageJavaScript

Module: Weather Forecast

This is a module for MagicMirror, forked from RedNax67's MMM-WunderGround https://github.com/RedNax67/MMM-WunderGround.git (MMM-WunderGround is a modified version of the default weatherforecast module.)

This is nearly identical to the MMM-WunderGround module with a couple of tweaks and style changes.

Five additonal configurations are added:

  • currentweather: 1 or 0
  • currentweatherdetails: 1 or 0
  • forecasttable: 1 or 0
  • forecasttablecolumnheadericons: 1 or 0
  • forecasttableheadertext: Whatever title you would like above the forecast table.

The Weather Icons used in this module are created and maintained by Erik Flowers. v1.0 artwork by Lukas Bischoff. v1.1 - 2.0 artwork by Erik Flowers www.weathericons.io

Due to end of Life for free Weather Underground API, the module is now tweaked to use the free weatherbit.io API's by github user martinkooij. The changed config variables are marked with a "*".

Installing the module

Clone this repository in your ~/MagicMirror/modules/ folder ( $ cd ~MagicMirror/modules/ ):

git clone https://github.com/martinkooij/MMM-MyWeather.git

then goto to the module directory and execute in the module directory

npm install

to install the dependencies

Using the module

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

modules: [
  {
    module: 'MMM-MyWeather',
    position: 'top_right',
    config: {
      apikey: 'xxxxxxxxxxxxx', // private; don't share!
      lat: "51.95", // Culemborg, NL ;)
      lon: "5.23" , // use the quotes! 
      hourly: '1',
      fctext: '1',
      fcdaycount: "5",
      fcdaystart: "0",
      hourlyinterval: "3",
      hourlycount: "2",
      alerttime: 10000,
      alerttruncatestring: "english:",
      roundTmpDecs: 1,
      UseCardinals: 0,
      layout: "horizontal"
    }
  },
]

Configuration options

The following properties can be configured:

Option Description
lat * latitude. Format String (N.B. dont enter a number, use a string instead)

This value is REQUIRED
lon * longitude. Format String (N.B. dont enter a number, use a string instead)

This value is REQUIRED
apikey * The Weatherbit API key, which can be obtained by creating an weatherbits account.
units * What units to use. Specified by config.js

Possible values: config.units = Specified by config.js, metric = Celsius [default], imperial =Fahrenheit
Default value: config.units
coloricon show Current Weather Icon in color

Possible values: true, false
Default value: false
fcdaycount How many days of forecast to return. Specified by config.js

Possible values: 1 - 10
Default value: 7 (7 days)
This value is optional. By default the wunderground module will return 7 days.
fcdaystart On which day to start the forecast. Specified by config.js

Possible values: 1 - 10
Default value: 0 (Today)
This value is optional. By default the forecast will start today.
fctext Display human readable forecast text. Specified by config.js

Possible values: 0 - 1
Default value: 1 (Will display text)
This value is optional. By default the forecast text will be displayed.
scaletxt Scale forecast text when over 3 lines. Specified by config.js

Possible values: 0 - 1
Default value: 1 (Will scale text)
This value is optional. By default the forecast text will be scaled when needed.
daily Display daily forecasts. Specified by config.js

Possible values: 0 - 1
Default value: 1 (Will display daily forecasts)
This value is optional. By default the daily forecast will be displayed.
hourly Display hourly forecasts. Specified by config.js

Possible values: 0 - 1
Default value: 1 (Will display hourly forecasts)
This value is optional. By default the hourly forecast will be displayed.
hourlycount How many hourly forecasts. Specified by config.js

Possible values: 0 - 24
Default value: 2
This value is optional. By default 2 hourly forecasts will be displayed.
hourlyinterval * Hours between hourly forecasts. Specified by config.js

Possible values: 3
Default value: 3 (Will display hourly forecasts with 3 hour interval)
* This value cannot be set anymore. Hourly forcasts only come in 3h intervals, whatever the value of this parameter.
updateInterval How often does the content needs to be fetched? (Milliseconds)
Note that Wunderground updates every 15 minutes maximum. Also free version of API only allows 500 calls per day.
Possible values: 1000 - 86400000
Default value: 900000 (15 minutes)
animationSpeed Speed of the update animation. (Milliseconds)

Possible values:0 - 5000
Default value: 2000 (2 seconds)
lang The language of the days.

Possible values: en, nl, ru, etc ...
Default value: uses value of config.language
fade Fade the future events to black. (Gradient)

Possible values: true or false
Default value: true
fadePoint Where to start fade?

Possible values: 0 (top of the list) - 1 (bottom of list)
Default value: 0.25
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
alarmUrl the url of the metoalarm.eu RSS stream for your region(!)

Example values: https://meteoalarm.eu/documents/rss/nl/NL019.rss
Default value: null
showAlarmText show alert texts with the icons...

Possible values: 1 or 0
Default value: 0 (only Icons)
iconAlarmArray Array with the text (in your language) to be used with the alarm icons. The first item of the array is the general text.

Possible values: array of 14 strings
Default value: [ "Weather Alarm(s)", "Wind", "Snow/Ice", "Thunderstorms", "Fog", "Extreme high temperature", "Extreme low temperature", "Coastal Threat", "Forestfire", "Avalanches", "Rain", "Rain", "Flooding", "Rain & Flooding" ]
roundTmpDecs Rounds off the current temperature display

Possible values: number
Default value: 1
windunits Which units to use for windspeed

Possible values: "mph", "kph", or "bft"
Default value: "bft"
UseCardinals Toggles the use of winddirection arrow or cardinals

Possible values: 0 or 1
Default value: 0
layout Chooses the layout option

Possible values: "horizontal" or "vertical"
Default value: "vertical"
iconset Selects the style of icons to show

Possible values: "colourful", "dark", "flat_black", "flat_colourful", "flat_white", "light", "novacon", "sketchy", "VCloudsWeatherIcons", "weezle"
Default value: "VCloudsWeatherIcons"
sysstat Toggle sysinfo display

Possible values: 0 or 1
Default value: 0
debug Toggle debug logging

Possible values: 0 or 1
Default value: 0
currentweather Toggle current conditions (large temperature and icon display)

Possible values: 0 or 1
Default value: 1
currentweatherdetails Toggle detailed current conditions (wind speed, humidity, sunrise, moon phase)

Possible values: 0 or 1
Default value: 1
forecasttable Toggle forecast table

Possible values: 0 or 1
Default value: 1
forecasttablecolumnheadericons Toggle icons above forecast table (thermometer, umbrella)

Possible values: 0 or 1
Default value: 1
forecasttableheadertext Text you would like above the Forecast table

Default value: Forecast
timeFormat How to format the time for hourly forecast. Use Moment.js supported formats (https://momentjs.com/docs/#/displaying/)

Default value: "h a"