Help Template Sensor / or Template Trigger

hey I’m a newbie in templating and need a bit help
I want to trigger an Automation with a state on an atrribute on ‘calendar.aufgaben’ the state attribute is ‘due_today’ the attribute have two states ‘true’ or ‘false’
So its better to get an sensor on when true ? how this will work ?
I tested this two options but they dont wortk
For automation trigger

`{% if 'calendar.aufgaben' %}
{{ state_attr('due_today', 'true') }}
true
{% else %}
false
{% endif %}`

and the sensor in my yaml:

binary_sensor:
  - platform: template
    sensors:
        friendly_name: "Tagesaufgabe"
        value_template: >-
          {{ is_state_attr('calendar.aufgaben', 'due_today', 'true') }}

If you think you’ll use this exact same data point in other automations, scripts, or dashboard cards you should set up a sensor. If this is a one-off use, just use a template trigger.

A template trigger would look like:

trigger:
  - platform: template
    value_template: "{{ state_attr('calendar.aufgaben', 'due_today') }}"

A template sensor in the current format would look like:

template:
  -  binary_sensor:
       - name: "Tagesaufgabe"
         state: "{{ state_attr('calendar.aufgaben', 'due_today') }}"

easy
thank you :smiley:
works perfekt i used the sensor