Creating a rule to run an AC unit



I'm trying to turn an outlet on or off based on temperature and time of day. Here is a screenshot of what I have so far, I think it should work but it doesn't seem to be. What I'm trying to achieve is:

Between 8:00 and 22:00
If the downstairs temp is less than 71 turn off the South Downstairs Outlet
If the downstairs temp is more than 73 turn on the South Downstairs Outlet

Between 22:00 and 8:00
If the downstairs temp is less than 69 turn off the South Downstairs Outlet
If the downstairs temp is more than 71 turn on the South Downstairs Outlet

Any pointers would be greatly appreciated!


The actions will only run when the rule truth changes. You’re going to need to include your temperature conditions into the rule(s)


There are lots of ways to do this... I have mine working off the thermostat setpoint itself, versus having the on and off temperatures built into the rule. But probably best to start by getting this rule working, and then if you feel the need, expand after.

I think your biggest issue is that it is only going to kick in once at 8:00 and again at 22:00. Those are the two times the condition will change between true and false. So it will only control the AC unit twice a day.

I suspect what you really want is it to evaluate everytime the room temperature changes.

For simplicity to start, I'd probably make 2 separate triggers, one for day and the other for night. Put in the appropriate time restriction for each, so it only will run during those times. Then the trigger will be if the room temperature changes. You true and false rules should still work - just put the correct two in each of the two triggers.

EDIT: seeing how you are already using conditions, you could do one trigger - as stated above, the trigger will be the room temperature changing. Then your action will be first a general if-then with the time 8 to 22, and then the two simple conditional actions you have, then end the if. Then a second if/then for 22 to 8, under which you have the other two simple conditional actions you have above. Then end that if. That would combine the two triggers to one.

If confusing, let us know, we can create an example.


This is one I did to turn a fan on/off based on temperature and mode. You could change the mode to time instead.


Lots of ways! Triggered rule will work as well, and probably even simpler.
My only question @jabecker, would be shouldn't your trigger event be if the temperature changes (new feature)? If the motion sensor temp drops below 78, I don't see how the rule would be triggered to turn off the fan.

Edit: Sorry - I misread the purpose of your rule. It's not supposed to turn it off unless the mode isn't in Home or Evening. My fault. Title even says "fan on"


Thanks for the reply! It is a bit confusing, I see what you are saying about the trigger but if someone could mock-up a rule and screenshot it for me I would truly appreciate it!


I want to thank everyone for the replies, I really appreciate it!


Here is @jabecker's suggestion modified for your rule:


Thanks AndyM, that helps a lot. I think that my main issue is I am not figuring out how to create the trigger event, I'm not seeing Select Trigger Events as an option when I create the rule.


You have to start fresh unfortunately, and when you do you select define a triggered rule.


Here is what I am seeing when creating a new rule. I am not sure how to get it to show "changed".


Sorry - feature just came out 4 hours ago...

You would have to update your hub.

Or alternatively for now, you could say if the temperature is greater than 1 degree. Likely (unless you pipes are frozen) everytime the temperature changes it will be greater than 1 degree and always trigger.

For clarification for you or others reading - with a trigger, every time the device attribute changes it will check the trigger condition and run if it matches. As this is a triggered rule, it will then evaluate the conditions and run the appropriate action regardless of the conditions prior state.

A regular rule (versus the triggered rule you are now using) will only fire on truth change... It still checks every time the device attribute changes, but unless it goes from true to false or vice versa it won't fire.

Very hard to get your head around at first, but once you get it, it makes complete sense. And it is exceedingly difficult to explain due to the terminology. We often refer to rules, triggers, and triggered rules all as rules... you have to figure out what the person means by context clues.


First, Doh!!! That explains it - I've updated the firmware and created the rule.

Second, great explanation - it's very helpful. Thank you very much for the help!!!


@AndyM -- yes, it really should be a rule, vs a triggered rule. I'm relatively new to HE and I was having a hard time wrapping my brain around the different types of rules. I originally had two rules: one for on and one for off. Then I tried to combine them, but not successfully because the fan won't turn off. I think it doesn't really need a trigger... just the evaluation of true or false for the conditions.

I think this will do it:


Getting a little late for me to say for sure... but it looks good to me!
If the temp is greater than 78 in home or evening mode it will come on.
If the temp goes below that or you leave those two modes it should go off.


It is definitely tough. Then even after you get it you'll still be 3/4 of the way thru a rule and realize you should have chosen another :slight_smile:


Another sample:



Here is what I'm trying now. The simple conditions seemed to have an issue, the outlet would shut off and then on again and I couldn't figure out what was cycling it on so I tried this and so far it seems to be working. The five minute delay is to avoid short cycling the AC unit.


Oh... already been there, done that! :laughing:


I'm not sure why it would do that. I don't know much about ACs but a delay is probably better for the compressor as that is what thermostats do to keep the compressor from quickly switching between on and off too often. Though for compressor protection, you'd want a delay on the on side as well, or something even more complicated so the delay only occurs if the state recently changed. But now I'm way off topic!

There could be something wrong with the rule that I'm not seeing and others will see.

But the first thing I'd probably check is the device page for the Downstairs South Outlet to see what other rules it is involved in, just to be sure another rule isn't also trying to control it.

Then if I didn't find anything, I"d get rid of the delay, try to replicate, and watch the logs. Probably best to unplug the AC from the outlet if you do that type of testing.

You also modified the rule so there is only a 1 degree difference between off and on. I don't know how powerful your AC is for the room it is in (or how close the thermostat is to the AC), but it could have been working fine, just the small gap in temperatures between off and on was causing it to cycle.