;toc
Video
EMBED
Post
Severe weather can strike at any time, and having your smart home warn you the moment an alert is issued can make all the difference. With the updated NWS Alerts integration for Home Assistant, you can get real-time notifications, trigger automations, and display alerts directly on your dashboards.
In this guide, I’ll walk you through installing the integration, creating sensors, setting up notifications, and building dashboards. All of the YAML and templates are here for you to copy and paste directly.
What is NWS Alerts?
NWS Alerts is a custom integration for Home Assistant that connects directly to the National Weather Service. It was created and is actively maintained by developer finity69x2. The integration pulls in real-time weather alerts for your area, such as tornado warnings, severe thunderstorms, and winter storm advisories.
For example, you could flash your lights red during a tornado warning, send a push notification to your phone, or have your smart speakers announce an alert. The integration automatically updates when new alerts are issued or when they expire.
Step 1: Installation & Setup
You’ll need the HACS store (Home Assistant Community Store). If you don’t have HACS installed yet, check out my HACS setup guide.
- Open HACS and search for NWS Alerts.
- Install the integration. If you don’t see it, you may need to add the GitHub repository.
- Restart Home Assistant.
- Go to Settings → Devices & Services → Add Integration.
- Search for NWS Alerts and enter your county and zone codes (look these up on the NWS site).
👉 Tip for Testing: You don’t need to wait for an alert in your area. Visit api.weather.gov/alerts/active, copy a UGC code from a current alert, then edit the NWS Alerts integration in Home Assistant to use that code. You’ll see active alerts instantly for testing.
Step 2: Create a Template Sensor via the UI
Instead of editing YAML, you can set up a helper directly in the UI:
- Go to Settings → Devices & Services → Helpers.
- Click + Create Helper.
- Choose Template → Binary Sensor.
- Name it NWS Alert Active.
- Add this template:
{{ states('sensor.nws_alerts')|int > 0 }}
- Save it. You’ll now have binary_sensor.nws_alert_active showing on when alerts are active.
Step 3: Automations & Notifications
Mobile App Notifications
This automation sends a push notification whenever a new alert is issued.
alias: NWS - Mobile App Notifications
trigger:
- platform: state
entity_id: sensor.nws_alerts_alerts
condition:
- condition: numeric_state
entity_id: sensor.nws_alerts_alerts
above: 0
action:
- repeat:
for_each: "{{ trigger.to_state.attributes.Alerts | reject('in', trigger.from_state.attributes.Alerts) | sort(attribute='ID') | list() }}"
sequence:
- service: script.turn_on
continue_on_error: true
entity_id: script.notification_pushover_message
data:
variables:
target: my_phone
message: "NWS New: {{ repeat.item.Event }}"
sound: echo
- delay:
seconds: 5
mode: queued
initial_state: "on"
max: 10
Persistent Notifications
This automation creates notifications inside Home Assistant that stay visible until cleared.
alias: NWS - Persistent Notifications
trigger:
- platform: state
entity_id: sensor.nws_alerts_alerts
condition:
- condition: numeric_state
entity_id: sensor.nws_alerts_alerts
above: 0
action:
- repeat:
for_each: "{{ trigger.to_state.attributes.Alerts | reject('in', trigger.from_state.attributes.Alerts) | sort(attribute='ID') | list() }}"
sequence:
- service: script.nws_alerts_persistent_notification
data:
notification_id: "NWS_{{ repeat.item.ID }}"
title: "NWS New: {{ repeat.item.Event }}"
message: "{{ repeat.item.Description }}"
- delay:
seconds: 5
mode: queued
initial_state: "on"
max: 10
Severity-Based Actions
This automation adapts based on the severity of the alert.
alias: NWS Alerts - Severity Based Actions
description: ""
triggers:
- entity_id: sensor.nws_alerts_alerts
above: 0
trigger: numeric_state
conditions: []
actions:
- variables:
first_alert: >
{% set alerts = state_attr('sensor.nws_alerts_alerts', 'Alerts') %} {{ alerts[0] if alerts is not none else {} }}
alert_severity: |
{{ first_alert.Severity | default('Unknown') }}
alert_headline: |
{{ first_alert.Headline | default('NWS Alert') }}
- choose:
- conditions:
- condition: template
value_template: "{{ alert_severity == 'Minor' }}"
sequence:
- action: notify.ryan_notify_standard
data: {}
- conditions:
- condition: template
value_template: "{{ alert_severity == 'Moderate' }}"
sequence:
- data:
message: "NWS Alert (Moderate): {{ alert_headline }}"
action: notify.ryan_notify_standard
- conditions:
- condition: template
value_template: "{{ alert_severity == 'Severe' }}"
sequence:
- data:
message: "⚠️ NWS Severe Alert: {{ alert_headline }}"
action: notify.ryan_notify_standard
- if:
- condition: time
after: "08:00:00"
before: "20:00:00"
then:
- data:
entity_id: media_player.living_room_speaker
message: Severe weather alert issued. {{ alert_headline }}
action: tts.cloud_say
- conditions:
- condition: template
value_template: "{{ alert_severity == 'Extreme' }}"
sequence:
- data:
message: "🚨 NWS Extreme Alert: {{ alert_headline }}"
action: notify.ryan_notify_standard
- data:
brightness: 255
action: light.turn_on
target:
entity_id:
- light.basement_stairs
- light.basement_main_lights
- light.bedroom_overhead
- data:
entity_id: media_player.nesthubb60a
message: >-
Extreme weather alert! Seek shelter immediately. {{ alert_headline }}
action: tts.cloud_say
- data:
entity_id: media_player.kitchen_display
message: >-
Extreme weather alert! Seek shelter immediately. {{ alert_headline }}
action: tts.cloud_say
default:
- data:
message: NWS Alert received but severity unknown. Check app.
action: notify.ryan_notify_standard
mode: single
Severity Breakdown:
Severity | Action |
---|---|
Minor | Mobile notification only |
Moderate | Mobile notification with alert headline |
Severe | Mobile notification + TTS announcement (daytime only, 8am–8pm) |
Extreme | Mobile notification + TTS on multiple speakers + turn on basement & bedroom lights |
Step 4: Dashboard Elements
Finally, let’s add alerts to your dashboard.
Markdown Card
content: >
{% if is_state('binary_sensor.nws_alerts_active','on') %}
{% set alerts = state_attr('sensor.nws_alerts_alerts','Alerts') %}
**{{ alerts[0].Headline }}**
Severity: {{ alerts[0].Severity }}
Expires: {{ alerts[0].Expires }}
{% else %}
No active alerts.
{% endif %}
Entity Filter Card
Configure it to only display when alerts are active. Use sensor.nws_alerts_alerts or your binary sensor.
Wrap-Up
With just a few steps, you can:
- Install NWS Alerts via HACS.
- Configure with your zone codes.
- Add a template sensor.
- Set up notifications and severity-based actions.
- Build a dashboard card.
Your smart home will now warn you about severe weather automatically — whether it’s a push to your phone, an announcement on your smart speakers, or flashing your lights during an extreme event.
Extra: Magic Mind Partner
I’ve been using Magic Mind while traveling — they’re easy to pack, more convenient than coffee, and help me stay focused. They’ve been a partner with the channel for a few months and have committed their support for the next few months.
👉 Try it yourself: magicmind.com/SMART50
You’ll get 50% off your first subscription or 20% off a one-time purchase.