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.

3 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