Getting Started - The 'or' and 'else' parts of a flow

Hi again! I hope you all enjoyed the first tutorial. This tutorial continues where the first one left off. In this tutorial, you will learn:

  • to use the ‘or’ card
  • to use the ‘else’ card

This tutorial is a bit shorter than the first. Let’s start with the same flow:

Now, this flow makes me unhappy. As you might remember, Grumpy is watching her show. She doesn’t bother to greet me. And Homey doesn’t say anything, because this flow stops when it concludes that the chromecast is playing. Let’s see if we can get Homey to greet me, without playing music, only when Grumpy is watching her show.

To do this, let’s first add the speech card to the ‘then’ section again. This time (to compensate for the lack of attention), I’ll make it say: Hello Neuron, I’m happy that you are home again.
This will look like this:
image

Unfortunately, this doesn’t quite cut it. Homey now says both the first and second speech card when I get home and the chromecast isn’t playing, but it still remains quiet when the chromecast is playing. To correct this, we can hold the last speech card for a second or so, and then drag it downwards. You’ll notice the little grey word ‘else’ has appeared between the first and second speech card:
image

Now Homey executes the part above ‘else’ when chromecast is not playing. When chromecast is playing, only the part below ‘else’ is executed. So when I come home, and Grumpy is watching her show, Homey says: Hello Neuron, I’m happy that you are home again. It will not start Sonos.
When I get home and Grumpy is not watching her show, the music starts and Homey says: Hello Neuron.

When Grumpy gets home, the same rules apply. When I’m not watching anything, the music starts and Homey says: Hello Grumpy. When I am watching something, Homey will not start the music, and will say: Hello Grumpy, I’m happy that you are home again.
Please note that you can only get one ‘else’ in your flows. So adding another card, hold and dragdown won’t work. You will be able to add multiple cards to the part above ‘else’ and below ‘else’, but it’s not possible to get something like:
Then
A
Else
B
Else
C

You can get something like:
Then
A
B
C
Else
D
E
F
G

This means there are two possible outcomes, but these outcomes can result in multiple cards being executed.

My girlfriend starting to notice Homey’s possibilities, and has made another request. I, determined to fulfill her every need, naturally adjust the flow to her request. (I made her mail me a RFC though).
I already had a flow which sends a push notification to her phone when someone rings the doorbell and we are not home. The flow reads:
WHEN
The doorbell rang

AND
Nobody is home

THEN
Send a push notification to Grumpy

She decided that she also wants a message when she is sleeping. To do this, we need to add a card ‘Grumpy is sleeping’. The flow reads:

However, this flow will check whether both nobody is home and that Grumpy is sleeping (I did not add the name of Grumpy in the flow cards to protect her privacy and prevent her from finding out that I call her Grumpy). This will not work as intended, because in order to receive the message, both nobody needs to be home ánd Grumpy needs to be sleeping.

We can fix this by holding and dragging the ‘sleep’ card, which makes the ‘or’ appear, as presented below:
image

When using or, remember that Homey will check both conditions. If one of them is true, the THEN part will execute. So when either nobody is home, or Grumpy is sleeping, she will receive a push notification on her phone.
Also, remember that you have the ability to add two ‘or’s’, meaning that you can let the flow execute when one of three conditions is met.
Similar to the previous tutorial, when you add multiple card to one ‘and’ part (like shown below) all of them need to be true for the flow to execute:
image
In the flow shown above, the push notification will be sent when:

  • nobody is home
    OR
  • Grumpy is sleeping and it’s a sunday.

So she will also receive a notification on a Tuesday when nobody is home.

I hope this clarifies the ‘or’ and ‘else’ parts in a flow. If you have any questions, just post them in the comments! Happy flowing!

11 Likes

Hi, thanks for sharing these tutorials - they have been very helpful.
Question. Is it possible to have several AND’s, plus use the ELSE feature?
So if both AND conditions are met, then do the first THEN, but if one or neither conditions are met, do the second THEN?

Not the “second THEN” but the “ELSE” if one or both (or triple) items are not met.
Maybe you should read again ? There is no “second THEN”

I think what you are looking for is:

When
Trigger A happened

And
Condition 1 is met
Condition 2 is met

Then
Execute action x

Else
Execute action z

Like @JPe4619 states, this is explained in the tutorial. But no worries, feel free to ask.

In the flow above, the action x will only execute when both conditions 1 and 2 are met. If only one is met, or when none is met, action z will execute.

I hope this clarifies things? If it doesn’t, please post printscreens of your flow and tell us what you would like to achieve. We can probably help you.

1 Like

It seems that you only get two “or” conditions though? I couldn’t set a flow for something to happen if it’s Monday OR Tuesday OR Wednesday OR Friday…I need to skip Thursday, but it only lets me have 2 “or” conditions?

Maybe you can solve that particular condition with an “and”. Try using “Today is Week day” AND “Today is not a Thursday”.

1 Like

Sounds logical! Thanks! I’ll give that a try!