Rule to turn on for a few minutes per hour - greenhouse mist

Looking to see if this is set up correctly or if I'm overlooking something.

What I want is for HE to turn on a switch to a pump to mist the greenhouse plants if the humidity drops below 50% between the hours of 10AM and 8PM. I want the pump to run for 3 minutes then off again.

Looks good at first glance.

An other option for it to only trigger if the value of the “Greenhouse Ambient TMP & HUM” is below 50 would be to add the condition to the “Use Required Expression”, instead of within the trigger. The end result would be essentially the same.

If I use required expression, then I can set it to require that the humidity be less than 50%, then it would trigger the pump? Allowing it to run anytime but only if its less than 50?

Correct. The trigger would be ignored if the humidity is less than 50%.

How would I get it to run only once per hour?

As long as you are using time based triggers (like currently), it will only run at those defined times if the humidity level is below 50%. So, it will check at 10:00, and if the humidity is below 50%, it will run. If the humidity is above 50% at 10:00, the rule will do nothing. At 11:00, it will check again and proceed accordingly. The rule would not run if the humidity drops below 50% from 10:01-10:59.

1 Like

OK, I think I have it. Is it generally better to use the required expression over the conditional trigger?

Doesn't matter as the end result is the same.

1 Like

As @JB10, the end result will be the same. The required expression will stop the rule from running unless the expression is met. Otherwise, the trigger will run every hour and check the condition. Essentially the same.

just to confirm, the delayed 3 mins is on the Off command, and not a new line on a nothing command, correct? i'm used to seeing the delayed in the same line as the command, and not on a new line

Yes, I want it to turn on, then after a 3 minute delay turn off again. I only want the pump to run for 3 minutes to mist the plants then stop.

One final follow up, are these run sequentially and wait for the delays to finish before proceeding to the next action? I have edited this rule to allow for the fan to turn off, then trigger the pump, wait a few minutes, then turn the fan back on. Like this:

Will this work the way I want it to? The whole sequence should take 5 minutes: turn off fan, wait 1 minute, turn on pump, wait 3 minutes, turn off pump, wait 1 minute, turn on fan

Nope. There is a Delay action and there is a delay on an action. You are using delay on an action. Those 4 actions will run sequentially but milliseconds apart and schedule actions to happen in the future. You'll see this

Fan turns off
1 minute later the mist pump and fan will turn on
2 minutes last the mist pump will turn off

Total time will be 3 minutes

These three rules are basically the same and any should work

Rule 1 - delay on an action

Cancel Delayed Actions
Off: Fan
On Misting Pump --> delayed 0:01:00 (cancelable)
Off Misting Pump --> delayed 0:04:00 (cancelable)
On: Fan --> delayed 0:05:00 (cancelable)

Rule 2 - Delay action

Cancel Delayed Actions 
Off: Fan
Delay 0:01:00 (cancelable)
On Misting Pump
Delay 0:03:00 (cancelable)
Off Misting Pump 
Delay 0:01:00 (cancelable)
On: Fan

Rule 3 - Wait action

Off: Fan
Wait for event: --> elapsed time: 0:01:00
On Misting Pump
Wait for event: --> elapsed time: 0:03:00
Off Misting Pump 
Wait for event: --> elapsed time: 0:01:00
On: Fan
2 Likes

Excellent, thanks! By putting in the wait for event, it doesn't let the hub process the rule in parallel then? I changed my rule to match the 2nd one you built.

Do you mean to schedule all the action to happen at a later time? If so, no. Example rules 2 & 3 put a "pause" before executing the next action.

I would suggest you make some test rule with logging turned on. There's no better way to understand how a rule works than by seeing it for yourself.

1 Like