Help with creating an advanced flow

I have been trying to create an advanced flow to start my (dumb) air humidifier through smart plug and an air quality sensor. I have been able to create three simple flows to make this happen but can’t combine them to one advanced flow. The flow should work like this:

When: air quality sensor reports low humidity alarm on
And: Time is between 19.00 and 06.00
Then: Turn on the humidifier plug

When: Low humidity alarm goes off
And: Time is between 19.00 and 06.00
Then: Turn off the humidifier plug

When: Time is between 06.00 and 19.00
Then: Turn off the humidifier plug

This is what I’ve come up with, but it does not work.

You need to have three different triggers for this:

  1. low humidity alarm on
  2. low humidity alarm off
  3. The time is 6:01

  1. Turn on the humidifier plug
    Low humidity alarm on (when) :arrow_right: Time is between 19.00 and 06.00 (and) :arrow_right: Turn on the humidifier plug (then)

  2. Turn off the humidifier plug
    Low humidity alarm off (when) :arrow_right: Turn off the humidifier plug (then)
    The time is 6:01 (when) :arrow_upper_right:

This only you needed.
Turn off may always happening.

You can put an extra flow for switching off on 06:01

Okay, so event that requires several triggers can’t be combined into one flow. Thank you for this new information.

1 Like

You mean that Homey discontinues the flow automatically when the trigger is no longer acrive?

What Boris_Fers wrote.

If the humidifier is working after 06:00 you can wait till it stopped or you can make that extra timeline on 06:01 to let it stop.

1 Like

With advanced flows, you can have multiple triggers in one flow.

Triggers are the start of a flow (when). In your example, you have only one trigger (when), and the flow is executed only when the trigger for the “Low humidity alarm on” happens. In your case, the second part of the flow is useless as will never be executed. “The humidity alarm is off” is an and condition that will be always false. Because the flow started when the humidity alarm was on.

2 Likes

Hi @Jari_Peuhkurinen ,
Most important is that the first card When… is only a trigger that fires at an incident. Then the flow is works off and stops. It starts only again if the next incident occurs, in your case - the alarm changes from off to on.
Usually you should avoid busy-wait, but in some cases it might be useful or an easy start.


yellow lines after the And… cards mean in case of NO
That is not anything I would suggest. But it is more or less how you looked on the problem - and it would work.
Then you could check how others solve similar problems and which solution you like the best.

1 Like

You can also add a condition to start the humidifier at 19:00 if the low humidity alarm has already been triggered before 19:00.

3 Likes

Thank you. Now I understand the basic structure of the advanced flow. I was unsure if there can be multiple triggers in one flow and how to combine them, but your flow made it clear. Thank you so much. Amazing community!

Thank you. This looks like something I had in mind in the beginning. Trying to combine everything into one. I must experiment with this one too :slight_smile:

Great examples and I know this was solved, but for those who read this thread later, I would like to add a few points for building flows:

  1. You can have a single continuous flow with multiple triggers
  2. I prefer the central logic here, but from experience I would like to caution against using the AND card. It often makes a flow hard to read/maintain. In addition, there may be cases unsolved if one of the AND card inputs is not true. In addition, to avoid high CPU, I try to avoid triggers with “Every x minutes” where possible
  3. For easy maintenance and device replacement, use zones (or groups or advanced virtual devices) where you can.

Illustration:
Advanced virtual device (yellow) with humidity from your sensor
Zones (can also be sub zones)

1 Like