UK MET Office Severe Weather Warnings

Ok got it now. I don’t use GUI to edit those automation. In fact, just checked, because it is a separate file (not stored in automations.yaml) I can’t edit it at all in GUI. Maybe that’s the problem, maybe GUI doesn’t handle variables properly as it is design for quite simple automations and that’s why it keeps known properties at the top and moves unknown (from the GUI automation template perspective) at the bottom, not sure tbh.
Looking at the automations.yaml I am guessing that the only properties GUI can handle are id, alias, description, trigger, condition, action, mode (also use_blueprint) in this exact order so when the GUI is parsing your automation to save it in the automations.yaml file it reorder your properties to this exact order and leaves everything else at the bottom.

In theory you could add additional if before warning.link to check if warnign is null then do nothing, and if not, then use warning.link. Potential problem you may get is that the warning will never be set at the moment the action is running so you will never get this link working.

Anyone getting anything show up for storm cathleen?
Should be a yellow warning.
I have mine set to do SW (South West) & Somerset.

Sensor seems to be working so maybe a problem with the card?

type: custom:stack-in-card
cards:
  - type: markdown
    content: >
      {% if state_attr('sensor.weather_alerts','entries') != [] %}
        {% for item in state_attr('sensor.weather_alerts','entries') %}
          {% for type, icon in
            [
              ('extreme heat', 'weather-sunny-alert'),
              ('fog', 'weather-fog'),
              ('ice', 'car-traction-control'),
              ('lightning', 'weather-lightning'),
              ('rain', 'weather-pouring'),
              ('rain, wind', 'weather-pouring'),
              ('snow', 'weather-snowy-heavy'),
              ('snow, ice', 'weather-snowy-heavy'),
              ('thunderstorm', 'weather-lightning'),
              ('thunderstorms', 'weather-lightning-rainy'),
              ('wind', 'weather-windy')
            ]
            if type == item.summary | regex_findall_index('.*warning of (.*) affecting.*', ignorecase=True) and item.summary | regex_findall('Somerset', ignorecase=True) %}
            {% set color = item.summary.split(' ')[0] %}
            {% set summary = item.summary | regex_findall_index('(.*) affecting South West England: (.*) valid from (.*) to (.*)', ignorecase=True) %}
            {% set link = item.link %}
            {% set time_utc_from = summary[2][0:2] ~':'~ summary[2][2:4] %}
            {% set time_utc_to = summary[3][0:2] ~':'~ summary[3][2:4] %}
            {% set date_from = summary[2][5:8] +'-'+ summary[2][9:11] +'-'+ summary[2][12:] %}
            {% set date_to = summary[3][5:8] +'-'+ summary[3][9:11] +'-'+ summary[3][12:] %}
            {% set time_local_from = ((now().date() ~ ' ' ~ time_utc_from ~ "+00:00") | as_datetime | as_local).strftime('%H:%M') %}  
            {% set time_local_to = ((now().date() ~ ' ' ~ time_utc_to ~ "+00:00") | as_datetime | as_local).strftime('%H:%M') %}
      |  |  |

      | -: | -- |

      | <font color = {%- if 'Yellow' == color %}'gold' {%- elif 'Amber' ==
      color %}'darkorange' {%- else %}'firebrick' {%- endif %}> <ha-icon icon={{
      "'mdi:" + icon + "'" }}> </ha-icon></font> | <a href='{{ link }}'>**{{
      summary[0] }}** </a> |

      | from: | **{{ time_local_from }}**, {{ date_from }} |

      | to: | **{{ time_local_to }}**, {{ date_to }} |
          {% endfor %}
      <br>
        {% endfor %}
      {% else %} No warnings at present {% endif %}

It looks like Somerset isn’t included in the current warning for the SW region, and you are filtering on Somerset for your card by the looks of it? I’m in Devon, and the warning is showing up correctly for me


I’m in Dorset and it’s showing up correctly for me too:

Yeah it’s odd though. I check the forecast for Street, in Somerset & the wind goes over 40mph. A yellow warning is triggered by winds over 40mph. but maybe it has to last more than 2-3hours?

can you share your card code please?

I thought I would share my own automation. It’s has less code and sends a notification for each alert stored in your sensor.

alias: Weather Warnings
description: ""
triggers:
  - entity_id:
      - sensor.weather_alerts_highlands
    id: weather_notify_warnings
    trigger: state
conditions:
  - condition: template
    value_template: "{{ alerts is not none }}"
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ alerts | length > 0 }}"
        sequence:
          - repeat:
              for_each: "{{ alerts }}"
              sequence:
                - choose:
                    - conditions:
                        - condition: template
                          value_template: |
                            {{ 'Highlands' in repeat.item.summary }}
                      sequence:
                        - data:
                            title: ⚠️ Met Office Weather Alert
                            message: >
                              {% set summary =
                              repeat.item.summary.split('affecting')[0].strip()
                              %}

                              {% set times = repeat.item.summary |
                              regex_findall('(valid from (.*) to (.*))',
                              ignorecase=True) %}

                              {{ summary | title }}

                              From: {{ times[0][1] if times and times[0] else
                              'Unknown' }}

                              To: {{ times[0][2] if times and times[0] else
                              'Unknown' }}
                          action: notify.notify
variables:
  alerts: "{{ state_attr('sensor.weather_alerts', 'entries') }}"
mode: single

Anyone know why the sensor would show that I have 3 alerts for my area but only 2 are showing in the attributes? Is it because the event start time has already passed?