I was looking for a template that would show the next 50 days worth of events using the new service call return ability from my internal birthday calendar, and the next 50 days worth of events from my anniversary calendar. Format and show these events in a markdown card(s) in lovelace.
Most of this was generated by the UI, but here is the YAML for brevity. Hopefully this shortcuts your project needs! It is an automation that runs 3:00 am and fills two text helpers (BirthList and AnnList).
alias: Birthday Text
description: Build the birthday text to list next 6 weeks of BD
trigger:
- platform: time
at: "03:00:00"
condition: []
action:
- service: calendar.list_events
data:
duration:
hours: 1200
minutes: 0
seconds: 0
target:
entity_id: calendar.birthdays
response_variable: BirthCal
- service: input_text.set_value
data_template:
value: >-
{% for event in BirthCal.events %}{{event.start[5:]}} {{ event.summary
}}{{'\n'}} {% endfor %}
target:
entity_id: input_text.birthlist
- service: calendar.list_events
data:
duration:
hours: 1200
minutes: 0
seconds: 0
target:
entity_id: calendar.anniversary
response_variable: AnnCal
- service: input_text.set_value
data_template:
value: >-
{% for event in AnnCal.events %}{{event.start[5:]}} {{ event.summary
}}{{'\n'}} {% endfor %}
target:
entity_id: input_text.annlist
mode: single
Sorry, just saw this: I am not seeing where your template is⌠my whole script is in an automation. I have since done a minor change in that I am now feeding just one text helper that can then display in a card. doing and âedit yamlâ in the automation yeilds this:
alias: Birthday Text
description: Build the birthday text to list next 6 weeks of BD
trigger:
- platform: time
at: "03:00:00"
condition: []
action:
- service: calendar.list_events
data:
duration:
hours: 1200
minutes: 0
seconds: 0
target:
entity_id: calendar.birthdays
response_variable: BirthCal
- service: input_text.set_value
data_template:
value: >-
{% for event in BirthCal.events %}{{event.start[5:]}} {{ event.summary
}}{{'\n'}} {% endfor %}
target:
entity_id: input_text.birthlist
- service: calendar.list_events
data:
duration:
hours: 1200
minutes: 0
seconds: 0
target:
entity_id: calendar.anniversary
response_variable: AnnCal
- service: input_text.set_value
data_template:
value: >-
{% for event in AnnCal.events %}{{event.start[5:]}} {{ event.summary
}}{{'\n'}} {% endfor %}
target:
entity_id: input_text.annlist
- service: ""
data: {}
mode: single
This is the same automation, using the new Calendar service: outputs to two text helpers that I display on the first page of lovelace to remind me of anniversaries and birthdays for the next 60 days.
Iâm trying to implement your automation but instead of displaying the events title (or summary) Iâd like to show the description field of the event.
Trying to adjust the {{event.summary }} bit of the script to {{event.description }} gives back a âunknownâ value to the text input.
Any ideas what Iâm doing wrong?
EDIT: Iâm already using your new automation with the new calendar service.
EDIT 2: figured out that my description is longer than 255 characters so the text helper cannot save it as character limit on all entity states is 255.
How do you get properly formatted date in markdown card? I made exact copy/paste of configuration to create list of my garbage collection and using jsut {{states('input_text.bio')}} I got just timestamps, instead of properly formatted dates:
04-17T00:00:00+02:00: Bio
05-02T00:00:00+02:00: Bio
04-26T00:15:00+02:00: Paper
04-12T00:15:00+02:00: Plastic
04-24T00:15:00+02:00: Glass
04-05T00:15:00+02:00: Mixed
04-19T00:15:00+02:00: Mixed
05-03T00:15:00+02:00: Mixed
I found the text helper is limited to 255 characters. so I limited the number of days ahead from 60 to 35 to accommodate periods of âintenseâ birthdays⌠Another way to accommodate would be to have a text helper for each smaller period (a week, a month) and show them together in Lovelace