Add Google Calendar Event based on input_boolean

Hey everyone,

Hoping I can get some advise with an automation I would like to setup, I have a input_boolean I’m using to track my working hours. E.g when I walk into my office building an automation turns an at work input_boolean to ‘on’ that I use to track the hours.

I’ve been used history_stats with the input_boolean for my work day hours and work week. I also use it for when I’m working from home by just turning ‘on’ the input_boolean when my day starts and turning it off when I’m done / taking lunch.

I would really like to setup an automation to add a calendar event to a google calendar when the input_boolean goes from ‘on’ to ‘off’ state with an event with a start time of when the input_boolean went to on and an end time of the off event.

So I can use it to help record work hours over the long term.

adding a calendar event doesn’t seem to be too hard but I do far haven’t been able to find a way to get the last time the input_boolean was ‘on’

if anyone happens to know a way to get the last on time on an input_boolean that would really help me out.


You’re basically asking the same question as this post from a couple days ago The only reliable way to have the start time and end time available to create a calendar event is to save them to a pair of helpers.

Another option is to use the new Google sheets integration to log your times.

1 Like

thanks @Didgeridrew I ended up working it out with your message.

I already had automation’s setup for when the imput_boolean was set to on or off, I was able to add a imput_text helper in to the imput_boolean on automation that just outputs the date and time using “{{ now().strftime(”%Y-%m-%d %H:%M") }}"

then on the imput_boolean off automation I’ve added an action that makes the google calendar event using the imput_text and the time now.