alueError: dictionary update sequence element #0 has length 1

My automation, any help on the error

Error: Error rendering data template: ValueError: dictionary update sequence element #0 has length 1; 2 is required


alias: Working Send Calendar to Awtrix.
description: CALENDAR
triggers:
  - minutes: /20
    trigger: time_pattern
  - trigger: calendar
    entity_id: calendar.wil_gmail_com
    event: start
    offset: "-1:0:0"
  - trigger: calendar
    entity_id: calendar.wil_gmail_com
    event: start
    offset: "-0:30:0"
conditions:
  - condition: template
    value_template: |
      {{ calendar_event.summary != '' }}
actions:
  - target:
      entity_id:
        - calendar.wil_gmail_com
    data:
      duration:
        hours: 24
        minutes: 0
        seconds: 0
    response_variable: calendars
    action: calendar.get_events
  - variables:
      cal_evt: >
        {% for event in
        calendars["calendar.wil_gmail_com"]["events"] %} {{
        event.summary }} - {{ (event.start | as_datetime).strftime('%H:%M')}} -
        {{ event.location }} {% endfor %}
  - 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) }}"
      text_detail: " {{cal_evt}} "
      user_options:
        duration: 30
      payload: |-
        {
          {{('"icon"' if icon_template) ~ (":" if icon_template) ~ ('"' ~ icon_template ~ '"' if icon_template) }}
          {{"," if icon_template}} "text": " {{text_detail}} ", 
          "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 details2
  app_icon: calendarsmall
  additional_conditions: []

Wild guess: that calendar has no events

Unfortunately it is full of events every day :joy:

In the trace above it collects all of the events. If I change the text_detail variable to just be some random text it all works. So it’s definitely something falling over there … just so frustrating.

It’s almost like the {{cal_evt}} just doesn’t get pulled