Skip to content

gjonesme/MMM-WeatherAlerts

Repository files navigation

MMM-WeatherAlerts

This is a module for MagicMirror².

Displays active weather alerts as provided by the openweathermap onecall API. Module will not be visible when no alerts are active.

OpenWeatherMap currently advertises version 3.0 of their onecall API which requires a subscription, but this module is compatible with older, non-subscription versions of the onecall API (e.g. version 2.5).

Example

Example image 1

Example image 2

Installation

To install this module via CLI, navigate into ~/MagicMirror/modules and type the following commands:

git clone https://github.com/gjonesme/MMM-WeatherAlerts
cd MMM-WeatherAlerts && npm install

Update

cd ~/MagicMirror/modules/MMM-WeatherAlerts
git pull
npm install

Usage

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

modules: [
  {
    module: "MMM-WeatherAlerts",
    position: "top_right",
    header: "Weather Alerts",
    config: {
      // See 'Configuration options' for more information.
      lat: "yourLatitude",
      lon: "yourLongitude",
      apiKey: "yourOpenWeatherMapApiKey"
    },
  },
];

Configuration Options

The following properties can be configured:

Option Description
weatherAlertProvider Which weather alert provider to be used.

Possible values: 'openweathermapalerts'
Default value: 'openweathermapalerts'

Note: Setup to have the same flexibility as the core weather module, currently only OpenWeatherMap is implemented.
weatherEndpoint The OpenWeatherMap API endPoint.

Possible values: '/onecall'
Default value: '/onecall'

Note: Must be set to '/onecall' in order to access alert info.
type Which type of weather data should be displayed.

Possible values: 'alerts'
Default value: 'alerts'
lat Latitude of the location used for weather information.

Example: "38.9332"
Default value: 0

Note: Latitude and longitude are REQUIRED since weatherEndpoint is set to '/onecall'.
lon Longitude of the location used for weather information.

Example: "-119.9844"
Default value: 0

Note: Latitude and longitude are REQUIRED since weatherEndpoint is set to '/onecall'.
apiKey The OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account.


This value is REQUIRED
updateInterval How often does the content need to be fetched? (milliseconds)

Possible values: 1000 - 86400000
Default value: 600000 (10 minutes)
animationSpeed Speed of update animation. (milliseconds)

Possible values: 0 - 5000
Default value: 1000 (1 second)
timeFormat Use 12 or 24 hour format.

Possible values: 12 or 24
Default value: uses value of config.timeFormat
showPeriod Show the period (am/pm) with 12 hour format.

Possible values: true or false
Default value: true
showPeriodUpper Show the period (am/pm) with 12 hour format as uppercase.

Possible values: true or false
Default value: false
lang The language of the days if using moment.js formatting that displays day name.

Possible values: en, es, etc...
Default value: uses value of config.language
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
appendLocationNameToHeader If set to true, the returned location name will be appended to the header of the module, if the header is enabled. This is mainly interesting when using calender based weather.

Possible values: true or false
Default value: false
calendarClass The class for the calender module to base the event based weather information on.

Default value: calendar
tableClass The class for the weather alerts table.

Possible values: xsmall, small, medium, large, xlarge
Default value: small
colored If set to true, the alert "event" will be color coded.

Possible values: true or false
Default value: false
Note: color coded events are currently only implemented for NOAA NWS alerts.
maxNumberOfAlerts Sets a maximum number of alerts that can be displayed.
Possible values: 0 - 10
Default value: 0
Note: 0 means unlimited alerts may be shown.
showEndTime If set to true, the scheduled alert end time will be displayed.

Possible values: true or false
Default value: true
alertTimeFormat If set to relative, displays the alert's scheduled end-time using moment.js .fromNow() function.

Possible values: relative or absolute
Default value: relative
alertDateFormat Defines how alert scheduled end-time will be displayed when timeFormat is set to absolute.

Possible values: See moment.js format documentation.
Default value: "M/DD"
showAlertDescription If set to false, alert description will be hidden

Possible values: true or false
Default value: true
staticAlertDescription If set to true alert description will be shown as block of text; if set to false alert description will be a single line ticker/marquee;

Possible values: true or false
Default value: false
alertDescriptionScrollDelay Sets text scroll delay (in milliseconds) of alert decription ticker/marquee when staticAlertDescription is set to false.

Possible values: Minimum of 60
Default value: 85
Note: The lower the value, the faster the alert description text will move.

Other Notes and Considerations

This module is set to only display when a weather alert is active/available from the OpenWeatherMap onecall API. If no alerts are active, then the module will not be visible. If your location does not currently have an active weather alert, then you can test the module by changing your lat/lon to a location with an active alert. The U.S. pretty much always has some active alerts

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published