Condition to check that a number falls within a range

Hello! This is a very necessary feature that I’m so glad to have finally out there! It has been requested by many of you (see 1, 2, 3, 4, 5…): you’ll now be able to specify a range that your numeric variable must be within (or outside of) for your condition to be true!

How can I use numeric variables that fall within a range?

Let me give you a few examples:

  1. The variable temperature should be between high_temp and low_temp. This way you can monitor if your AC is within good comfort temperatures.
  2. Check if the humidity falls within a comfort range, otherwise you’ll turn on an exhaust fan or turn it off.
  3. Check if today’s UV index falls within a safe range.
  4. Check if the electricity price or CO2 production is between an acceptable range.

How to setup a numeric condition within a range

  1. Go to your conditions section: https://app.apilio.com/conditions

  2. Create a new numeric condition

  3. In the dropdown, select either

    • Inside range between … choose this one if your variable must fall within two parameters.
    • Outside range between … choose this one if your variable must be outside of a closed range for your condition to be true
  4. You’ll be able to then set two variables to specify the boundaries of your range.

Remember that your variables that you are using in your comparison can be just a constant, if you set them to a number upon creation and don’t change them via any external service or Logicblock.

You can also set Tuya condition that falls within a range!

Tuya conditions can be numeric: think about power, voltage, humidity, temperature… all of these are stored as numeric variables. You’ll also be able to use this numeric range for those types of conditions. For example, if you have a smart plug that tells you the power it is using, you can setup a range condition to check that power consumption always stays within two values:

This is how you set it up:

  1. Go to your conditions section: https://app.apilio.com/conditions
  2. Create a new Tuya condition, and choose a device that has an numeric attribute you want to check it’s between two values.
  3. In the dropdown, select either
    • Inside range between … choose this one if your variable must fall within two parameters.
    • Outside range between … choose this one if your variable must be outside of a closed range for your condition to be true
  4. You’ll be able to then set two values to specify the boundaries of your range.

I have some more questions

Please put them below :slight_smile:

:bulb: Related articles

1 Like

That’s a very nice addition! Good job!

1 Like