Hello Everybody,
I’m new to Home-Assistant and started to learn automations.
I want to track my homeoffice activity with a complete google-calendar entry, day after day. I ping my work notebook for this. The calendar integration works so far, but I need help with the end time. Currently only a new calendar entry is created for a period of 5 minutes, but i want a complete calendar entry as soon as the notebook goes online and ended when the notebook is offline. Can somebody help me with it?
Thats the part in my configuration.yaml
binary_sensor:
- platform: ping
host: 192.168.x.x
name: "PING"
count: 2
scan_interval: 30
Thats the part in my automation.yaml
- id: 'xxxx'
alias: create a google calendar event when the notebook is online
trigger:
- platform: state
entity_id: binary_sensor.ping
to: 'on'
action:
- service: google.add_event
data:
calendar_id: xxxx
summary: Homeoffice
data_template:
start_date_time: "{{ now().timestamp() | timestamp_custom('%Y-%m-%d %H:%M:%S', true)}}"
end_date_time: "{{ (now().timestamp() + 300) | timestamp_custom('%Y-%m-%d %H:%M:%S', true)}}"