Skip to content

MagicMirror² Module to display weather information from Environment Canada

License

Notifications You must be signed in to change notification settings

CharlesMorris78/MMM-EnvCanada

Repository files navigation

MMM-EnvCanada

MagicMirror² Module to display weather forecast information from Environment Canada.

Version 1.1, August 2023 Copyright © Charles Morris

Platform License

Example Screenshot

Purpose

MMM-EnvCanada is a MagicMirror² Module to display Environment Canada weather forecast information. The default Weather Module has an envcanada provider to display Environment Canada data in the MagicMirror² Weather Module. However, Environment Canada provides more information than the default module can display. This module displays the text forecast, the marine wind forecast, the Air Quality Health Index, and a graphical display of the forecast for day and night. This module does not display current conditions, as the default weather module provides that function very well. Some code from the envcanada provider has been incorporated or modified and incorporated into this module.

Installation

  1. Navigate to the modules folder
    cd ~/MagicMirror/modules
  2. Clone the repository
    git clone https://github.com/CharlesMorris78/MMM-EnvCanada.git
  3. Add the module to your MagicMirror² by copying the sample configuration below and add that to your config.js

Update

  1. Navigate to the MMM-EnvCanada folder
    cd ~/MagicMirror/modules/MMM-EnvCanada
  2. Update from the repository
    git pull

Sample Config

Here's an example of a basic config for the module. See full list of available settings below under Configuration

		{
			module: 'MMM-EnvCanada',
			position: 'top_right',
			header: "Environment Canada Forecast for Picton",
			config: {
				siteCode: "s0000702",
				provCode: "ON", 
				updateInterval: 10 * 60 * 1000,
				language: "e",
				textForecasts: 2,
				showAlerts: true,
				showForecastDays: 5,
				marineRegion: "great_lakes",
				marineSubRegion: "m0000144",
				marineLocation: "Eastern Lake Ontario"
			}
		},

Configuration

Setting Description
airQualityProv Administrative zone code for Air Quality Health Index. If paramter is not provided, the index is not displayed.

airQualityRegion Region code for Air Quality Health Index. If paramter is not provided, the index is not displayed.

header Text for the module header. If paramter is not provided, the Environment Canada location text for the configured siteCode is used.

  • Type: string
  • Default: Environment Canada location text for the configured siteCode
  • Possible values: Any text string.
language The display language provided by Environment Canada: English (e) or French (f).

  • Type: string
  • Default: "e"
  • Possible values: "e" or "f"
marineEndMonth Final month to display the Marine Forecast.

  • Type: number
  • Default: 10
  • Possible values: 1 through 12
marineLocation Location for Marine Forecast. If language is f (French), must be the French language version of the location.

marineRegion The region for Marine Forecast. If set to empty string (the default) no Marine Forecast is displayed. Other paramters must be correct or no Marine Forecast will be displayed.

  • Type: string
  • Default: ""
  • Possible values: "arctic", "atlantic", "great_lakes", "hudson", "mackenzie", "pacific", "prairies", "st_lawrence"
marineStartMonth First month to display the Marine Forecast.

  • Type: number
  • Default: 5
  • Possible values: 1 through 12
marineSubRegion The subregion code for Marine Forecast.

  • Type: string
  • Default: ""
  • Possible values: see the Environment Canada document listing all the sub region codes
provCode The 2-character province code for the selected city/town.

showAlerts Boolean to decide if weather warnings should be included in the forecast text.

  • Type: boolean
  • Default: true
  • Possible values: true or false
showforecastDays The number of days to display the forecast in graphical format. If less than 3, no graphical forecast is displayed.

  • Type: number
  • Default: 5
  • Possible values: 0 to 6
siteCode The city/town unique identifier for which weather is to be displayed. Format is 's0000000'.

textForecasts The number of text forecasts to display. Environment Canada provides two forecasts for each day: today and tonight. If set to 0, no text forecast is disdplayed.

  • Type: number
  • Default: 2
  • Possible values: 0 to 6
updateInterval The duration of time between each attempt to refresh the forecast information, in miliseconds.

  • Type: number
  • Default: 10 * 60 * 1000 which is 10 minutes

Support

This is my first MagicMirror module. There probably are better ways to do some of the things I have implemented, but this represents what I have learned so far, with thanks to the authors of the envcanada provider code for the default weather module. I will respond to questions and suggestions as promptly as possible.