To-do Listen Benachrichtigung wenn Fälligkeit

Hallo,

Ich erhalte beim Abruf meiner To-do Liste folgenden Eintrag

{‘todo.your_to_do’: {‘items’: [{‘summary’: ‘Test’, ‘uid’: ‘15fb614e-affc-11f0-be4d-20f83b01774a’, ‘status’: ‘needs_action’, ‘due’: ‘2025-10-23T12:38:00+02:00’, ‘description’: ‘Testaufgabe’}, {‘summary’: ‘Tes1test’, ‘uid’: ‘d0b38504-afff-11f0-be4d-20f83b01774a’, ‘status’: ‘needs_action’, ‘due’: ‘2025-10-23T13:07:00+02:00’, ‘description’: ‘Test1’}]}}

Ich möchte mir nun über Automation eine Benachrichtigung zusenden lassen wenn der Termin im Rückstand ist. Dazu habe ich folgende Automation geschrieben

> alias: YOUR’s To-Do Notification
> description: To-do Notifications
> triggers:
>
> * at: “08:00:00”
>   trigger: time
> * at: “12:00:00”
>   trigger: time
> * at: “15:00:00”
>   trigger: time
>   conditions: [ ]
>   actions:
> * metadata: {}
>   data:
>   status: needs_action
>   response_variable: todovar
>   action: todo.get_items
>   target:
>   entity_id: todo.your_to_do
> * action: script.notify_all
>   metadata: {}
>   data:
>   message: “{{ todovar }}”
>   enabled: true
> * if:
>   * condition: template
>     value_template: |-
>     {%- for item in todovar\[‘todo.YOUR_to_do’\]\[‘items’\] %}
>     {% if ‘due’ in item%}
>     {% set timeformat = “%Y-%m-%dT%H:%M:%S%z” if ‘T’ in item\[‘due’\] else  “%Y-%m-%d” %}
>     {% set delta = as_local(strptime(item\[‘due’\], timeformat)) - today_at(“00:00”) %}
>     {% if delta.days == 0 %}
>     True
>     {% break %}
>     {% elif delta.days < 0 %}
>     True
>     {% break %}
>     {% endif %}
>     {% endif %}
>     {% endfor -%}
>     then:
>   * action: script.notify_all
>     metadata: {}
>     data:
>     message: “{{ todovar }}”
>   * data:
>     notification_id: TASK DUE
>     title: A task is due today!
>     message: A task is due today, check your to-do!!
>     enabled: false
>     action: persistent_notification.create
>     enabled: true
>     mode: single

Es müssten eigentlich die beiden Erinnerungen kommen.

Was mache ich falsch

Gruß Georg

Hier ein funktionierender Code, der mir eine Mail schickt und zusätzlich in der Mail die Aufzählung der überfälligen Aufgaben. Dein Jinja Code war gut.

Zusammenfassung
alias: 1 forum To-do Erinnerung
description: ""
triggers:
  - at:
      - "08:00:00"
      - "12:00:00"
      - "18:00:00"
    trigger: time
actions:
  - action: todo.get_items
    response_variable: todovar
    data:
      status: needs_action
    target:
      entity_id: todo.fussballsensor
  - condition: template
    value_template: |-
      {%- for item in todovar['todo.fussballsensor']['items'] %}
        {% if 'due' in item and item['status'] != 'completed' %}
          {% set timeformat = "%Y-%m-%dT%H:%M:%S%z" if 'T' in item['due'] else "%Y-%m-%d" %}
          {% set delta = as_local(strptime(item['due'], timeformat)) - now() %}
          {% if delta.total_seconds() <= 0 %}
            True
            {% break %}
          {% endif %}
        {% endif %}
      {% endfor -%}
  - action: notify.gmxolaf3
    data:
      title: Überfällige Aufgaben
      message: |
        {% set ns = namespace(out="") %}
        {%- for item in todovar['todo.fussballsensor']['items'] %}
          {% if 'due' in item and item['status'] != 'completed' %}
            {% set tf = "%Y-%m-%dT%H:%M:%S%z" if 'T' in item['due'] else "%Y-%m-%d" %}
            {% set due = as_local(strptime(item['due'], tf)) %}
            {% set delta = due - now() %}
            {% if delta.total_seconds() <= 0 %}
              {% set ns.out = ns.out ~ "- " ~ due.strftime("%d.%m.%Y %H:%M") ~ "Uhr → " ~ item['summary'] ~ "\n" %}
            {% endif %}
          {% endif %}
        {% endfor %}
        {% if ns.out | trim %}
          Die folgenden Aufgaben sind fällig oder überfällig:
          {{ ns.out }}
        {% endif %}

-----Ursprüngliche Nachricht-----
Von: Homeassi xxx@gmx.de
Gesendet: Donnerstag, 23. Oktober 2025 14:08
An: xxx xxx@gmx.de
Betreff: Überfällige Aufgaben

Die folgenden Aufgaben sind fällig oder überfällig:

  • 23.10.2025 10:00Uhr → testaufgabe

Was ich bisher nicht kannte, daß “condition: template” bei false wirklich die Automatisation stoppt. Muß ich mir merken - ich hätte spontan ein if/then gemacht.