Help with rule

Hey Folks,

Hope you can help me by taking a look at the following rule and letting me know if I'm going about this the right way, or if there's a more efficient process? I'm still learning.

The point of the rule is this:

  • I want to control a fan that I placed onto my bedroom window, based on the temperature in the room, but I only want the rule to fire under certain conditions.
  • The fan is plugged into a Wemo plug (which is connected to Hubitat through a virtual switch tied back to IFTTT.)
  • I only want the rule to fire when I'm at home and in bed, so I've tied it back to the state of my Abode alarm--when the "Virtual Abode Home" switch turns on.
  • I only want the rule to fire when the window is open--when the "Virtual Abode Master Bedroom Window South 1" switch is on.

In order for it to fire throughout the night I set a periodic schedule of every 15 minutes. Is that what you would do too? I'll take any suggestions and thank you.

If you want the fan to turn off if any of the three conditions that caused it to turn on changes, then you don't need ELSE-IF.

Just

ELSE
Off: Virtual Wemo Plug
ENDIF

1 Like

:smirk: that's so obvious to me now... why didn't i think of that?

1 Like

I cleaned up the rule as you recommended:

Still wondering if running a periodic schedule is the way to go? And if so, would there be much of a drawback (resources perhaps?) to increase the frequency from every 15 minutes to say, every minute?

I'd recommend using the WeMo app/driver to directly control your WeMo plugs/switches from HE. I use this and it works flawlessly

1 Like

usually i would set the trigger to be =>68*

the i would use the IF statements to check the other factors. this way it only fires when the temp reaches that threshold. not every 15 minutes night and day.

1 Like

How often will that trigger be evaluated, though? Would that trigger only when the temperature goes from less than 68 to greater than or equal to 68? Or would a change from 71.4 to 71.5 also trigger it?

Consider the case where the temperature rose to 69 degrees before OP went to bed. Then OP went to bed and and virtual switch changed, but the temperature held constant. Because the virtual switch change of state wasn't part of the trigger, the rule didn't fire.

You can have multiple triggers, though, and they are OR'ed. So you could trigger on temperature crossing that threshold or either of your virtual switches changing. Then in the actions, you AND those conditions to see if you really want to turn on the fan.

Is that better than using a time interval? I guess that depends on how the temperature trigger works.

I guess that depends on what they're trying to accomplish right. The way the first rule is anything over 69 it does something and when it below 68 it turns back off. So none of the other things should matter if the temperature still below 69 right.

My point was that the efficacy of the temperature-based trigger depends on how frequently the device reports [I think]. That is, there is no trigger for "the temperature is greater than 69 degrees". That's more like a condition instead of a trigger. The trigger is "the device reports a temperature greater than 69 degrees". A subtle but important distinction.

I think OP would be well served to have the temperature report and two virtual switches states OR'ed as the trigger, and then those three things AND'ed as the condition. The effect of that would be that as soon as OP went to bed in a hot room, the fan would come on. Otherwise it wouldn't come on until the device next reported temperature.

1 Like

Not sure I follow. I use several rules that use temperature as the trigger. What am I missing

You're not missing anything, really. If the device reports temperature frequently, there's little difference.

In the OP's posts, his goal was to have the fan come on as quickly as possible after all three conditions were met. By OR'ing the three conditions in the trigger, then the fan will come on as soon as the virtual switches become true .. even if the device hadn't reported temperature lately (assuming it was already over threshold at last report).

Ah right on

This is my rule that turns on a Kasa plug based on the Tado temprature reading, but onlt if HSM is in night mode to make sure this only happens when we're at home and the alarm is set. If we're away or still downstairs the HSM would be in home or away mode so this minimises false positives. Also based in the rule there's a conditional switch, because originally I had it set to be On over x temp and off under x temp, however the wife got annoyed when she wanted the fan on but Hubitat kept turning it off because the temp wasn;t high enough, this mitigates for that with mapping a virtual variable switch to the rule. Which means you can manually change the status of the fan but unless that variable switch is flipped nothing will happen. Otherwise if you tell the fan to only be on when temp is over 20c but you find it's hot one night but only 19c your rule will fight you and keep turning the fan off without a variable that's mapped to the fan status.

image
image

I realized after creating this rule that during the day, if I want to run the fan, this rule will just turn it right off, because one of the conditions (Virtual Abode Home) will not be met. So I added some extra logic:

This way if its daytime and I want to let in some fresh air, RM won't just turn the fan right off again.