muenze96
(Sebastian Meinke)
September 1, 2023, 12:52pm
1
I have an automation that triggers 24h before an appointment and should create another appointment that ends 4.5h earlier than the triggered appointment.
I use the Google Calendar integration.
I managed to create an appointment on the same day as the triggering appointment, but only full day…
service: google.create_event
data:
summary: Blocker
in:
days: 1
target:
entity_id: calendar.arbeit_blocker
I tried this, but it doesn`t work because the templates are always overwritten when the automation is saved…
- service: google.create_event
data:
start_date_time: {{ trigger.calendar_event.start }}
end_date_time: {{ trigger.calendar_event.end }} - 04:30:00
target:
entity_id: calendar.arbeit_blocker
It is overwritten because your templates are invalid.
- service: google.create_event
data:
summary: Blocker
start_date_time: "{{ trigger.calendar_event.start }}"
end_date_time: "{{ trigger.calendar_event.end|as_datetime - timedelta(hours=4.5)}}"
target:
entity_id: calendar.arbeit_blocker
1 Like
muenze96
(Sebastian Meinke)
September 7, 2023, 5:19am
3
This code results in the following error:
Error rendering data template: TypeError: unsupported operand type(s) for -: ‘str’ and ‘datetime.timedelta’
Are all these events longer than 4.5 hours? If not, you’re going to get failures unless you modify the start time as well.
muenze96
(Sebastian Meinke)
September 7, 2023, 2:15pm
5
All these events from which the new events are to be created are all-day events!
muenze96
(Sebastian Meinke)
September 7, 2023, 3:11pm
6
Apparently I have made a copy paste error! Have the whole thing now entered again on the PC and it works perfectly. Thank you!
1 Like