Homey Community Forum

The order of cards executed in flows

Hello,
I’ve got a problem I can’t find a solution for. Let’s start with an example to explain the problem.

I’ve got a light device (just an on/off property). I’d like to have a flow executed only if the light has been switched on outside of a Homey flow (e.g. with a light switch in the wall connected with this device).

To achieve this I:

  1. Prepare a Boolean variable auto_turn_on = false
  2. Create first flow (named X):
    a. WHEN this light turns ON
    b. AND auto_turn_on = false
    c. THEN send me a notification
  3. I create the second flow (named Y):
    a. WHEN this flow is started
    b. AND this light is OFF
    c. THEN:
    i) auto_turn_on = true
    II) turn on this light
    iii) auto_turn_on = false with delay e.g. 3 seconds

If the cards would be executed in this order, then eveytime I run flow Y, flow X shouldn’t send me a notification. The notification should be only executed if the light has been turned on outside flow Y. But it looks like it’s different. Sometimes I do get a notification after I execute flow Y. It looks like the light is turned on before the variable is set to true. Is there any possibility to be sure in which order the cards are executed? Or any other idea how to achieve what I try to do (execute some action only if the device state was not changed by another flow)?

Piotr

First: What does trigger WHEN this flow is started?

Second add a delay for 1 sec at ii) turn on this light. Now i) and ii) are executed at the same time which can cause problems for correct executing

Dear Marcel,
“this flow is started” is used in WHEN for Flows that are not triggered by devices, but that are either executed by another flow (with a card Start a flow) or manually.

Reg. delay in turning on the light - it’s not the case. The light has to be turned on immediately (e.g. after a motion sensor detects motion or a contact sensor is open). So I can’t add delay. There has to be any other solution.

Piotr

Is this a smart switch or a dumb switch?

It’s a smart switch (BleBox switchBox). It can be switched by Homey, or by pressing the physical switch on the wall. In both cases the same trigger is fired in Homey Flow, so I was searching for a method to determine if it was switched physically or by Homey flow (by using a variable as above)…

Can’y you make another flow with the switch. With my switches i gave the options, when a button is pushed and when a scenario us triggered for button 1. Do you have sone options for tour switch?

I’d like to have separate flows, but how may one determine if the device state was changed to ON by pressing the physical button or by Homey? In both cases there is the same trigger fired by Homey.

Piotr

Is it ok when having the notification with a delay ? If so maybe with a extra flow…

  1. Prepare a Boolean variable auto_turn_on = false

  2. Create first flow (named X):
    a. WHEN this light turns ON
    b. AND auto_turn_on = false
    c. THEN send me a notification

  3. I create the second flow (named Y):
    a. WHEN this flow is started
    b. AND this light is OFF
    c. THEN:
    i) auto_turn_on = true

Flow 3

Auto turn on is true
Then turn on light
Start flow 1 (delay 1 sec)
Set auto_turn_on (delay 3 sec)

Put a 1 second delay on

II) turn on this light

JPe4619 - no, the delay is not acceptable in the scenario. The light has to switch on immediately.

Thenks Roy
That’s a good idea! Just to change the variable value and make a flow with a trigger on that variable! I’ll try that, but logically thinking it should work as I need!

Piotr