Using CoRE with motion and lights

How do I configure CoRE not to run the turn off light switch, if the light is already on. And if light switch is off, turn it on, and if no motion in XX minutes, turn off.

This issue I am having, no matter what settings, the turn off in XX minutes always runs, even though the IF statement says to run only if the light switch is off.

If light switch is already on = do nothing.
This above does not work with CoRE. per settings in below image

If motion is is detected, and light is off = turn on
If there is motion within every 1 minute = stay on
If there is no motion every 1 minute = turn off
I have this above part working fine with CoRE

However, if the light is already on, CoRE still runs the turn off every 1 minute, and turns off the light, despite the IF that says to run only if the light if off.

So are you saying you don’t want the light to turn off if you already manually turned on the light? But you want the light to turn off only if the light was turned on with motion? Is that right?

Yes, that is correct.

I should also say.

The motion sensor is checking for motion about every 5 seconds, not the default 2-4 minutes.

And even when manually turned on, there will still be motion from time to time, but I want it to stay on.

If light is off, turn on with motion, but turn off if no motion every XX minutes


Okay. In this situation I would use a local variable to distinguish between a manual turn on of the light and a motion turn on. Try the following:

Motion Kitchen is active
Kitchen Light is off

Using Kitchen light…
-Turn on
-Set boolean variable (kitchenLight) to TRUE

AND IF (you may need to use a latching piston here, but it may not matter)
Motion Kitchen motion stays inactive for 1 minute
Variable (kitchenLight) is TRUE

Using Kitchen Light…
-Turn off
-Set boolean variable (kitchenLight) to FALSE

This way as long as the variable is false then the next time you manually turn on the kitchen light it will not turn off. You can also name the variable whatever you want. As for the sensor checking for motion every 5 seconds, that sounds like a setting on the motion sensor itself. Check the motion sensor settings in the SmartThings app or if your motion sensor has a jumper setting then you will need to physically change it inside the sensor.

1 Like

Hi @ndavis82 thank you very much!! Using a boolean variable did the trick!

I spent severail hours trying to get it to work with IF, THEN, ELSE, never knew or thought about using variables. The App was a little buggy when I was adding the variables, it would not save, kept telling me to verify the settings, so I just clicked the back arrow, and it saved the variable anyhow.

I purposely put the jumper on the test pins of the motion sensor to set it to check every few seconds instead of every several minutes for motion. I’m using the Ecolink Intelligent Technology PIRZWAVE2.5-ECO. I know having the test jumper enabled cuts down of the life expectancy of the battery, but for my case, checking for motion every 3 or so minutes was not working for me.

Thanks again!

1 Like

Glad it works! Variables can be a very powerful asset.