Automation condition - ignore all day calendar events

I’ve been working on an automation to pass my google calendar to an AWTRIX clock but currently if there’s an all day event that overrules everything and only display that.

Is there a condition to ignore all day events and /or events >4 hours duration?

Part 2: is there a way to collect the whole days events into a variable / template so I could pass these to the AWTRIX clock?

Please share your automation.

You should be able to list them all with a for loop.

e.g. this example is at the bottom of the calendar documentation page:

  message: >-
    Your school calendar for today:
    {% for event in agenda["calendar.school_calendar"]["events"] %}
    {{ event.start}}: {{ event.summary }}<br>
    {% endfor %}

Thank you for the for loop suggestion and link I’ll take a look.

Here is my automation code :slight_smile:

 ‘alias: Send Calendar to Awtrix.
description: CALENDAR
triggers:
  - minutes: /20
    trigger: time_pattern
  - trigger: calendar
    entity_id: calendar.will_gmail_com
    event: start
    offset: "-1:0:0"
  - trigger: calendar
    entity_id: calendar.will_gmail_com
    event: start
    offset: "-0:30:0"
conditions:
  - condition: template
    value_template: |
      {{ calendar_event.summary != '' }}
actions:
  - choose: []
    default: null
  - alias: Variable Entity
    variables: {}
  - variables:
      alias: Variable Entity
      variables: {}
      device_ids:
        - 5de967b419adb63dece3ab07f4b0fca8
      user_data: {}
      value_template: "{{ user_data.get('value_template', states(entity_id)) }}"
      icon_template: "{{ user_data.get('icon_template', app_icon) }}"
      prefix_text: >-
        {{states.calendar.will_gmail_com.attributes.message}}.
        {{states.calendar.will_gmail_com.attributes.start_time}}
      user_options:
        duration: 30
      payload: |-
        {
          {{('"icon"' if icon_template) ~ (":" if icon_template) ~ ('"' ~ icon_template ~ '"' if icon_template) }}
          {{"," if icon_template}} "text":"{{prefix_text}}",
          "pushIcon": 2,
          "repeat": 2
        }
  - repeat:
      for_each: "{{ device_ids }}"
      sequence:
        - variables:
            awtrix_device_name: >-
              {{ iif( device_attr(repeat.item, 'name_by_user') != none,
              device_attr(repeat.item, 'name_by_user'), device_attr(repeat.item,
              'name') ) }}
        - if: []
          then:
            - data:
                name: "{{app_name}}"
                data: "{{ dict(payload, **user_options) }}"
              action: awtrix.{{awtrix_device_name}}_push_app_data
          else:
            - data:
                name: "{{app_name}}"
                data: {}
              action: awtrix.{{awtrix_device_name}}_push_app_data
mode: single
variables:
  entity_id: calendar_event.summary
  app_name: Calendar details
  app_icon: calendarsmall
  additional_conditions: []