# RM 4.0 Rule Questions and Optimizations

#124

Forget about %now%. There is a condition called Time Of Day. It tests if the current time is between two times. So for your case, you just test if the time is between 8:30 and 8:30, or 4:00 and 4:00, or 9:30 and 9:30. No need for %now% or a variable at all.

All in one rule, if that's the way you want it.

I hope you follow that if the rule is triggered at 8:30, the time of day is between 8:30 and 8:30.

#125

OK, that makes sense and yes, that works too. That's how I did it in the first place back in post 111.

I was just trying different things I guess. I do very few time based triggers. My only reason for posting above was to see if there was an easier way to do it in 1 rule with multiple time triggers without the "time betweens", as they get a little tedious to make.

I've now done it 3 different ways that ALL WORK. So that's pretty cool. Rule 4.0 has been working out quite well for me.

#126

You could use Days of Week Schedule instead as triggers, and simplify the test for which day it is. One Days of Week would give you Sat/Sun at 8:30 and Mon-Fri at 4:00.

#127

Hey, that's nifty, too. I'd never used the Days of Week Schedule before. Just took a look, and you're right, that is yet another way to do it!

#128

It autofills the second set of days for you, makes it clearer when you read the rule what's going on, and has fewer tests in the actions.

#129

Here is a dopey question. If I use the same time for "time between" (as you indicated above) it always says it is true... If I use two different minutes, it correctly shows false.

Shouldn't the other two shown below show false as well? Or should you always make sure the minutes are different?

Not a big deal, as it is just as easy to make time between 8:29 and 8:31 as it is 8:30 and 8:30... Just asking.

#130

Let me look at the code.... I thought it was inclusive of the two endpoints, but I'll check.

Update: Yep, that's a bug. I'll put in a fix for it so that it works correctly for the start and stop time being the same minute.

#131

No worries.

So here is the rule as it sits now. I think of the 4 ways I tried it, this is the cleanest looking.

#132

You could simplify it even more:

IF (Time between 8:29 AM and 4:01 PM) On: Elliptical
IF (Time between 9:29 PM and 9:31 PM) Off: Elliptical

#133

True. But the shutoff time is the same on all days. If it’s not 9:30 pm, the only other choices are times you want it turned on. It will only be triggered at the three times you specified in the trigger events.

#134

Ok, this is it for today. I have other toys I need to play with.

#135

Did you ever figure this out? I am having the same problem getting a simple repeat to work correctly. I've tried it 3 different ways and still nope...

#136

#137

Thanks! I got my answer here actually (in case anyone else is searching too), wasn't triggering the rule correctly. Rule Machine - This is Frustrating the Heck Out of Me

#138

@bravenel s it possible to set a bulb colour based on a variable or based on another devices attribute?

#139

Yes. Hue, Saturation and Level of a color bulb can all be set from a variable. A variable can be set from any device attribute you want, and hence so could colour be using a variable as intermediary.

#140

Sorry I mean the opposite - I have a number in a variable, and I want to use it to set the hue of a colour bulb

#141

Yes, that works.

#142

I must be being stupid - I can't find where to do it. If I go to set colour there is no from variable option

#143

Just put `%variable-name%` into the field where it asks for the Hue value. This will work for most numeric value input fields in RM.