How to send notifications for DWD weather warnings

@alanmilinovic I’ve just checked states and warnings again, see below. There are 3 warnings atm but automation did not trigger anything. Log says that it has been triggered but I got no notification.

What am I missing?

You have some kind of red exclamation on the notify action (in your case “notify.pushover”), what means that something is wrong with the push notifications.

Use Actions inside Developer tools to test if “notify.pushover” is working.

I have deleted the sticky and persistent notification since i am using iOS. Have some kind of html issue now but at least the notification works…for now.

Did you see any other mistakes in traces which i have to look after?

Sorry for asking so many times, i’m experienced in tech stuff but not in coding in general. So i have to learn those things the hard way

Hm sticky and persistent options shouldn’t cause failure for message to be sent out, but maybe I am wrong. Not sure what html error you mean, but glad that it works.

Everything else looks good.

Just ask if you have any questions, happy to help.

Regarding html issues: color formatted sections with “span”. Should only work with android, not with iOS.

It looks like the notifications are working atm. But I am getting so much pings per hour. Since 6 pm when I had adjusted the automation, there were almost 15 notifications. Is there a way to use another other trigger than just the count of
warnings?

Lets say…every type of headline (warning_headline) once per 2 hours max? Would that be possible?

Hm, in my case, for today I got last notification at 20:00. Strange, will think about it and check the code tomorrow. Going to sleep now.

So I checked how it looks in my case. I do have the weather warning and it was triggered only 3 times today, so I do not understand how it is that much triggered in your case.

This is the main part in code responsible for checking if there were any changes:

condition: template
     alias: Warnung änderungen prüfen
      value_template: >-
        {{ trigger.from_state.attributes["warning_" ~ repeat.index]
                    != trigger.to_state.attributes["warning_" ~ repeat.index] }}

It is checking all attributes for the sensor (old and new state) and if there is any change it will trigger notification.

Can you please check in your companion app Notifications history part?

Thx for the heads up, Alan.

I have noticed that the notification always triggers at regular intervals of 15 minutes and then also without changing content.

Can’t we narrow down the attributes to limit the possibilities for notifications a bit? I mean, there are many warnings atm but there is no need to trigger a notification so many times.

What do you want to know about notifications in the companion app? I don’t see anything conspicuous there

Hi @baerakafubu,
I don’t want to advertise my solution too much but have you tried my automation from the post above?

It still works fine for me and does not create duplicates as of now.

Your condition @dominik4545 is checking hard-coded attributes, what is also fine to some extend. In my solution I am checking them all and dynamically.

My script is also not triggered multiple times without any change in the actual warning sensor. It would be good to see state before and after of the sensor attributes to understand why in @baerakafubu case it is triggered on every sensor update (indication is 15 minutes interval).

I would first suggest to you @baerakafubu that you check in Traces info of the automation, state of the sensor before and after and send it here, then you can try to replace my condition with the one from @dominik4545 and adjust it if needed to see hiw it behaves. For both scripts I would like to see state before and after to understand why it is triggered so often in your environment.

Before:

After 15 Minutes:

Thx guys, we’ll get that solved eventually :sweat_smile: @dominik4545 @alanmilinovic
I have actually tried so many different approaches and solutions in the meantime that I don’t really understand anymore where I have to look if something goes wrong with the DWD sensor. So you guys think I could also mix both your automations and change the condition to see if that somehow leads to the goal? I also don’t understand how the update attribute actually works…are there regular updates or just depending on the weather state?

I think you misunderstood, when I said before and afte state. I was thinking about “Changed Variables” or “Geänderte Variablen”, next to the “Step config” or in German “Schritt-Konfiguration” when you enter the trace of the automation.

If you can copy paste the result of that, I can compare and understand what was the actual change that triggered the automation. There we can see under “trigger” two things, “from_state” and “to_state” of the sensor.

Okay sorry…I understand what you’re looking for. What icon in the traces view is the sensor state? Which step shows the state change of the sensor?

As soon as you enter Trace, switch tab and there it is, so main step. It is also important that you chose trace where notification was sent out. (snow flake icon).

I guess i have the view which displays the correct changes. BUT, there is no warning since 11:30… :laughing: ice and snow warnings are gone, it’s 11° today :see_no_evil:

You can use sensors from other region for test purposes. :wink:

Just received a new warning. That’s what you were looking for?

this:
  entity_id: automation.sicherung_notify_weather_warning
  state: 'on'
  attributes:
    id: '1739637206930'
    last_triggered: '2025-02-27T11:59:46.566572+00:00'
    mode: queued
    current: 0
    max: 10
    friendly_name: 'Backup Notify: Weather warning'
  last_changed: '2025-02-26T12:44:43.771593+00:00'
  last_reported: '2025-02-27T11:59:47.306896+00:00'
  last_updated: '2025-02-27T11:59:47.306896+00:00'
  context:
    id: 01JN3MDWC603JATQABDZM4KG3P
    parent_id: 01JN3MDWBZSDQKW36SRDWZR9T0
    user_id: null
trigger:
  id: '0'
  idx: '0'
  alias: null
  platform: state
  entity_id: sensor.kreis_sudliche_weinstrasse_aktuelle_warnstufe
  from_state:
    entity_id: sensor.kreis_sudliche_weinstrasse_aktuelle_warnstufe
    state: '1'
    attributes:
      region_name: Kreis Südliche Weinstraße
      region_id: 107337000
      last_update: '2025-02-27T11:59:46.531000+00:00'
      warning_count: 3
      warning_1_name: FROST
      warning_1_type: 22
      warning_1_level: 1
      warning_1_headline: Amtliche WARNUNG vor FROST
      warning_1_description: Es tritt oberhalb 400 m leichter Frost um -1 °C auf.
      warning_1_instruction: "Hinweis auf \n\_·\_mögliche Frostschäden\n\nHandlungsempfehlungen: \n\_·\_ggf. Frostschutzmaßnahmen ergreifen"
      warning_1_start: '2025-02-27T20:00:00+00:00'
      warning_1_end: '2025-02-28T08:00:00+00:00'
      warning_1_parameters:
        Lufttemperatur: ~-1 [°C]
      warning_1_color: '#ffeb3b'
      warning_1:
        start_time: '2025-02-27T20:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: FROST
        event_code: 22
        headline: Amtliche WARNUNG vor FROST
        description: Es tritt oberhalb 400 m leichter Frost um -1 °C auf.
        instruction: "Hinweis auf \n\_·\_mögliche Frostschäden\n\nHandlungsempfehlungen: \n\_·\_ggf. Frostschutzmaßnahmen ergreifen"
        urgency: immediate
        level: 1
        parameters:
          Lufttemperatur: ~-1 [°C]
        color: '#ffeb3b'
      warning_2_name: GLÄTTE
      warning_2_type: 84
      warning_2_level: 1
      warning_2_headline: Amtliche WARNUNG vor GLÄTTE
      warning_2_description: Es besteht oberhalb 400 m Glättegefahr.
      warning_2_instruction: "Hinweis auf \n\_·\_Rutschgefahr\n\nHandlungsempfehlungen: \n\_·\_Verhalten im Straßenverkehr anpassen"
      warning_2_start: '2025-02-27T17:00:00+00:00'
      warning_2_end: '2025-02-28T08:00:00+00:00'
      warning_2_parameters: null
      warning_2_color: '#ffeb3b'
      warning_2:
        start_time: '2025-02-27T17:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: GLÄTTE
        event_code: 84
        headline: Amtliche WARNUNG vor GLÄTTE
        description: Es besteht oberhalb 400 m Glättegefahr.
        instruction: "Hinweis auf \n\_·\_Rutschgefahr\n\nHandlungsempfehlungen: \n\_·\_Verhalten im Straßenverkehr anpassen"
        urgency: immediate
        level: 1
        parameters: null
        color: '#ffeb3b'
      warning_3_name: GEWITTER
      warning_3_type: 31
      warning_3_level: 1
      warning_3_headline: Amtliche WARNUNG vor GEWITTER
      warning_3_description: >-
        Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten bis
        60 km/h (17 m/s, 33 kn, Bft 7).
      warning_3_instruction: "Hinweis auf \n\_·\_Blitzschlag (Lebensgefahr!)\n\_·\_umherfliegende leichte Gegenstände\n\nHandlungsempfehlungen: \n\_·\_Aufenthalt im Freien vermeiden oder Schutz suchen (z.B. in Gebäuden)\n\_·\_Gewässer meiden\n\_·\_lose Gegenstände sichern\n\_·\_z.B. Zelte und Abdeckungen befestigen"
      warning_3_start: '2025-02-27T11:48:00+00:00'
      warning_3_end: '2025-02-27T12:45:00+00:00'
      warning_3_parameters:
        Böen: <60 [km/h]
      warning_3_color: '#ffeb3b'
      warning_3:
        start_time: '2025-02-27T11:48:00+00:00'
        end_time: '2025-02-27T12:45:00+00:00'
        event: GEWITTER
        event_code: 31
        headline: Amtliche WARNUNG vor GEWITTER
        description: >-
          Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten
          bis 60 km/h (17 m/s, 33 kn, Bft 7).
        instruction: "Hinweis auf \n\_·\_Blitzschlag (Lebensgefahr!)\n\_·\_umherfliegende leichte Gegenstände\n\nHandlungsempfehlungen: \n\_·\_Aufenthalt im Freien vermeiden oder Schutz suchen (z.B. in Gebäuden)\n\_·\_Gewässer meiden\n\_·\_lose Gegenstände sichern\n\_·\_z.B. Zelte und Abdeckungen befestigen"
        urgency: immediate
        level: 1
        parameters:
          Böen: <60 [km/h]
        color: '#ffeb3b'
      attribution: Data provided by DWD
      friendly_name: Kreis Südliche Weinstraße Aktuelle Warnstufe
    last_changed: '2025-02-27T11:44:46.536275+00:00'
    last_reported: '2025-02-27T11:59:46.559168+00:00'
    last_updated: '2025-02-27T11:59:46.559168+00:00'
    context:
      id: 01JN3MDWBZDBSS7GJTBQVJ9QGT
      parent_id: null
      user_id: null
  to_state:
    entity_id: sensor.kreis_sudliche_weinstrasse_aktuelle_warnstufe
    state: '1'
    attributes:
      region_name: Kreis Südliche Weinstraße
      region_id: 107337000
      last_update: '2025-02-27T12:14:46.507000+00:00'
      warning_count: 3
      warning_1_name: FROST
      warning_1_type: 22
      warning_1_level: 1
      warning_1_headline: Amtliche WARNUNG vor FROST
      warning_1_description: Es tritt oberhalb 400 m leichter Frost um -1 °C auf.
      warning_1_instruction: "Hinweis auf \n\_·\_mögliche Frostschäden\n\nHandlungsempfehlungen: \n\_·\_ggf. Frostschutzmaßnahmen ergreifen"
      warning_1_start: '2025-02-27T20:00:00+00:00'
      warning_1_end: '2025-02-28T08:00:00+00:00'
      warning_1_parameters:
        Lufttemperatur: ~-1 [°C]
      warning_1_color: '#ffeb3b'
      warning_1:
        start_time: '2025-02-27T20:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: FROST
        event_code: 22
        headline: Amtliche WARNUNG vor FROST
        description: Es tritt oberhalb 400 m leichter Frost um -1 °C auf.
        instruction: "Hinweis auf \n\_·\_mögliche Frostschäden\n\nHandlungsempfehlungen: \n\_·\_ggf. Frostschutzmaßnahmen ergreifen"
        urgency: immediate
        level: 1
        parameters:
          Lufttemperatur: ~-1 [°C]
        color: '#ffeb3b'
      warning_2_name: GLÄTTE
      warning_2_type: 84
      warning_2_level: 1
      warning_2_headline: Amtliche WARNUNG vor GLÄTTE
      warning_2_description: Es besteht oberhalb 400 m Glättegefahr.
      warning_2_instruction: "Hinweis auf \n\_·\_Rutschgefahr\n\nHandlungsempfehlungen: \n\_·\_Verhalten im Straßenverkehr anpassen"
      warning_2_start: '2025-02-27T17:00:00+00:00'
      warning_2_end: '2025-02-28T08:00:00+00:00'
      warning_2_parameters: null
      warning_2_color: '#ffeb3b'
      warning_2:
        start_time: '2025-02-27T17:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: GLÄTTE
        event_code: 84
        headline: Amtliche WARNUNG vor GLÄTTE
        description: Es besteht oberhalb 400 m Glättegefahr.
        instruction: "Hinweis auf \n\_·\_Rutschgefahr\n\nHandlungsempfehlungen: \n\_·\_Verhalten im Straßenverkehr anpassen"
        urgency: immediate
        level: 1
        parameters: null
        color: '#ffeb3b'
      warning_3_name: GEWITTER
      warning_3_type: 31
      warning_3_level: 1
      warning_3_headline: Amtliche WARNUNG vor GEWITTER
      warning_3_description: >-
        Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten bis
        60 km/h (17 m/s, 33 kn, Bft 7).
      warning_3_instruction: "Hinweis auf \n\_·\_Blitzschlag (Lebensgefahr!)\n\_·\_umherfliegende leichte Gegenstände\n\nHandlungsempfehlungen: \n\_·\_Aufenthalt im Freien vermeiden oder Schutz suchen (z.B. in Gebäuden)\n\_·\_Gewässer meiden\n\_·\_lose Gegenstände sichern\n\_·\_z.B. Zelte und Abdeckungen befestigen"
      warning_3_start: '2025-02-27T11:48:00+00:00'
      warning_3_end: '2025-02-27T12:45:00+00:00'
      warning_3_parameters:
        Böen: <60 [km/h]
      warning_3_color: '#ffeb3b'
      warning_3:
        start_time: '2025-02-27T11:48:00+00:00'
        end_time: '2025-02-27T12:45:00+00:00'
        event: GEWITTER
        event_code: 31
        headline: Amtliche WARNUNG vor GEWITTER
        description: >-
          Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten
          bis 60 km/h (17 m/s, 33 kn, Bft 7).
        instruction: "Hinweis auf \n\_·\_Blitzschlag (Lebensgefahr!)\n\_·\_umherfliegende leichte Gegenstände\n\nHandlungsempfehlungen: \n\_·\_Aufenthalt im Freien vermeiden oder Schutz suchen (z.B. in Gebäuden)\n\_·\_Gewässer meiden\n\_·\_lose Gegenstände sichern\n\_·\_z.B. Zelte und Abdeckungen befestigen"
        urgency: immediate
        level: 1
        parameters:
          Böen: <60 [km/h]
        color: '#ffeb3b'
      attribution: Data provided by DWD
      friendly_name: Kreis Südliche Weinstraße Aktuelle Warnstufe
    last_changed: '2025-02-27T11:44:46.536275+00:00'
    last_reported: '2025-02-27T12:14:46.536171+00:00'
    last_updated: '2025-02-27T12:14:46.536171+00:00'
    context:
      id: 01JN3N9B886CZCNAT507DFWRVW
      parent_id: null
      user_id: null
  for: null
  attribute: null
  description: state of sensor.kreis_sudliche_weinstrasse_aktuelle_warnstufe

Exactly, thanks. So I can only see that “last_update” is changed inside attributes.
I cannot now really test it as I don’t have any warnings in my region, but you can replace my condition with the one from @dominik4545 and hardcode check of specific attributes.

Sorry I just realized that I am checking all the warnings inside attributes.

So in your case it is this:

  from_state:
    attributes:
      warning_1:
        start_time: '2025-02-27T20:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: FROST
        event_code: 22
        headline: Amtliche WARNUNG vor FROST
        description: Es tritt oberhalb 400 m leichter Frost um -1 °C auf.
        instruction: "Hinweis auf \n\_·\_mögliche Frostschäden\n\nHandlungsempfehlungen: \n\_·\_ggf. Frostschutzmaßnahmen ergreifen"
        urgency: immediate
        level: 1
        parameters:
          Lufttemperatur: ~-1 [°C]
        color: '#ffeb3b'
      warning_2:
        start_time: '2025-02-27T17:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: GLÄTTE
        event_code: 84
        headline: Amtliche WARNUNG vor GLÄTTE
        description: Es besteht oberhalb 400 m Glättegefahr.
        instruction: "Hinweis auf \n\_·\_Rutschgefahr\n\nHandlungsempfehlungen: \n\_·\_Verhalten im Straßenverkehr anpassen"
        urgency: immediate
        level: 1
        parameters: null
        color: '#ffeb3b'
      warning_3:
        start_time: '2025-02-27T11:48:00+00:00'
        end_time: '2025-02-27T12:45:00+00:00'
        event: GEWITTER
        event_code: 31
        headline: Amtliche WARNUNG vor GEWITTER
        description: >-
          Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten
          bis 60 km/h (17 m/s, 33 kn, Bft 7).
        instruction: "Hinweis auf \n\_·\_Blitzschlag (Lebensgefahr!)\n\_·\_umherfliegende leichte Gegenstände\n\nHandlungsempfehlungen: \n\_·\_Aufenthalt im Freien vermeiden oder Schutz suchen (z.B. in Gebäuden)\n\_·\_Gewässer meiden\n\_·\_lose Gegenstände sichern\n\_·\_z.B. Zelte und Abdeckungen befestigen"
        urgency: immediate
        level: 1
        parameters:
          Böen: <60 [km/h]
        color: '#ffeb3b'

and

  to_state:
    attributes:
      warning_1:
        start_time: '2025-02-27T20:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: FROST
        event_code: 22
        headline: Amtliche WARNUNG vor FROST
        description: Es tritt oberhalb 400 m leichter Frost um -1 °C auf.
        instruction: "Hinweis auf \n\_·\_mögliche Frostschäden\n\nHandlungsempfehlungen: \n\_·\_ggf. Frostschutzmaßnahmen ergreifen"
        urgency: immediate
        level: 1
        parameters:
          Lufttemperatur: ~-1 [°C]
        color: '#ffeb3b'
      warning_2:
        start_time: '2025-02-27T17:00:00+00:00'
        end_time: '2025-02-28T08:00:00+00:00'
        event: GLÄTTE
        event_code: 84
        headline: Amtliche WARNUNG vor GLÄTTE
        description: Es besteht oberhalb 400 m Glättegefahr.
        instruction: "Hinweis auf \n\_·\_Rutschgefahr\n\nHandlungsempfehlungen: \n\_·\_Verhalten im Straßenverkehr anpassen"
        urgency: immediate
        level: 1
        parameters: null
        color: '#ffeb3b'
      warning_3:
        start_time: '2025-02-27T11:48:00+00:00'
        end_time: '2025-02-27T12:45:00+00:00'
        event: GEWITTER
        event_code: 31
        headline: Amtliche WARNUNG vor GEWITTER
        description: >-
          Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten
          bis 60 km/h (17 m/s, 33 kn, Bft 7).
        instruction: "Hinweis auf \n\_·\_Blitzschlag (Lebensgefahr!)\n\_·\_umherfliegende leichte Gegenstände\n\nHandlungsempfehlungen: \n\_·\_Aufenthalt im Freien vermeiden oder Schutz suchen (z.B. in Gebäuden)\n\_·\_Gewässer meiden\n\_·\_lose Gegenstände sichern\n\_·\_z.B. Zelte und Abdeckungen befestigen"
        urgency: immediate
        level: 1
        parameters:
          Böen: <60 [km/h]
        color: '#ffeb3b'

As you can see there are no changes, so notification shouldn’t be triggered.

Yeah sure, thats what i’ve said :sweat_smile: So, it was just a mistake in your automation or did the code have no errors? Should i use @dominik4545’s automation or change your code with the dynamic request?