Automation with calendar.get_events doesn't work - help needed!

Hello together,

I’m trying to get my Calendar events and to push them into a helper entity.

That was my approach

alias: Calender test
description: ""
triggers:
  - trigger: time_pattern
    hours: "1"
    minutes: "1"
    seconds: "1"
actions:
  - action: calendar.get_events
    metadata: {}
    data:
      start_date_time: "2025-02-01 00:00:00"
      end_date_time: "2025-02-19 00:00:00"
    response_variable: agenda
    target:
      entity_id: calendar.family_2
  - action: input_text.set_value
    data:
      value: >-
        {% for event in agenda["calendar.family_2"]["events"] %}  
        {{event.start}}:{{ event.summary }}  {% endfor %}
    target:
      entity_id: input_text.kalender_xyz

I tried to fire the automation and I’m getting trace data, which seems to be looking fine:


But when I look into the entities, the Developer tools the state is unknow:

That’s the helper I defined:

I tried to do the same with Nodered, but same result…

What am I missing?

I would suspect the value you are attempting to set is too long. An input_text can hold an absolute maximum of 255 characters, and if you did not increase the limit when creating the text helper the default is only 100 characters max.

Edit: Somehow your screenshot appears to say 500 characters max, but that would be impossible. Most likely this value gets reset to something else when the dialog is closed, or it makes the configuration invalid and the helper non-functional…

1 Like

That realy was it!

As soon as the value has more then max (244) characters, the state becomes unknown…

Thank you very much!

If you want to store more data, you could use an input_select with one option for each calendar entry. Or use this nifty template entity sensor trick for storing global variables:

2 Likes

Okay, thank you! First I’ve to make the next step to figure out, how much I really need… :wink: