Multiple AND in the IFTTT conditional statement

best-ifttt-recipesIFTTT (If This Then That) is a great service which allows you to automate tasks, cellphones, cars, your house or almost whatever you fancy. It works in a powerful way using simple conditional statements (If…This…) using (Then) webservices (…That). For for example with IFTTT you can say: “If (it’s dark) Then (turn on the lights). But that’s also where it becomes difficult, because you can imagine you would like to say: “If (it’s dark AND in the weekend) Then (turn on the lights), the last is not possible because a multiple AND is not allowed…

After some efforts and lots of trying I decided to put in a more structured approach

IF {condition} THEN {statement} - works fine in IFTTT!
IF ({condition} AND {condition}) THEN {statement} - does not work...

Let’s simplify with it with an example

IF (it's dark) THEN (turn on the lights) - works fine in IFTTT!
IF (it's dark AND in the weekend) THEN (turn on the lights) - does not work...

Numerous and multiple AND

Then I noticed there is a channel in IFTTT called Numerous and it does basically nothing else as remembering numbers. It also has the ability to reset, add, subtract and assign a value to a number. Now let’s add in Numerous to the equation, the basic line first.

IF (it's dark) THEN (ADD 1 to counter)

And this is where for me the light at the end of the tunnel appeared, because this means you can also say:

IF (it's dark) THEN (ADD 1 to counter)
IF (in the weekend) THEN (ADD 1 to counter) - counter now equals 2
IF (counter EQUALS 2) THEN (turn on the lights)

It takes no genius to figure out that this is exactly the same as combined AND condition. By using an ‘in-between’ variable you can use the sum of the IF statements as a combined multiple AND statement. This solution works, but it would be preferred if IFTTT will allow full Boolean expressions soon.

Real world

In my case I used this example in a somewhat more complicated scenario for multiple AND solutions. Our house is equipped with a Nefit Easy thermostat, which can be controlled via the web and we would like to lower the temperate of the house if both my wife and myself are away. There are some basic settings in the thermostat itself which can handle this scenario, but the tricky part is that I use a cellphone for my work and one for my private whereabouts. Unfortunately the thermostat is not ‘clever’ enough choose the right cellphone combination automatically.

To solve this I use three different IFTTT accounts which all report into one Numerous number, basically it works like this.

IFTTT account 'Ebo private'
IF (04:00) THEN (reset thermostat)
IF (between 09:00 and 22:00) THEN (ADD 1 to thermostat)
IF (Ebo's private phone leaves the house) THEN (ADD 1 to thermostat)
IF (Ebo's private phone enters the house) THEN (SUBTRACT 1 from thermostat)

IFTTT account 'Ebo work'
IF (Ebo's work phone leaves the house) THEN (ADD 1 to thermostat)
IF (Ebo's work phone enters the house) THEN (SUBTRACT 1 from thermostat)

IFTTT account 'Patricia'
IF (Patricia's work phone leaves the house) THEN (ADD 1 to thermostat)
IF (Patricia's work phone enters the house) THEN (SUBTRACT 1 from thermostat)

In the first part you can see that I always reset the number, this is just out of ‘good coding’ rules and for safety. Then I add a line which will prevent this script from changing the temperature of the thermostat at night. In the other sections you can see that either 1 is added or subtracted. If you add it all up you will come to the conclusion that once the variable thermostat hits 3, it’s during the day (+1), Patricia’s phone left the house (+1) and also at least one other phone left the house (to solve my multiple phone issue).

More information

Tags: , , ,

Trackback from your site.

Comments (4)

  • Avatar



    Thanks so much for this post, but unfortunately Numerous shut down on 1/5/16!

    Have you / anyone else found an alternative, or another way to achieve what you did with numerous?


  • Avatar

    Ebo Eppenga


    Great! Just subscribed and love it. Quick question about the logic block, I think now it’s one big AND statement, is it maybe possible to do an OR or combinations as well?


  • Avatar

    Ebo Eppenga


    Hi Jay, that was a bit unfortunate to say the least. Today I got this great answer from Philipp, he runs

    I would recommend checking it out.


Leave a comment