Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Created February 1, 2024 04:04
Show Gist options
  • Save Didgeridrew/720cf341022e490bd26a7566cad7f634 to your computer and use it in GitHub Desktop.
Save Didgeridrew/720cf341022e490bd26a7566cad7f634 to your computer and use it in GitHub Desktop.
HA - Iterate over calendar events and add to Shopping list
alias: Calendar Events to Shopping List items
sequence:
- service: calendar.get_events
data:
duration:
hours: 24
minutes: 0
seconds: 0
target:
entity_id: calendar.home_assistant_events
response_variable: calendartasks
- repeat:
for_each: "{{ calendartasks[\"calendar.home_assistant_events\"].events }}"
sequence:
- service: shopping_list.add_item
data:
name: >-
{{ repeat.item.summary }}
{{(repeat.item.start|as_datetime).strftime('%H:%M')}} -
{{(repeat.item.end|as_datetime).strftime('%H:%M')}}
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment