How to update a boolean variable via IFTTT

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.

:slightly_smiling_face: 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:

  1. In Apilio, create a boolean variable called “at_home” and set it to true (I’m currently at home when setting this up):

image

We are going to first setup an applet to make this Variable true whenever your phone connects to your WiFi.

  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 Android Device channel, and the action “Connects to a specific WiFi network”

image

  1. 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

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

image
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:

image

You now have a Variable you can use in a Condition that can be used in a Logicblock :star_struck:

:bulb: Related articles

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

Also check:

2 Likes

I’ve created a Boolean variable, but am not seeing the ‘Set True’, ‘Set False’, or ‘Toggle’. I must be missing a step but can’t figure it out.
Here is what I see

ing

Current value: false

Last update: Today, 09:34:24

Use one of the following actions on the IFTTT Apilio Service to update a boolean variable:

  • Update a variable in Apilio to true
  • Update a variable in Apilio to false
  • Toggle a boolean variable on Apilio

Hi @ptngan, welcome to the Community! I’ve moved your question here as it is relevant to this topic :slight_smile:

You will find the “set true” “set false” and “toggle” actions in IFTTT:

  1. Connect the Apilio channel: https://ifttt.com/apilio
  2. Create an new applet: https://ifttt.com/create
  3. Choose as the “if this” the device or service that is sending the information to Apilio.
  4. Choose as the “then that” the Apilio channel and then you’ll find the actions there

:slight_smile: Let me know if this helps, thank you

2 Likes

Anna, thanks for the quick reply I think I understand now, I was trying to create a webhook, but I think now I can link ifttt and apilio with the Apilio service. Will do more investigation and try it out.

Thanks for your help.

2 Likes

Happy to help! We are natively integrated with IFTTT, so you can use the Apilio channel and not Webhooks :slight_smile: Let us know how you are getting on with your setup.

Got it working, thanks for all your help. Great community.

3 Likes

Thank you, we appreciate the feedback :bowing_man:

1 Like