Calender: Meetings of today into Sensor

Hello, I need help: I want to write todays appointments to an sensor.
I added the code in the cofiguration.yaml, but its not working.

Can somebody help me?

sensor:
  - platform: template
    sensors:
      todays_calendar_events:
        friendly_name: "Heutige Termine"
        value_template: >-
          {% set today = as_timestamp(now()) | timestamp_custom('%Y-%m-%d') %}
          {% set today_events = states.calendar.dein_kalender.attributes.all_day | selectattr('start_date', 'eq', today) | list %}
          {% if today_events %}
            {% set event_list = [] %}
            {% for event in today_events %}
              {% set event_list = event_list + [event.summary] %}
            {% endfor %}
            {{ event_list | join(', ') }}
          {% else %}
            Keine Termine heute
          {% endif %}

You are using the “old” style template configuration. I suggest you update to the recommended style.

Here is my new style template sensor that lists all events for the next 2 days. You can adjust it to show just 1 day, or just today to meet your needs.

- trigger:
    - platform: homeassistant
      event: start

    - platform: event
      event_type: event_template_reloaded

    - platform: state
      entity_id: calendar.jazzyisj
  action:
    - service: calendar.get_events
      target:
        entity_id: calendar.jazzyisj
      data:
        duration:
          days: 2
      response_variable: agenda

    - variables:
        events: "{{ agenda['calendar.jazzyisj']['events'] }}"
  sensor:
    - name: "Upcoming Events"
      unique_id: upcoming_events
      icon: mdi:calendar-star
      state: "{{ events | count }}"
      attributes:
        events: >
          {%- if events | count > 0 %}
            {%- for event in events %}
              {%- if (event.start | as_datetime).day == now().day %}
                {{ event.start | as_timestamp | timestamp_custom('Today at %-I:%M %p') }}: {{ event.summary }}
              {%- else %}
                {{ event.start | as_timestamp | timestamp_custom('%A at %-I:%M %p') }}: {{ event.summary }}
              {%- endif %}
              {%- if event.description is defined %} - {{ event.description }}{% endif %}
            {%- endfor %}.
          {%- endif -%}