Register office hours in calender

I’m trying to automatically register office hours in a local or Google calendar.
This is the automation I created:

description: ""
mode: single
trigger:
  - platform: zone
    entity_id: person.employee
    zone: office
    event: leave
    alias: When worker leaves the office
condition: []
action:
  - service: google.add_event
    data:
      calendar_id: calendar.working_hours
      description: Left office
alias: Working hours

I cannot find out how to create the event at the current date and time.
Any suggestions?

Use a template for the start and end time variables.

action:
  - service: google.add_event
    data:
      calendar_id: calendar.working_hours
      description: Left office
      start_date_time: "{{ now() }}"
      end_date_time: "{{ now() }}"

Thanks, I’m gonna try that. Unfortunately the phone battery was empty when leaving the office :grinning:
I’l wait until tomorrow and see if it works

One way or the other it wouldn’t register anything in the agenda. I went another route though. It registers the times in Google sheets now. Since I wanted it to have in a spreadsheet anyway it was smarter to feed it directly there. It is working great that way