Numeric variable query in IFTTT

Here’s an example to use a query with numeric variables, that is, numeric information that is stored in Apilio. We’ll turn the foyer lights on only when it’s dark. We’ll use two applets. The first one stores the brightness levels with a sensor. The second one contains the filter code that checks this brightness before proceeding with the action to turn the light on.

Example 2: Turn on my foyer lights based on outside brightness

Applet 1: (regular applet)

  • Sensor for brightness
  • update a numeric variable in Apilio

Applet 2 (with query and filter code)

The lux value that I’m using as a threshold might be different in your case, do your own testing :slight_smile:

  • If I connect to the WIFI
    • Trigger service: android device
    • Trigger: device connects to specific WIFI
  • And only if the brightness level is below 50 Lux
    • Query service: Apilio
    • Query: History of numeric variable ‘brightness’
  • Filter code: Only turn off the foyer lights if ‘brightness’ <= 50 Lux , else skip the action
let brightness = Apilio.numericVariableHistory[0].Value;
if (+brightness >= 50){
Hue.turnOnAllHue.skip('It's too bright to turn the lights on);
}
  • Then turn on the foyer lights
    • Action service: any smart light service that works with IFTTT
    • Action: turn on (in the filter code, we’ve used Hue as the example service)