Magic Mirror module to display current local weather warning and alerts
I built this module more by need than anything else -- the Seattle area where I live had been hit by some relatively severe weather, that have caused real problems for the area. While I wasn't caught off-guard this by this storm, I realized that the MM weather modules I had didn't emphasize local warnings, alerts, and weather watches. So I built a module expressly for solving that problem.
MMM-NOAAAlerts
Special Weather Statement:
Standard installation:
git clone https://github.com/mmtsweng/MMM-NOAAAlerts
cd MMM-NOAAAlerts
npm install
Basic configuration:
{
module: "MMM-NOAAAlerts",
position: "top_bar",
config: {
userAgent: "Magic Mirror (xxxxxxxxxxxx@gmail.com)" //Custom contact information
APIURL: "https://api.weather.gov/alerts/active?point=47.593,-122.333", //See below for other options
debug: false, // [Optional] Print extended debugging logs to the console
rotateInterval: 20*1000,
updateInterval: 30*60*1000, // [Optional] How often to ping the API for more data
}
},
NOAA provides a free API to retrieve weather alerts, which this API uses. There is no registration required. There are multiple ways to set the forecast area, and NOAA provides through documentation if you need extensive help. But the basics are:
Option | URL |
---|---|
By State | https://api.weather.gov/alerts/active?area={state} |
By Zone | https://api.weather.gov/alerts/active?zone={zone} |
By Lat/Long | https://api.weather.gov/points/{latitude},{longitude} |
By Grid | https://api.weather.gov/gridpoints/{office}/{grid X},{grid Y}/forecast |
NOAA requires that a User-Agent header be provided. Please set your own custom agent in the config with unique contact information (the suggested header is: User-Agent: (myweatherapp.com, contact@myweatherapp.com)
, so following that format makes sense.
Option | Default | Description |
---|---|---|
updateInterval | 30 minutes | [Optional] How often to request data from the API. Note: Marquee animation is defaulted to 30 seconds |
rotateInterval | 15 seconds | [Optional] How often to rotate to the next alarm/statement |
APIURL | https://api.weather.gov/alerts/active?point=47.593,-122.333 |
NOAA API call |
userAgent | MagicMirrorMMTSWENG | API requires a User-Agent Header. This configuration allows for unique identification of the use |
rotateInterval | 15 seconds | [Optional] How often to switch to the next alert/alarm |
showDescription | true | [Optional] Show the detailed description. |
showInstruction | false | [Optional] Show instructions provided by NOAA |
showNoAlertText | false | [Optional] Show noAlertText if there are no active events |
showAsMarquee | false | [Optional] If true, the descriptions and instructions will scroll from left-to-right |
noAlertText | 'There are no active weather alerts in this area' | [Optional] Text to display if showNoAlertText is true |
debug |
false |
[Optional] Render extensive debug information to the console to validate functionality |