Apilio is natively integrated with IFTTT so you can combine almost 700 different brands of devices and services in your home routines. Apilio is a fantastic complement for IFTTT because you can create routines that combine multiple conditions, actions and delays.
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.
Why do we need Variables?
To allow you to use your devices with Apilio and build Conditions that use those devices, IFTTT can send event information over to Apilio, like a light bulb being turned on, or the temperature being over 25ºC. Apilio will then store this information about your devices in its “memory” in the form of Variables.
The simplest Variable is our Boolean Variable, which is what we use to store information that can be true/false, yes/no, on/off… that means, it’s great to store the status of a myriad of devices like light bulbs, if you are in a location or not, if the power is on or not, etc.
Boolean Variables: store yes/no, on/off information
Examples of a Boolean Variable are:
- ‘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.
3 IFTTT actions to update 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 “at_home” variable from scratch
We want to create a Variable called “at_home” that is set to true when your phone connects to your home wifi, and it set to false when your phone disconnects. This is great for energy-saving automations that should only run when you are home, or for home security routines when you are away. Follow the steps to set this variable up in Apilio:
- In Apilio, create a boolean variable called “at_home” and set it to true (I’m currently at home when setting this up):
We are going to first setup an applet to make this Variable true whenever your phone connects to your WiFi.
- Go to IFTTT now and select “create” to start building your own applet (https://ifttt.com/create).
- For the “If this” part, select the Android Device channel, and the action “Connects to a specific WiFi network”
- For the “then that” part, select the Apilio service, and “Update a variable in Apilio to true” as your action, and then your “at_home” Variable
- Review and click complete to finish setting up your applet, you are done!
6. To update the variable to false when you leave home, use the trigger in the Android Device channel when the phone disconnects from the WiFi, and the action to update the variable to false:
You now have a Variable you can use in a Condition that can be used in a Logicblock
Have a look at these examples with the other types of variables: