How to do an Advanced Flow where the "When" must stay valid for a certain period to proceed with "Then"


I am trying to reproduce some custom “Routines” from my SmartThings in my Homey and need some guidance. (Routines are defined as “IF … THEN …”)

I have among other routines defined on Figaro Plugs to switch them OFF when the plugged device “does not seem to be running anymore”.

Example, for a PC: the routine switch off the plug if;

  • it was ON for more than 5 minutes; to be sure that the PC had time to boot
  • but it was consuming less than 10W for 5 minutes; to be sure that the PC is not just rebooting

Concretely, on each “IF” clauses, one can define a duration for which the device is expected to keep the “IF” condition = true, before executing the THEN part.

Concretly, the routine encoded on SmartThings is as simple as IF “plug is on” for “5 minutes” and “plug’s wattmeter <= 10W” for “5 minutes” THEN “switch plug off”

I am wondering how to achieve this with an Advanced Flow as easily and efficiently than on SmartThings ?

NB: I found this thread How to check condition for certain amount of time before flow execution? - #5 by DirkG
But it’s what I need. Indeed, I want the state of the device to be kept unchanged on the given period. with a timer, I have no guarantee that the state didn’t change between the “initial WHEN” and the “WHEN the time is finished”…

If there is nothing simple (An APP ?), I guess I must do this complex flow:
WHEN plug is on Then SET Booting = True and after 5 minutes SET Booting = False
WHEN plug’s consumption becomes < 10W AND Booting = False AND plug is on AND Timer is not running THEN Start a Timer for 5 minutes
WHEN plug’s consumption becomes > 10W AND plug is on AND Timer is running THEN Stop the Timer
WHEN Timer is finished AND plug is on THEN turn off the plug

And I am actually not satisfied with this as the plug won’t turn off automatically if the PC is not booting, because the “WHEN plug’s consumption becomes < 10W” will never be trigered (indeed, it will never exceed 10W and will theefore never becomes < 10W :frowning: )

I’m not sure I have fully understood the query, but I have a flow using a presence sensor where I only want a light to turn off where no presence is detected for more than 10 seconds. It relies on the countdown timer app.

I have set a timer called “kitchen side lights” and one flow which reads; When no presence is detected in the kitchen zone, Then start the kitchen side light timer for 10 seconds

Another flow; When presence is detected in the kitchen, Then stop the timer.

And a third flow; when kitchen side light timer reaches zero, And, no presence in the kitchen, then turn the light off.

Could you do something similar so that if at any point the power draw exceeds a certain threshold it stops the timer?

1 Like

or “delay” function?

The problem with ‘delay’ is that it doesn’t recognise a continued absence. It only recognises absence and then responds to it 10 seconds later.

In my flow then this would be “for a split second there was no presence detected, and so the light will be turned off in 10 seconds time” rather than “there was a prolonged period of 10 seconds where no presence was detected “

Have a look here: Flow to take action when power consumption has been above 500w for 5 minutes?


That device capabilities app looks very useful! Thanks for sharing

1 Like

I use Chronograph for stuff like this. It works well.


Indeed, the following When… flow card from the Device Capabilities app is in the meantime the easiest way to check a state or a parameter from a device over a certain time:


Afaik, this flow card didn’t existed when I wrote this post. But the flow should actually work, I don’t see any logical error. That’s why I don’t understand the following statement:

If it doesn’t work with 10 W, then you should look in Insights to see how much power the PC needs if:
– it it’s turned on
– if it’s in standby mode
– if it’s turned off

Hint about the chronograph app.
There is no need to use the picker and the name field:


If you hoover with the cursor over the of the flow card, an additional info will be displayed:

So if you want to create a new timer name, first you have type in the name. After saving the flow, the name of the timer can be chosen by the picker field and the timer name in the name field can be deleted. Using the picker avoids typos.

A little update:
The ‘name’ field is not needed any longer, while it’s a left-over from previous app versions, and it’s only still here to not break existing flows with Cgraph devices.

You can use the picker field right away to create a new timer. Enter a name, and then select it to add it to the timer card.


Many thx all for your help and input.

About my comment “the plug won’t turn off automatically if the PC is not booting”… I wanted to say that the event “consumption becomes lower than 10W” will occur if and only if, at some point, the “consumption went above 10W”. If one turns on the plug, but the PC does not boot (because, in the BIOS, you didn’t configure to turn on when power is back), then the power will never go above 10W… and hence, the plug will never be turned off by my Advanced Flow (using 5W or 2W won’t really solve it)…

The Device Capabilities is definitively the easiest way to go for may purpose !

But notice that this won’t turn off the plug either :

If the power consumption does not do above the specified limit, 10 W here (which will be the case if the PC is not turn on, as explained above)

And I can still not do (which would be identical to my SmartThings routine) is something like : When “the power was higher than 10W for more than 1 minute” and “the power was next lower than 10W for an extra minute”, Then… because the card used above only exist for the “When” and not for an “And”

Thx again !


I came to this solution, tested with a lamp connected to the Fibaro plug with such a cable


It works like a charm (Well, as long as the flow is not broken in the middle with the plug on but no consumption - i.e.: lower than 1W).

THX A LOT again for pointing and these Advanced Capabilities !



I’m pleased that you found a manual solution.

I think I have understood your use case now and you don’t need no extra cable. Try this flow:

1 Like