Having Issues with Blueprint for Awtrix Light

I have the following blueprint which is supposed to take the events from my calendar entity Events Calender which i know is misspelled, i plan to fix that later

Here Is the Blueprint:



blueprint:
  name: Awtrix List Calendar
  description: Shows all upcoming daily calender entries
  domain: automation
  author: Smart Home Junkie
  input:
    awtrix_displays:
      name: Awtrix Displays
      description: Select the target Awtrix displays.
      selector:
        device:
          integration: mqtt
          model: "AWTRIX Light"
          manufacturer: Blueforcer
          multiple: true
    toggle_helper:
      name: Toggle Helper
      description: Select the Toggle Helper that will toggle the App on or off.
      selector:
        entity:
          domain: input_boolean
    my_calendar:
      name: Calendar
      description: Select the calendar for which you want to show the state on the Ulanzi clock. The app value will change when the value of this calendar changes.
      selector:
        entity:
          domain: calendar
    hours_ahead:
      name: Hours ahead
      description: How many hours in advance should agenda items be shown? (default 24).
      default: "24"
    show_timeline:
      name: Show Timeline?
      description: Do you want to cycle the whole timeline for the upcoming hours?
      selector:
        boolean:
      default: true
    show_whole_day_events:
      name: Show Whole Day Events?
      description: Do you want to show events that last the whole day?
      selector:
        boolean:
      default: true
    show_alerts:
      name: Show Alerts?
      description: Do you want to show an alert when the calendar event starts?
      selector:
        boolean:
      default: true
    # offset:
    #   name: Minutes Before
    #   description: How many minutes before the event starts should the alert be shown?
    #   default: 15
    play_alert_tone:
      name: Play Alert Tone
      description: Should an alert tone be played 15 minutes before the event starts?
      selector:
        boolean:
      default: false
    stack:
      name: Stack Notification?
      description: Defines if the notification will be stacked. "Off" will immediately replace the current notification.
      selector:
        boolean:
      default: true
    my_icon:
      name: Icon
      description: Enter the Icon Name or ID of the icon that you like to show.
      selector:
        text:
      default: ""
    push_icon:
      name: Push Icon
      description: Icon behavior
      selector:
        select:
          options:
            - label: "Icon doesn't move"
              value: "0"
            - label: "Icon moves with text and will not appear again"
              value: "1"
            - label: "Icon moves with text but appears again when the text starts"
              value: "2"
          mode: dropdown
      default: "2"
    my_text:
      name: Custom Text
      description: Text to show when there are no upcoming calendar events.
      selector:
        text:
      default: "Yay! You have no appointments!"
    show_empty_calendar:
      name: Show Empty Calendar
      description: Show the custom text when there are no events. If set to false, the calendar will not show when there are no events after the lifetime has ended. This might take a minute or two to take effect.
      selector:
        boolean:
      default: true
    prefix:
      name: Prefix
      description: Enter an optional prefix text. For instance, show the Calendar name if you use multiple calendars in front of the list of events.
      selector:
        text:
      default: ""
    today_text:
      name: Today Text
      description: Text to show for events that occur today.
      selector:
        text:
      default: ""
    tomorrow_text:
      name: Tomorrow Text
      description: Text to show for events that occur tomorrow.
      selector:
        text:
      default: ""
    text_case:
      name: Text Case
      description: Select how you would like your text to display.
      selector:
        select:
          options:
            - label: "Use global setting"
              value: "0"
            - label: "Force Uppercase"
              value: "1"
            - label: "Show as you entered it"
              value: "2"
          mode: dropdown
      default: "0"
    background_color:
      name: Background Color
      description: Select the Background color
      selector:
        color_rgb:
      default: [0, 0, 0]
    text_color:
      name: Text Color
      description: Select the Text color
      selector:
        color_rgb:
      default: [255, 255, 255]
    show_rainbow:
      name: Rainbow Colors
      description: Should the notification be shown in Rainbow colors?
      selector:
        boolean:
      default: false
    repeat:
      name: Repeat
      description: Sets how many times the text should be scrolled through the matrix before the app ends. If the value is -1, the duration will be taken into account instead.
      default: "-1"
    duration:
      name: Duration (in seconds)
      description: Sets how long the app should be displayed. 0 is global app time.
      default: "0"
    lifetime:
      name: Lifetime (in seconds)
      description: Sets how long the app should stay alive before it gets removed from the app cycle automatically. 0 is infinite lifetime.
      default: "0"
    switch_to_app:
      name: Switch to app on value change
      description: Should the clock switch to the app immediately when the value of the calendar changes? BEWARE! Setting this to On for a calendar that changes very frequently might flood your clock with MQTT messages and might cause reboots of the clock!
      selector:
        boolean:
      default: false
    scroll:
      name: Scroll the notification?
      description: Enables text scrolling
      selector:
        boolean:
      default: true
    scrollspeed:
      name: Scroll Speed Percentage
      description: Modifies the scrollspeed. You need to enter a percentage value.
      selector:
        number:
          mode: slider
          min: 0
          max: 100
      default: 100
    effect:
      name: Effect
      description: Select a background effect (optional).
      selector:
        select:
          options:
            - label: "None"
              value: ""
            - label: "BrickBreaker"
              value: "BrickBreaker"
            - label: "Checkerboard"
              value: "Checkerboard"
            - label: "ColorWaves"
              value: "ColorWaves"
            - label: "Fireworks"
              value: "Fireworks"
            - label: "LookingEyes"
              value: "LookingEyes"
            - label: "Matrix"
              value: "Matrix"
            - label: "MovingLine"
              value: "MovingLine"
            - label: "PingPong"
              value: "PingPong"
            - label: "Pacifica"
              value: "Pacifica"
            - label: "Plasma"
              value: "Plasma"
            - label: "PlasmaCloud"
              value: "PlasmaCloud"
            - label: "Radar"
              value: "Radar"
            - label: "Ripple"
              value: "Ripple"
            - label: "Snake"
              value: "Snake"
            - label: "SwirlIn"
              value: "SwirlIn"
            - label: "SwirlOut"
              value: "SwirlOut"
            - label: "TheaterChase"
              value: "TheaterChase"
            - label: "TwinklingStars"
              value: "TwinklingStars"
      default: ""

mode: queued

trigger:
  - platform: state
    entity_id: !input toggle_helper
    to: "on"
    id: "On"
  - platform: state
    entity_id: !input toggle_helper
    to: "off"
    id: "Off"
  - platform: time_pattern
    minutes: "/1"
    id: "Changes"
  - platform: calendar
    event: start
    offset: "-0:15:0"
    entity_id: !input my_calendar
    id: "Calendar_Event_Trigger"

# offset should be variable in the future. This is not possible to create in blueprints atm

variables:
  device_ids: !input awtrix_displays
  devices: >-
    {% macro get_device(device_id) %}
      {{ states((device_entities(device_id) | select('search','device_topic') | list)[0] | default('unknown')) }}
    {% endmacro %}

    {% set ns = namespace(devices=[]) %}
    {% for device_id in device_ids %}
      {% set device=get_device(device_id)|replace(' ','')|replace('\n','') %}
      {% set ns.devices = ns.devices + [ device ] %}
    {% endfor %}
    {{ ns.devices | reject('match','unavailable|unknown') | list }}
  my_icon: !input my_icon
  push_icon: !input push_icon
  my_calendar: !input my_calendar
  my_hours_ahead: !input hours_ahead
  my_show_timeline: !input show_timeline
  my_show_whole_day_events: !input show_whole_day_events
  #  my_show_whole_day_events: true
  my_show_alerts: !input show_alerts
  play_alert_tone: !input play_alert_tone
  background_color: !input background_color
  text_color: !input text_color
  text_case: !input text_case
  show_rainbow: !input show_rainbow
  my_toggle_helper: toggle_helper
  app_name: >-
    {{ my_calendar | trim }}
  my_repeat: !input repeat
  my_duration: !input duration
  my_lifetime: !input lifetime
  switch_to_app: !input switch_to_app
  scrolling: !input scroll
  scroll_speed: !input scrollspeed
  effect: !input effect
  stack: !input stack
  my_text: !input my_text
  my_today: !input today_text
  my_tomorrow: !input tomorrow_text
  my_prefix: !input prefix
  my_show_empty_calendar: !input show_empty_calendar

action:
  - service: calendar.get_events
    data:
      start_date_time: "{{ now() }}"
      end_date_time: "{{ now() + timedelta(hours=my_hours_ahead | int) }}"
    target:
      entity_id: !input my_calendar
    response_variable: agenda
  - choose:
      - conditions:
          - condition: trigger
            id: "On"
          - condition: template
            value_template: "{{ my_show_timeline == true }}"
          - condition: or
            conditions:
              - condition: template
                value_template: "{{ agenda[my_calendar].events | length > 0 }}"
              - condition: template
                value_template: "{{ agenda[my_calendar].events | length <= 0 and my_show_empty_calendar == true }}"
        sequence:
          - repeat:
              for_each: "{{ devices }}"
              sequence:
                - service: mqtt.publish
                  data:
                    qos: 0
                    retain: false
                    topic: "{{repeat.item}}/custom/{{app_name}}"
                    payload: |-
                      {   
                        "text": "{% if my_prefix != '' %}{{ my_prefix }} {% endif %}{% set ns = namespace(today_prefix_shown = false, tomorrow_prefix_shown = false) %}{% if agenda[my_calendar] is not none and (agenda[my_calendar].events | length) > 0 %}{% for event in agenda[my_calendar].events if as_timestamp(event.start) | timestamp_custom('%Y-%m-%d') <= as_timestamp(now()) | timestamp_custom('%Y-%m-%d') %}{% if not ns.today_prefix_shown and my_today != '' %}{{ my_today }} {% set ns.today_prefix_shown = true %}{% endif %}{% if as_timestamp(event.end) > as_timestamp(now()) %}{% if as_timestamp(event.start) | timestamp_custom('%H:%M') == '00:00' %}{% if my_show_whole_day_events == true %}{{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% else %}{{ as_timestamp(event.start) | timestamp_custom('%H:%M')}} {{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% endif %}{% endfor %}{% for event in agenda[my_calendar].events if (as_timestamp(event.start) | timestamp_custom('%Y-%m-%d') > as_timestamp(now()) | timestamp_custom('%Y-%m-%d') or as_timestamp(event.end) | timestamp_custom('%Y-%m-%d') > as_timestamp(now()) | timestamp_custom('%Y-%m-%d')) %}{% if not ns.tomorrow_prefix_shown and my_tomorrow != '' %} // {{ my_tomorrow }} {% set ns.tomorrow_prefix_shown = true %}{% endif %}{% if as_timestamp(event.end) > as_timestamp(now()) %}{% if as_timestamp(event.start) | timestamp_custom('%H:%M') == '00:00' %}{% if my_show_whole_day_events == true %}{{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% else %}{{ as_timestamp(event.start) | timestamp_custom('%H:%M')}} {{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% endif %}{% endfor %}{% else %}{{my_text}}{% endif %}",
                        "background": {{ background_color }},
                        "color": {{text_color}},
                        "icon": "{{my_icon}}",
                        "textCase": {{ text_case }},
                        "pushIcon": {{ push_icon }},
                        "rainbow": {{ iif(show_rainbow, "true", "false") }},
                        "repeat": {{ my_repeat }},
                        "duration": {{ my_duration }},
                        "lifetime": {{ my_lifetime }},
                        "noScroll": {{ iif(scrolling, "false", "true") }},
                        "scrollSpeed": {{ scroll_speed }},
                        "effect": "{{ effect }}"
                      }
                - service: mqtt.publish
                  data:
                    qos: 0
                    retain: false
                    topic: "{{repeat.item}}/switch"
                    payload: |-
                      {   
                        "name": "{{app_name}}"
                      }
      - conditions:
          - condition: trigger
            id: "Calendar_Event_Trigger"
          - condition: template
            value_template: "{{ my_show_alerts == true }}"
        sequence:
          - repeat:
              for_each: "{{ devices }}"
              sequence:
                - service: mqtt.publish
                  data:
                    qos: 0
                    retain: false
                    topic: "{{repeat.item}}/notify"
                    payload: |-
                      {   
                        "text": "Event {{ trigger.calendar_event.summary }} starts at {{ (as_timestamp(trigger.calendar_event.start,true) | timestamp_custom('%H:%M')) }}",                        "background": {{ background_color }},
                        "color": {{text_color}},
                        "icon": "{{my_icon}}",
                        "sound": "{{ iif(play_alert_tone, "alert", "") }}",
                        "textCase": {{ text_case }},
                        "pushIcon": {{ push_icon }},
                        "rainbow": {{ iif(show_rainbow, "true", "false") }},
                        "repeat": {{ my_repeat }},
                        "duration": {{ my_duration }},
                        "stack": {{ iif(stack, "true", "false") }},
                        "noScroll": {{ iif(scrolling, "false", "true") }},
                        "scrollSpeed": {{ scroll_speed }},
                        "effect": "{{ effect }}"
                      }
                - service: mqtt.publish
                  data:
                    qos: 0
                    retain: false
                    topic: "{{repeat.item}}/switch"
                    payload: |-
                      {   
                        "name": "{{app_name}}"
                      }
      - conditions:
          - condition: trigger
            id: "Off"
        sequence:
          - repeat:
              for_each: "{{ devices }}"
              sequence:
                - service: mqtt.publish
                  data:
                    qos: 0
                    retain: false
                    topic: "{{repeat.item}}/custom/{{app_name}}"
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: "Changes"
              - condition: state
                entity_id: !input toggle_helper
                state: "on"
              - condition: template
                value_template: "{{ my_show_timeline == true }}"
              - condition: or
                conditions:
                  - condition: template
                    value_template: "{{ agenda[my_calendar].events | length > 0 }}"
                  - condition: template
                    value_template: "{{ agenda[my_calendar].events | length <= 0 and my_show_empty_calendar == true }}"
        sequence:
          - repeat:
              for_each: "{{ devices }}"
              sequence:
                - service: mqtt.publish
                  data:
                    qos: 0
                    retain: false
                    topic: "{{repeat.item}}/custom/{{app_name}}"
                    payload: |-
                      {   
                        "text": "{% if my_prefix != '' %}{{ my_prefix }} {% endif %}{% set ns = namespace(today_prefix_shown = false, tomorrow_prefix_shown = false) %}{% if agenda[my_calendar] is not none and (agenda[my_calendar].events | length) > 0 %}{% for event in agenda[my_calendar].events if as_timestamp(event.start) | timestamp_custom('%Y-%m-%d') <= as_timestamp(now()) | timestamp_custom('%Y-%m-%d') %}{% if not ns.today_prefix_shown and my_today != '' %}{{ my_today }} {% set ns.today_prefix_shown = true %}{% endif %}{% if as_timestamp(event.end) > as_timestamp(now()) %}{% if as_timestamp(event.start) | timestamp_custom('%H:%M') == '00:00' %}{% if my_show_whole_day_events == true %}{{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% else %}{{ as_timestamp(event.start) | timestamp_custom('%H:%M')}} {{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% endif %}{% endfor %}{% for event in agenda[my_calendar].events if (as_timestamp(event.start) | timestamp_custom('%Y-%m-%d') > as_timestamp(now()) | timestamp_custom('%Y-%m-%d') or as_timestamp(event.end) | timestamp_custom('%Y-%m-%d') > as_timestamp(now()) | timestamp_custom('%Y-%m-%d')) %}{% if not ns.tomorrow_prefix_shown and my_tomorrow != '' %} // {{ my_tomorrow }} {% set ns.tomorrow_prefix_shown = true %}{% endif %}{% if as_timestamp(event.end) > as_timestamp(now()) %}{% if as_timestamp(event.start) | timestamp_custom('%H:%M') == '00:00' %}{% if my_show_whole_day_events == true %}{{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% else %}{{ as_timestamp(event.start) | timestamp_custom('%H:%M')}} {{ event.summary }}{% if not loop.last %} // {% endif %}{% endif %}{% endif %}{% endfor %}{% else %}{{my_text}}{% endif %}",
                        "background": {{ background_color }},
                        "color": {{text_color}},
                        "icon": "{{my_icon}}",
                        "textCase": {{ text_case }},
                        "pushIcon": {{ push_icon }},
                        "rainbow": {{ iif(show_rainbow, "true", "false") }},
                        "repeat": {{ my_repeat }},
                        "duration": {{ my_duration }},
                        "lifetime": {{ my_lifetime }},
                        "noScroll": {{ iif(scrolling, "false", "true") }},
                        "scrollSpeed": {{ scroll_speed }},
                        "effect": "{{ effect }}"
                      }
                - condition: template
                  value_template: "{{ switch_to_app == true }}"
                - service: mqtt.publish
                  data:
                    qos: 0
                    retain: false
                    topic: "{{repeat.item}}/switch"
                    payload: |-
                      {   
                        "name": "{{app_name}}"
                      }

And I created an automation for this blueprint, which generated the following yaml code

alias: Awtrix List Calendar
description: Lists Events for Calendar
use_blueprint:
  path: smarthomejunkie/awtrix_list_calendar.yaml
  input:
    awtrix_displays:
      - 17e4ac7ef929b00f4c5aee92f1824322
    toggle_helper: input_boolean.awtrix_notifiction
    my_calendar: calendar.event_calender
    hours_ahead: "24"
    effect: TwinklingStars
    today_text: "Here's What's Up Today:"
    tomorrow_text: "Hey Tomorrow You Have:"
    text_case: "2"

But despite having multiple entries in my calendar, it always sends the default notification Yay you have no appointments
it I check the attribute in the developer tools, the value always seems to be “null”

Can anyone spot where I am going wrong. I’m at m,y wits end

Hey, your issue likely stems from this section:

service: calendar.get_events
    data:
      start_date_time: "{{ now() }}"
      end_date_time: "{{ now() + timedelta(hours=my_hours_ahead | int) }}"

Checks it’s working properly using developer tool > services > calendar.get_events

service: calendar.get_events
data: 
  start_date_time: "{{ today_at() }}"
  end_date_time: "{{ today_at() + timedelta(hours=24| int) }}"
target:
  entity_id: calendar.my_custom_calendar

For example, the events of today (not same result using now() or today_at()), find what works best for you :upside_down_face:.

Thanks for replying… As it turns out, the calendar I was using was not correctly configured and for some reason would not accept any entries… When I used a different calendar it worked…