Complex Lighting Routine Help Needed

Trying to figure out with combinations of routines & virtual switches on how to do this logic:

Basically I want the light to turn off after X minutes but only if no motion has triggered during the time. If motion DOES trigger, then after it stops – turn off lights after X minutes.

I’d use a virtual momentary timer (let’s call it Light Timer) with auto-revert set to X minutes. Then I’d have a routine that says:

if Light Timer is off (precondition)
“Motion Sensor” has no motion for X amount of time
turn off the light

and a second routine to reset Light Timer if motion is detected:

If “Motion Sensor” detects motion
Turn on Light Timer

Momentary timer? Never heard of momentary timer. What edge integration has that?

Or maybe you meant button?

Are you in a region where the Smart lighting app is available?

If so, that’s part of the standard behavior for motion triggers in Smart lighting. No jumping thru weird virtual switch settings or adding extraneous devices.

I’m probably over simplifying this, but why don’t you use a routine to turn lights off only when no motion is detected for x minutes.
Example :point_down:

1 Like

I think in both of your our examples (simple routine and smart lighting) that if there was never any motion to begin with, it will never turn light off. The counter only starts when motion goes from ON to OFF.

Hmm… possibly so. I’ve only got one motion sensor and if you enter the space it covers, the lights for that space go on. Maybe if I slid my hand carefully around the corner, I could turn the lights on and the not enter the garage… but why would I?

Are you trying to light an area that isn’t “visible” to the motion sensor? Or trying to account for manually turning the light on from a location not visible to the motion sensor?

I still feel like you’re over-thinking this.

I’m interested in your scenario. I can’t think of what purpose this would serve, but it’s questions like yours that bring me here. I like learning of new ways to use automation.
In my kitchen I have a light over the sink. It turns on with motion but only after 1. -20min from sunset or 2. Iux falls below 50. Sometimes I want that light on outside of these conditions so I manually turn it on (heaven forbid we use our hands, so I ask Alexa to do it) The light will stay on unless 1. I manually turn it off or 2. One of the above conditions turns true and now motion is controlling the light.
Now, if I want the light to turn off from manually being turns on and I’m outside of those conditions, the only 2 ways I can think of are 1. Using a virtual switch that is activated by another routine outside of my 2 original conditions or 2. If your switch supports reporting of manual presses and you can incorporate that into a routine. But I don’t think many switches do that.

Correctly working switches will update their state in SmartThings regardless of how the state was changed.

If you’re “manually” turning your switch on with Alexa, is there a reason you can’t also use Alexa to turn it off?

Yes, momentary button.

Too much multi-tasking :slight_smile:


Not sure how to quote/reply… but I have a basement that has 1 switch that controls all the lights in the basement. The kids play down there and the room with the motion detector doesn’t cover alot of the area. They also sometimes switch both the stairs light and the basement light on at the top of the stairs when they are grabbing something FROM the stair landing area (toy bins are kept there). But there is never any motion triggered on the motion sensor in this case. So yes, I need a timer as well as motion stopping.

Highlight the text you want to quote, you’ll get a little floating tag labelled QUOTE. Tap it and the forum software will do the rest.

I understand the use case better now. You could throw some money at the problem by buying a couple more motion sensors…

1 Like

There are two approaches for the timer here. First, using a virtual momentary button with a defined auto-revert interval which can be used as a trigger to evaluate whether the light is still on and turn it off. Second, would be to use the Edge Counter Utility from @TAustin to count elapsed time and then at some selected value (say 15 mins) then turn off the light.

You can combine one of those options with motion conditions to set up your routine.

1 Like

You misunderstood. Yes a switch will update it’s state in Smartthings. However there are, or were, switches that could report whether the physical switch was used as opposed to an automation.
My comment was me just thinking out loud trying to figure a reason for the OPs usage and give a possible solution.

There are times I do not want to use Alexa for turning lights on or off. Like when people are sleeping.

1 Like

Seems like that could be useful…