[Sloved] How to save Entering and leaving a Zone "Work" as Google Sheet entry

How to save Entering and leaving a Zone “Work” as Google Sheet entry

Like so

28.06.2021 Work 08:15:23 16:18:20

Create a Google calender entry is too ok

As an example you can configure an automation trigger to activate when a device leaves a zone as follows (entering a zone would be simillar):

  trigger:
  - platform: device
    domain: device_tracker
    entity_id: device_tracker.your_device_here
    type: leaves
    zone: zone.your_zone_name_here

To write a message to a text file first setup a notify group such as:

- name: zone_log
  platform: file
  filename: /config/www/zone_logs/zone_log.csv
  timestamp: false

Then in your automation you can write a message to the log file like this:

  action:
  - service: notify.zone_log
    data:
      message: '{{ insert your message here }} '

For Google Calender you could play around with the add-event service in Developer Tools and when you get this working as you like transfer this to an automation action.

Hopefully that gives you something to think about …

Hello, the imporant is i need enter and leave time in llog and this per day entry

I believe the CSV solution Mark posted will be a good fit for you.

The Problem i dont known how wrote end and start date

{{ now() }}

But this is only start time

Need A Script thats Worte

Date start time end time

10.11.2021 16:30:20 18:20:22
11.11.2021 12:24:32 22:24:35
12.11.2021 07:35:35 21:24:35

this fomrat for one zone

How is it supposed to know the end time when the end time has not been yet?

Will it really matter if the format is spread on two lines?

10.11.2021 16:30:20
10.11.2021 18:20:22

11.11.2021 12:24:32
11.11.2021 22:24:35

12.11.2021 07:35:35
12.11.2021 21:24:35

Yes this will Help me thx for the Idea

Did you can wrote a Sample Script

What Mark wrote is more or less what you need.

The message could be "Enter: {{ now() }}" or "Leave: "
That way you can easily split on ": " in Excel to get the dates separated.

Now() can also be replaced with {{ now().timestamp() | timestamp_custom("%Y-%m-%d %H:%M")}} to better suit Excel format.