Trigger Event Question

I have two rules setup for handling humidity and the exhaust fan in my master bathroom.

The first rule turns the fan on if the humidity goes over a certain value, if within a specific time window and turns it off after the humidity falls below a certain value for 15 minutes. No complaints with this rule other than sometimes the Sonoff HT sensor takes forever to sense a change in humidity and turn on the fan.

The second rule is intended only to shut the fan off if the fan is running outside of the first rules time window, and the humidity falls below a certain value for 15 minutes. The intended use case for this rule is to turn the fan off if activated manually outside the first rule's time window, or if the fan is still running as triggered by the first rule (the conditions to turn the fan off are the same for both rules). This rule was running fine but after the most recent updates it is failing to turn the fan off. This made me rethink this rule and want to improve upon it. My thinking was to have the rule only be be triggered if the fan was running, outside of the the first rule's window, and only get turned off if the humidity value was below the threshold for 15 minutes or more. The way I have the trigger now is definitely not the best and does not match my desired trigger conditions above. Am I over thinking and/or trying to go about this the wrong way?

There is an if condition in your second rule that has no data in it. “IF ( FALSE) Off: Master Fan”. That will cause the action not to run. I would just make it: “Off: Master Fan” (Remove the condition and re-add the action).

On the first rule, you could create a “Use Required Expression” that contains: “NOT Time between 10:00 PM and 3:30 AM” and then the rule could be simply “On: Master Fan”, and the 2nd rule would take care of turning it off.

I could have sworn the “IF ( FALSE) Off: Master Fan” was because I set a condition for the action based off of the status of the switch (must be on). I'm going to go ahead with your suggestion on the 2nd rule.

For my own edification, why did you suggest going with “Use Required Expression” vs the normal route of creating a rule?

1 Like

Thanks for your help/input, the “Use Required Expression” function does exactly what I was looking for.

I changed both rules based off of your input.
1st Rule

2nd Rule

1 Like

I like how “Define Required Expression” simplifies the rules.

1 Like