Hey,
So I’m trying to simply create a To-Do the day before our Garbage is due to go out. I have a calendar that has the upcoming Garbage days and the types of collection:
My goal is to create a To-Do List Item the day before the event. I’d like to include a due date and have the Pickup Types in the collection.
service: calendar.get_events
metadata: {}
data:
start_date_time: "{{ as_timestamp(now()) | timestamp_custom(\"%Y-%m-%d\") }}"
end_date_time: "{{ as_timestamp(now()) | timestamp_custom(\"%Y-%m-%d\") }}"
target:
entity_id: calendar.recollect_waste
response_variable: Type
service: todo.add_item
metadata: {}
data:
item: Take out the Garbage
due_date: "{{ as_timestamp(now()) | timestamp_custom(\"%Y-%m-%d\") }}"
description: "{{Type}}"
target:
entity_id: todo.chores
The above works, mostly. Except I get a long string in the description:
{‘calendar.recollect_waste’: {‘events’: [{‘start’: ‘2024-01-17’, ‘end’: ‘2024-01-18’, ‘summary’: ‘ReCollect Waste Pickup’, ‘description’: ‘Pickup types: Garbage cart, Recycling’, ‘location’: ‘Edmonton’}, {‘start’: ‘2024-01-22’, ‘end’: ‘2024-01-23’, ‘summary’: ‘ReCollect Waste Pickup’, ‘description’: ‘Pickup types: Christmas tree collection begins’, ‘location’: ‘Edmonton’}, {‘start’: ‘2024-01-24’, ‘end’: ‘2024-01-25’, ‘summary’: ‘ReCollect Waste Pickup’, ‘description’: ‘Pickup types: Food scraps cart, Recycling’, ‘location’: ‘Edmonton’}, {‘start’: ‘2024-01-31’, ‘end’: ‘2024-02-01’, ‘summary’: ‘ReCollect Waste Pickup’, ‘description’: ‘Pickup types: Garbage cart, Recycling’, ‘location’: ‘Edmonton’}, {‘start’: ‘2024-02-07’, ‘end’: ‘2024-02-08’, ‘summary’: ‘ReCollect Waste Pickup’, ‘description’: ‘Pickup types: Food scraps cart, Recycling’, ‘location’: ‘Edmonton’}, {‘start’: ‘2024-02-14’, ‘end’: ‘2024-02-15’, ‘summary’: ‘ReCollect Waste Pickup’, ‘description’: ‘Pickup types: Garbage cart, Recycling’, ‘location’: ‘Edmonton’}]}}
So, I’m close, but I can’t figure out how to just have the description field taken out of the calendar. Also, I can’t figure out why I’m getting more events returning than I asked for?
Finally, I might have to tweak this, because I want to run this on the day before the event turns on.