Using Google Calendar events to run specific logic

If you like keeping your schedule organised in Google Calendar, you might like orchestrating some smart logic that only runs when specific events happen.

Some examples I could think of and that some members have automated are:

  • (the example below) Run a different morning routine on those days when you need to wake up earlier than usual
  • Deactivate your home alarm automatically over a specific period of time when you have someone scheduled to come to your home
  • Email your not-that-young-kids (or perhaps turn on their room light a pretty shade of green first thing in the morning…) a personal reminder when it’s their turn to take out the recycling
  • Adjust your thermostat or AC based on when someone is going to be at home
  • Automate sending specific emails or notifications, add a row to that favourite spreadsheet of yours, turn on party lights or play fanfare music when it’s payday

Photo by Elena Kloppenburg on Unsplash

Our example: setup a specific morning routine based on a Google Calendar event

In this example I’ve used Google Calendar: I’m afraid this is the only calendar integrated with IFTTT that offers a trigger that fires when a specific event starts in your calendar, but it works well for our purposes.

I’ve kept it simple for my example, use it as your inspiration or leave a comment below and we’ll figure out together what you need to setup :wink:

In my automation,when I have “Anna is working today” as a day-event in my calendar, I want to:

  • turn on my corridor lights
  • turn on my living room lights
  • 10 minutes later, turn all lights off

I wake up at a specific time when I’m working that day, and I want my house to be minimally illuminated as I make my way to the kettle to start the morning well.

Setup your conditions

My Logicblock will use two conditions: it will check if it’s a day when it’s OK to run this special logic, and it will check that it is the time when I want to run it.

Condition 1: Apilio should run this Logicblock today

To check if today is one of those special days when this logic should run, I will use a boolean variable to store a yes/no: “yes”, today is a day to run this Logicblock (that means, I am working on this day).

I have a boolean variable “anna_is_working_today” that gets checked with a condition to see if it’s true:

To update this variable, this is the Google Calendar applet you need to set up:

And this is what it looks like:

The event in my calendar is called “Anna is working today”.

Condition 2: my trigger - start my logic right at this time of the day

In my case, I wake up at the same time on my working days, so I want my logic to start at 7AM. This is a simple time event condition:

Define your Logicblock: choose conditions and actions

My logic will control some of the smart light bulbs at home, so my Logicblock will use both Conditions we just set up:

And then as actions, we’ll turn on a light bulb, then, 10 minutes later, we’ll turn it off.

If you have a Smart Life (Tuya) light bulb, you can control them directly from Apilio. For other brands, have a look at our list of available ready-made applets to find the brand of your particular light bulb: IFTTT + Apilio applet templates: expanding list with links

All set!

Now when I wake up early on the days that I’m working, as soon as I leave my bedroom the lights in the corridor and the living room are on, so I can easily find my way in the morning :yawning_face: :tea:

3 Likes

great article, thanks @Anna!

1 Like