Community. Driven. Weather. Data. | Always Ad-Free | Developer FriendlyChecking statusDiscord
Become a supporter
Sign in
Home Assistant

Automations

YAML examples for storm cells approaching and life-safety warnings, plus a dashboard card for live alerts.


The examples use a place named Home, a phone at notify.mobile_app_phone and a speaker at media_player.kitchen. Swap in your own. Paste them into automations.yaml, or open a new automation in the editor and switch it to YAML.

Storm cell approaching: turn on the lights

On the sensor, which also covers a storm that was already approaching when Home Assistant started:

alias: Storm cell approaching, lights on
triggers:
  - trigger: state
    entity_id: binary_sensor.wxalerts_home_storm_cell_approaching
    from: "off"
    to: "on"
actions:
  - action: light.turn_on
    target:
      entity_id: light.living_room
    data:
      color_name: orange
      brightness_pct: 100

Storm cell approaching: announce the arrival time

The wxalerts_storm_cell event fires when a storm cell first threatens a place and again if its threat level rises.

alias: Announce storm cell arrival
triggers:
  - trigger: event
    event_type: wxalerts_storm_cell
    event_data:
      place_name: Home
actions:
  - action: tts.speak
    target:
      entity_id: tts.piper
    data:
      media_player_entity_id: media_player.kitchen
      message: >-
        {{ trigger.event.data.rung_label }}.
        {% if trigger.event.data.eta_min is none %}
          A storm cell is near {{ trigger.event.data.place_name }}.
        {% elif trigger.event.data.eta_min == 0 %}
          A storm cell is over {{ trigger.event.data.place_name }} now.
        {% else %}
          A storm cell is about {{ trigger.event.data.eta_min | round(0) | int }}
          minutes from {{ trigger.event.data.place_name }}.
        {% endif %}
  - action: notify.mobile_app_phone
    data:
      title: "{{ trigger.event.data.rung_label }}"
      message: >-
        Storm cell {{ trigger.event.data.distance_km | round(0) | int }} km away,
        moving at {{ trigger.event.data.speed_kmh | round(0) | int }} km/h.

Close the garage before it arrives

alias: Close the garage for a storm cell
triggers:
  - trigger: numeric_state
    entity_id: sensor.wxalerts_home_storm_cell_eta
    below: 15
conditions:
  - condition: state
    entity_id: cover.garage_door
    state: open
actions:
  - action: cover.close_cover
    target:
      entity_id: cover.garage_door

Only tornado threats

alias: Tornado threat from a storm cell
triggers:
  - trigger: state
    entity_id: sensor.wxalerts_home_storm_cell_threat
    to:
      - tornado_risk
      - tornado_risk_high
      - tornado_detected
      - tornado_confirmed
actions:
  - action: notify.mobile_app_phone
    data:
      title: "{{ state_attr('binary_sensor.wxalerts_home_storm_cell_approaching', 'rung_label') }}"
      message: >-
        Arrives in about
        {{ states('sensor.wxalerts_home_storm_cell_eta') }} minutes.
      data:
        push:
          interruption-level: critical

Life-safety warnings

A tornado warning for Home: a critical push and a red hallway light.

alias: Tornado warning at home
triggers:
  - trigger: state
    entity_id: binary_sensor.wxalerts_home_tornado_warning
    from: "off"
    to: "on"
actions:
  - action: notify.mobile_app_phone
    data:
      title: Tornado Warning
      message: >-
        {{ state_attr('binary_sensor.wxalerts_home_tornado_warning', 'alerts')[0].instruction }}
      data:
        push:
          interruption-level: critical
  - action: light.turn_on
    target:
      entity_id: light.hallway
    data:
      color_name: red
      brightness_pct: 100

Every warning for every place, in one automation, read out loud:

alias: Any warning for any place
triggers:
  - trigger: event
    event_type: wxalerts_hazard
    event_data:
      action: begin
conditions:
  - condition: template
    value_template: "{{ trigger.event.data.event_type.endswith('_warning') }}"
actions:
  - action: notify.mobile_app_phone
    data:
      title: "{{ trigger.event.data.event }}"
      message: "{{ trigger.event.data.place_name }}: {{ trigger.event.data.headline }}"
  - action: tts.speak
    target:
      entity_id: tts.piper
    data:
      media_player_entity_id: media_player.kitchen
      message: >-
        {{ trigger.event.data.event }} for {{ trigger.event.data.place_name }}
        until {{ as_timestamp(trigger.event.data.ends) | timestamp_custom('%-I:%M %p') }}.

A card for live alerts

type: markdown
content: |
  {% set alerts = state_attr('sensor.wxalerts_home_active_alerts', 'alerts') %}
  {% if alerts %}
  {% for a in alerts %}
  ### {{ a.event }}
  **{{ a.severity }}**, until {{ as_timestamp(a.ends) | timestamp_custom('%a %-I:%M %p') }}

  {{ a.headline }}
  {% endfor %}
  {% else %}
  No active alerts.
  {% endif %}

May we use Microsoft Clarity to see how pages are used (clicks, scrolling and replays of a visit, with anything you type hidden), plus a random ID linking that to crash reports? Only to find bugs and confusing screens. Never advertising, never sold.