I have a bond home hub installed with Hubitat and it is working great. I am trying to set up a rule that I just can't figure out how to do it.
I want to have a ceiling fan come on at a certain speed depending on temperature, only during specific times of day. Something like this:
From 5pm to 10pm
if temp is over 80, turn on fan and set speed to high
If temp is between 77 and 80, set speed to medium
if temp is between 73 and 77, set speed to low.
Below 73, do not turn on, or turn off if already on.
Ideally, i would like to do this with one rule, but if necessary, I dont mind breaking it out.
Before I get comments on the temps, we live in Houston and are pretty used to high temps and 80 inside the house is not that bad for us
I have 2 fans but if I can get help on one, I can modify it to suit our needs.
actions:
if (time > 5pm and time < 10pm) THEN
-if (temp > 80) THEN set fan to high
-elseif (temp > 77) THEN set fan to medium
-elseif (temp > 73) THEN set fan to low
-else set fan to off
-endif
endif
i'm not using RM5.0, so it may be a bit different than what i'm mentioning, but in RM4.0/4.1, this is how i would do that rule
Thanks a ton... I have never used the elseif or endif commands and I had my trigger as the time. This is what I ended up with and will see if it works!
IF (Time between 5:00 PM and 10:00 PM(F) [FALSE]) THEN
IF (Temperature of LR Temp(75.98) is > 80.0(F) [FALSE]) THEN
Set Fan Speed: Ceiling Fan to high
ELSE-IF (Temperature of LR Temp(75.98) is > 77.0(F) [FALSE]) THEN
Set Fan Speed: Ceiling Fan to medium
ELSE-IF (Temperature of LR Temp(75.98) is > 73.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to low
ELSE
Set Fan Speed: Ceiling Fan to off
END-IF
END-IF
You may also need to put another Set Fan Speed: Ceiling Fan to off in between the two END-IF's, so that when the time moves past 10pm the fans turn off.
Perhaps a separate rule to switch it off at 10pm regardless, if that is what is required, then from 10pm - 5pm the fan can be turned on without the rule affecting it.
good points. A bit of clarification. number 1, I need to throw a command to acturally turn the fan on. When I do that, it will automatically go to the last speed it was on.
We are usually not in this room after 10pm so the fan is not needed to be on after 10. I can do a couple things. Add a command at the beginning of this time frame to turn the fan on, and then, just turn the fan off at 10pm in a separate command. I played with the time so I can test, and this is what the rule is showing right now.
IF (Time between 10:00 AM and 10:00 PM(T) [TRUE]) THEN
IF (Temperature of LR Temp(77.87) is > 80.0(F) [FALSE]) THEN
Set Fan Speed: Ceiling Fan to high
ELSE-IF (Temperature of LR Temp(77.87) is > 77.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to medium
ELSE-IF (Temperature of LR Temp(77.87) is > 73.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to low
ELSE
Set Fan Speed: Ceiling Fan to off
END-IF
END-IF
As you can see, two statements are true... which will actually run, the first or the second? Do I need to add something like this?--- if temp is > 73 and <77 do XXXX? and put that in?
the first will run. the way the if-elseif works is
If A THEN do a
ELSEIF B THEN do b
ELSEIF C THEN do c
END-IF
if A is true, all 3 conditions will be true (since it's the highest). since it's the highest temp though, it will do A and skip the rest
if A is false, then it will go to the next condition. if B is true, then B and C will be true, but it will only do b
ok, been playing around and not having very much luck. This is what the rule shows right now:
IF (Time between 10:00 AM and 10:00 PM(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to on
IF (Temperature of LR Temp(80.79) is > 80.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to high
ELSE-IF (Temperature of LR Temp(80.79) is > 77.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to medium
ELSE-IF (Temperature of LR Temp(80.79) is > 74.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to low
ELSE
Set Fan Speed: Ceiling Fan to off
END-IF
END-IF
If I read this correctly, the fan should be on high speed, correct?
Per the device, it is on high speed, yet the fan is running at the speed it was turned off on last night which is medium.
In the rule, if I push "run actions", the fan goes to where it needs to be running, which right now, is high speed.
I am testing right now if the fan will slow down if the temp gets below 80. Should know that in 45 min... EDIT, the fan did speed down as it is supposed to do.
Question is, why do I have to hit "run actions" to get it to start running at the right speed for the temperature?
There's a chance the temperature reading may have dropped shortly after you opened the rule. Try checking the event history for the fan and/or turning on logging for the rule to see what is happening
maybe put a delay after the on? it might be turning on then sending the high command too fast, so the fan doesn't process it
IF (Time between 10:00 AM and 10:00 PM(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to on
-->**DELAY 2 SECONDS**
IF (Temperature of LR Temp(80.79) is > 80.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to high
ELSE-IF (Temperature of LR Temp(80.79) is > 77.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to medium
ELSE-IF (Temperature of LR Temp(80.79) is > 74.0(T) [TRUE]) THEN
Set Fan Speed: Ceiling Fan to low
ELSE
Set Fan Speed: Ceiling Fan to off
END-IF
END-IF
pretty sure you don't need to explicitly send the on command either, it will turn the fan on with the appropriate speed when it receives that command. you could also try to remove that on command and just let the nested if statements handle turning it on
I second @dadarkgtprince, if the fan is already "off" then setting the fan speed will automatically turn it on. You should be able to eliminate both the "on" and the 2 second delay you have at the start with that change!
Depending on how many rules/devices you have my only question is: How often does your temperature sensor report new temp values?
I only ask because some temp sensors report back every 30 seconds by default which means (on top of whatever else you may have your hub doing) it could be running and re-running this entire rule/logic a LOT in those 12 hours between 10 and 10.
Don't worry, you'll probably be fine but just wanted to point it out in the rare event you were not aware or if you see any slowdowns later on.