Calendar get events

here a template action sensor:

  - trigger:
     - platform: time_pattern
       minutes: /5
       seconds: "30"
    action:
      - service: calendar.get_events
        data:
          duration:
            hours: 450
            minutes: 0
            seconds: 0
          start_date_time: "{{ today_at() }}"
        target:
          entity_id: calendar.birthdays
        response_variable: scheduled_birthdays
    sensor:
      - name: Calendar Scheduled Birthdays
        unique_id: calendar_scheduled_Birthdays
        state: "{{ scheduled_birthdays.events | count() }}"
        attributes:
          scheduled_events: "{{ scheduled_birthdays.events }}"
        icon: mdi:calendar'

my sensor : sensor.calendar_scheduled_birthdays → state 0 ??

in developper tools(service):

service: calendar.get_events
data:
          duration:
            hours: 450
            minutes: 0
            seconds: 0
          start_date_time: "{{ today_at() }}"
target:
          entity_id: calendar.birthdays
response_variable: scheduled_birthdays

Answer:

calendar.birthdays:
  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


problem with my sensor ???

i can’t find the solution

Thanks

ok i found it

    sensor:
      - name: Calendar Scheduled Birthdays
        unique_id: calendar_scheduled_Birthdays
        state: "{{ scheduled_birthdays['calendar.birthdays'].events | count() }}"
        attributes:
          scheduled_events: "{{ scheduled_birthdays['calendar.birthdays'].events }}"
        icon: mdi:calendar'
1 Like

Always add your solution if you found the issue. This helps others in the future. Also, looks like @Didgeridrew found the (same) solution. Give him the credits :-).

Hi Jacques please take the time to mark the answer as solution, you do that by selecting the three dots under the post:

image

Then select the check box:

image

By doing so this can be useful to other users as well and prevents that someone else steps in and still tries to help you.