Updating boolean variables via IFTTT

variables
ifttt
Updating boolean variables via IFTTT
0

#1

Apilio is a fantastic complement for IFTTT because it allows you to store states in variables that you can use to create complex conditionals and run multiple actions, with no additional coding. For example, you could have your kitchen light turn on automatically when you arrive, but only if you are the first one home and it is nighttime already.

Boolean variables

These variables are also known as “true/false” or “on/off”, and are usually the extra bit of logic you will need for your automation. Examples of a boolean variable are:

  • ‘nighttime’: this variable turns “true” at sunset and “false” at sunrise.
  • ‘abbie_is_home’, ‘bob_is_home’: these variables can be for example turn true when Abbie or Bob connect to their home WiFi, or maybe when they enter a particular area. They would then turn false when the person is no longer connected to the relevant WiFi network.
  • ‘kitty_is_home’: this variable is toggled every time your cat leaves the house, for example when we detect that a SmartTag is in or out of range.
  • ‘no_bookings’: this variable is set to true if for example you don’t have any AirBnB bookings that day
  • ‘at_work’: this variable turns true when you check in at your workplace in the morning, or instead you could check when you enter a particular area.
  • ‘working_hours’: this variable it set to “true” at 9AM every day and set to “false” at 5PM.

3 options to manage your boolean variables

With IFTTT, you can use the following two actions when creating your own applet from scratch:

  • Update a boolean variable to true
  • Update a boolean variable to false
  • Toggle a boolean variable. This means, if the variable was true then make it false. And if it was false, then make it true.

Let’s have a look at a more detailed example.

Setting up the ‘nighttime’ variable from scratch

We want to have a variable called ‘nighttime’ that is set to true at sunset and set to false at sunrise. Follow the steps to set this variable up in Apilio:

  1. In Apilio, create a boolean variable called ‘nighttime’, and set it to false (if it is currently daytime!):

  1. Go to IFTTT now and select “create” to start building your own applet (https://ifttt.com/create).

  1. For the “If this” part, select the Weather Underground service, and Sunset as your trigger.

  1. For the “then that” part, select the Apilio service, and “Update a variable in Apilio to true” as your action, and then your ‘nighttime’ variable


  1. Review and click complete to finish setting up your applet, you are done!

  1. To update the variable to false in the mornings, create a new applet just like this one but as your trigger choose the Sunrise trigger from Weather Underground and as your action, choose “Update a variable in Apilio to false”

You now have a variable you can use in a conditional that can be used in a logicblock.

:bulb: Do you want to learn more?

Have a look at these examples with the other types of variables:

Also check:


Evaluating logicblocks and triggering actions with IFTTT
Update string variables via IFTTT
Getting started with Apilio and IFTTT
unlisted #2

How to migrate your logicblocks to the new IFTTT integration
listed #3