A custom Lovelace card that displays active US National Weather Service alerts with real-time updates, severity-based color coding, and expandable descriptions.
Important: Do not rely on this card for critical weather information. Always consult the National Weather Service or other competent weather providers for important safety decisions.
- Real-time NWS weather alerts for your specified zone
- Dynamic location support for mobile devices with automatic zone resolution
- Action triggers to fire activities from within the card
- Alert entity integration for automations and other HA activities outside of the card
- Separate desktop and mobile location configurations
- Severity-based color coding (Extreme, Severe, Moderate, Minor, Unknown)
- Expandable alert descriptions with "Show more/less" toggle
- 24-hour coordinate-to-zone caching to minimize API calls
To configure the card, you need your latitude and longitude or a NWS zone ID. There are two ways to find your zone ID:
- Visit NWS Public Zones
- Select your state
- Find your county/area
- Note the zone code (format:
SSZNNNorSSCNNN)
- Get your lat/long coordinates
- Visit:
https://api.weather.gov/points/LAT,LONG(replace LAT,LONG with your coordinates) - Find the
forecastZonefield in the JSON response - The zone ID is the last part of the URL (e.g.,
COZ097)
Zone Format:
SS= 2-letter state abbreviation (e.g.,AK,NY)ZorC= Zone or CountyNNN= 3-digit number (e.g.,001,329)
Examples:
- Fairbanks, Alaska:
AKZ844 - Las Vegas, Nevada:
NVZ020 - Denver, Colorado:
COZ097
Add the card to your Lovelace dashboard:
type: custom:nws-alert-card
nws_zone: AKZ844 # Your NWS zone (REQUIRED if not using lat/lon)
email: your-email@example.com # REQUIRED for NWS API compliance| Option | Type | Required | Default | Description |
|---|---|---|---|---|
email |
string | Yes | - | Your email for NWS API User-Agent header |
latitude |
number or string | Conditional | - | Latitude coordinate (number) or entity ID (string). Required with longitude if nws_zone not specified. |
longitude |
number or string | Conditional | - | Longitude coordinate (number) or entity ID (string). Required with latitude if nws_zone not specified. |
nws_zone |
string | Conditional | - | Your NWS zone ID (e.g., WAZ558). Required if lat/lon not specified. |
alert_entity |
string | No | - | Entity ID of input_text helper for alert data (e.g., input_text.nws_alert_types) |
alert_title_font_size |
number | No | 16 |
Alert event name font size in pixels (8-48) |
alert_trigger_cooldown |
number | No | 60 |
Minutes to wait before re-triggering same severity action |
description_color |
string | No | primary text |
CSS color for alert description text (e.g., #333, gray) |
description_font_size |
number | No | 14 |
Alert description font size in pixels (8-48) |
extreme_action |
string | No | - | Entity ID of script/automation for Extreme severity |
meta_color |
string | No | secondary text |
CSS color for severity/urgency/certainty text |
meta_font_size |
number | No | 14 |
Alert metadata (time range, severity/urgency) font size in pixels (8-48) |
minor_action |
string | No | - | Entity ID of script/automation for Minor severity |
mobile_latitude |
number or string | No | - | Mobile override for latitude. Must be used with mobile_longitude. |
mobile_longitude |
number or string | No | - | Mobile override for longitude. Must be used with mobile_latitude. |
moderate_action |
string | No | - | Entity ID of script/automation for Moderate severity |
severe_action |
string | No | - | Entity ID of script/automation for Severe severity |
show_expanded |
boolean | No | false |
Show alert descriptions expanded by default |
show_severity_markers |
boolean | No | true |
Show markers for severe alerts |
times_color |
string | No | secondary text |
CSS color for alert time range text |
title_color |
string | No | inherit |
CSS color for the card title |
title_font_size |
number | No | 20 |
Card title font size in pixels (8-48) |
title |
string | No | NWS Weather Alert |
Card title |
update_interval |
number | No | 300 |
Seconds between alert checks |
zone_color |
string | No | secondary text |
CSS color for the zone subtitle |
⛔️ WARNING: DO NOT RELY ON THIS CARD FOR CRITICAL ALERTS ⛔️
Always consult the US National Weather Service for official, up to date weather information. The NOAA Weather Radio page is a good source of information. NOAA also has information on weather radios.
Configure scripts or automations to run when alerts appear or severity increases.
Trigger Behavior:
- Actions trigger when NEW alerts appear OR when severity INCREASES
- Only the HIGHEST severity action triggers (not all severities)
- No action when alerts are removed or severity decreases
- Entity IDs must be
script.*orautomation.*format - Cooldown Protection: After triggering, each severity has a cooldown period (default 60 minutes)
- Prevents actions from firing on every page reload
- Cooldown tracked per severity level in browser localStorage
- Set
alert_trigger_cooldown: 0to disable cooldown
Example:
type: custom:nws-alert-card
nws_zone: AKZ844
email: user@example.com
moderate_action: script.turn_light_yellow
severe_action: automation.close_curtains
extreme_action: script.play_alarm_sounds
alert_trigger_cooldown: 60 # Minutes between triggers (default: 60)In this example:
- If a Moderate alert appears:
script.turn_light_yellowruns - If alert upgrades to Severe:
automation.close_curtainsruns - If alert upgrades to Extreme:
script.play_alarm_soundsruns - Only the highest severity action triggers each time
- Each action won't trigger again for 60 minutes (even if you reload the page)
Store active alert data in a Home Assistant entity for use in automations and conditional cards. Alerts are sorted by official NWS priority order (Tsunami Warning highest, Blue Alert lowest).
ℹ️ See Alerts.md for setup instructions and examples.
The card supports automatic geolocation for mobile devices, allowing different zones for desktop and mobile:
type: custom:nws-alert-card
latitude: 46.6062 # Home location (desktop)
longitude: -122.3321
mobile_latitude: device_tracker.my_phone # Track phone location on mobile
mobile_longitude: device_tracker.my_phone
email: your-email@example.comUse static zone on desktop, track device on mobile:
type: custom:nws-alert-card
nws_zone: COZ097 # Desktop fallback
mobile_latitude: device_tracker.my_phone # Mobile overrides
mobile_longitude: device_tracker.my_phone
email: your-email@example.com- Coordinates are automatically converted to NWS zones using the NWS Points API
- Mobile detection uses Home Assistant Companion app detection, mobile user agents, and screen width
- Zone lookups are cached for 24 hours to minimize API calls
- Entity locations update dynamically (5-second debounce to prevent excessive API calls)
On mobile devices:
- Uses
mobile_latitude/mobile_longitudeif configured - Falls back to
latitude/longitudeif mobile coords not set - Falls back to
nws_zoneif coordinates fail to resolve
On desktop:
- Uses
latitude/longitudeif configured - Falls back to
nws_zoneif lat/lon not set or fail to resolve
When multiple location options are configured:
- Mobile lat/lon - Used on mobile if
mobile_latitudeandmobile_longitudeare set - Base lat/lon - Used if
latitudeandlongitudeare set - Static zone - Used if lat/lon not set or fail to resolve (
nws_zone)
This allows nws_zone to act as a fallback without overriding coordinate-based configuration.
Alerts are color-coded by severity on the left border:
- Extreme (Red): Life-threatening situations
- Severe (Orange): Significant threat to life/property
- Moderate (Yellow): Possible threat to life/property
- Minor (Green): Minimal threat to life/property
- Unknown (Gray): Severity not specified
This card uses the National Weather Service API:
- Endpoint:
https://api.weather.gov/alerts/active/zone/{zone} - Format: GeoJSON
- Rate limiting: Implemented with exponential backoff
- Timeout: 10 seconds per request
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - see LICENSE file for details
Created by sxdjt
Uses data from the National Weather Service API