Why my WorkCal Sensor is unavailable and didnt show data

Hi,
i have created a new sensor with templates.
If i check the cal with service get_events it shows me the entries.

But if i look at developer tools at states it show unavailable. I cant see errors in yaml. Please help…Can you give me a hint?

service: calendar.get_events
data:
          duration:
            hours: 450
            minutes: 0
            seconds: 0
          start_date_time: "{{ today_at() }}"
target:
          entity_id: calendar.arbeit
response_variable: scheduled_arbeit
Answer:
calendar.arbeit:
  events:
    - start: "2023-12-14T08:00:00+01:00"
      end: "2023-12-14T09:00:00+01:00"
      summary: Laurent
      description: anniversaire
    - start: "2023-12-15T08:00:00+01:00"
      end: "2023-12-15T09:00:00+01:00"
      summary: Camille
      description: anniversaire

I call it from configuration.yaml with
template: !include template.yaml

My Sensor in template.yaml

- trigger:
     - platform: time_pattern
       seconds: "30"
     - platform: event
       event_type: event_template_reloaded
- action:
      - service: calendar.get_events
        data:
          duration:
            hours: 450
            minutes: 0
            seconds: 0
          start_date_time: "{{ today_at() }}"
        target:
          entity_id: calendar.arbeit
        response_variable: scheduled_event
- sensor:
    - name: Calendar Scheduled Arbeit
      unique_id: calendar_scheduled_Arbeit
      state: "{{ scheduled_event['calendar.arbeit']['events'] | count() }}"
      attributes:
        scheduled_events: "{{ scheduled_event['calendar.arbeit']['events'] }}"
      icon: mdi:calendar'

the first template trigger works correctly. I can read all events. But the second one doesnt work.
I need help to get the failure…

thanks

G ROBudus

- trigger:
    - platform: time_pattern
      minutes: "/5"
    - platform: event
      event_type: event_template_reloaded
  action:
    - service: calendar.get_events
      data:
        duration:
          hours: 450
          minutes: 0
          seconds: 0
        #start_date_time: "{{ today_at() -1 }}"
        start_date_time: "2024-02-23 00:00:00+01:00"

      target:
        entity_id: calendar.arbeit
      response_variable: scheduledevent
  sensor:
    - name: Calendar Scheduled Arbeit
      unique_id: calendar_scheduled_Arbeit
      state: "{{ scheduledevent['calendar.arbeit']['events'] | count() }}"
      attributes:
        scheduled_events: "{{ scheduledevent['calendar.arbeit']['events'] }}"

and a second one to put the duration back into the cal

- trigger:
    - platform: time
      at: 18:00:00
    - platform: event
      event_type: event_template_reloaded  
  action:
    - variables:
        arbeitsbegin: {{ state_attr("sensor.calendar_scheduled_arbeit","scheduled_events")[0].start }}
        arbeitsende: {{ state_attr("sensor.calendar_scheduled_arbeit","scheduled_events")[1].end }}
        timestbegin: {{ as_timestamp(arbeitsbegin) }}
        timestampende: {{ as_timestamp(arbeitsende) }}
        hours: {{ ((as_timestamp(arbeitsende) - as_timestamp(arbeitsbegin)) |timestamp_custom("%H")) }}
        minutes: {{ ((as_timestamp(arbeitsende) - as_timestamp(arbeitsbegin)) |timestamp_custom("%M")) }}
        duration: {{ [hours, minutes]|join(':') }}
    - service: calendar.create_event
      target: 
        entity_id: calendar.arbeit
      data:
          summary: "{{duration}}"
          start_date_time: "{{ now() }}"
          end_date_time: "{{ now() + timedelta(minutes=1) }}"
  sensor:
    - name: Claendar Scheduled Arbeit Add
      unique_id: calendar_scheduled_Arbeit_add