Rule Machine - Between Two Times Defination

I recently got my SmartThings hub and added 2 GE toggle switches to some outside lights. I love it so much, I have a few more sensors and switches on the way. Because of this, I have been trying to figure out some of the additional SmartApps like Rule Machine and thus far, it looks very powerful. While playing around, I tried the specific time setting and I’m confused on what the "Between Two Times means in which I have to enter a start and end time.

What I want is a light to come on at 4:50 am when the lux lever is <50. I have everything setup, but for the time, I have to enter a between time. I have start 4:50 am and end -30 sunrise. I’m wondering if this event will fire anytime between those time or will it fire at 4:50 am like I want.


Hi Ed! Welcome to ST and the community.

We have a thread that specializes in helping out folks needing help with ST and rule machine. Take a look!

But, to help you out here…

Let’s make sure I understand this right.

You have a lux sensor and you want your lights to come on between the hours of 0450 and sunrise.

Now, do you want the lights on the whole time no matter what? Our, do you want them to be on ONLY if the lux value is less than 50?
And, do you want them to turn off before sunrise if the lux value increases over 50?

If you can give me specifics I can certainly help you out.

Hey thanks Jason for helping out. I have the SmartWeather Station Tile 2.0 installed as a device and I’m using the lux reading to make sure it is still dark outside. Ultimately what I want to happen is at 4:50 am for a light to come on and I’m using the status as off and the lux level below 50 as conditions.

However when it comes to setting a specific time I’m only given the option for between times (start/end) vs just a single time for this action to occur. I’m wondering if the between times mean the action can happen any time during that time window or will it occur at the start time no matter what as long as the condition is true. This morning it happened about 4 minutes after the start time even thought both conditions where true at 4:50 am.

I have an away routine to turn the light off.

I’m reading through to post you provided for additional tips and I noticed using the restrictions area may have a different meaning than what I’m thinking as this is where my specific time is set yet I still only see specific time takes both a start and end time instead of just a start time only.


The between two times can be confusing.

This is how I think of the different scenarios…

Trigger - when the trigger event occurs the actions are then done. So if the trigger event is your arrival home, the only time the actions will occur is when your presence goes from away to present. It doesn’t matter if you are home all night, it will not happen again until you leave and come back.

Conditional trigger - same as the trigger above except it has conditions. If your trigger is your arrival and your conditions are between 4pm and 6pm and the action is to open the garage door, the garage door will only open when you come home between 4&6 pm. If you come home at 6:16pm, the door stays closed.

A rule has no trigger event, only conditions. So the actions take place upon a rule truth change. If the rule goes from false to true, the actions for true take place. If the rule goes from true to false, the actions for false take place.

For example, your conditions are your present, the garage door is closed, and it’s between 4-6pm.

Actions for true, open garage door.
Actions for false, close garage door.

So, if you come home between 4-6 pm and the garage door is closed, the rule is true, this the garage door opens. Also, if you are at home and the garage door is closed and it becomes 4pm, the rule becomes true and the garage door opens.

So, the between two times is a condition to be true or false. It is also a restriction.

Trigger - an event must occur
Conditional trigger - an event must occur but these other criteria must be met as well.
Rule - all of the conditions must be true.

Does that make sense?

So in your scenario…

At 0450, if the lux is below 50, the light will come on. If the lux is above 50 it will not. But if the lux drops below 50 between 0450 and sunrise, it will come on.

The way I would do this is like this…

Rule - turn on light
Conditions - lux below 50, time between 0450 & sunrise - 12
Rule - lux below 50 AND time between 0450 & sunrise - 12.
Actions for true - turn on light
Actions for false - turn off light

This will have the light on between 0450 and sunrise as long as the lux is below 50.

If you use the between time in the rule, it is a condition. The rule is evaluated but found false if not in that time. So you can have actions for false occur if you want something to take place outside of that time.

You would use between two times as a restriction if you only wanted the rule evaluates between those times. Meaning all actions, true and false, can only occur during that time period.

:grin: :bulb: I think I got it now. If the action is true the event will happen at the start time of 4:50 am for me. However depending if the between time is a condition or restriction will determine when the rule is evaluated.