CoRE On/Off Light if motion/no motion since

Hello,

I want to switch ON kitchen light if there is a motion detect and illuminance is less 20lux (this part is ok), but I want to turn off if there are no motion since 3 minutes.

I use IF/Then but my light turn OFF after 3 minutes with or whithout motion detection :frowning:

But Core is just amazing, I discover today ST and it’s so friendly use (before I’m on Vera)

Thank you

This will do it for you.
Note the cancel on piston state change
This means that whilst there is motion the light will not turn off.
In your piston when you go to the action for wait and turm off, scroll down and enable cancel on piston state change.

3 Likes

There are several ways to skin a cat. Here is another way you can accomplish your end result. This is a latching piston. Instead of setting a timer initially to turn the light off and relying on the cancel to stop it I am monitoring the motion for staying inactive for my desired time.

2 Likes

I do not have any lux sensors. I uploaded my example to show how a latching piston could be used instead of adding all those restrictions. They already figured out how to get the light to do what they wanted but could not get it to turn off properly. So this would probably be the easiest to edit their current piston.

Perfect I try the 2 solution.
C1arkbar I try your solution now it s work but I wait to test more.
I have a fibaro sensor :slight_smile:
I am happy to see its working nice.
I like this kind of solution.

@anon36505037 Thank for your explanation I search because i’m in Normal mode more easy with this explanation

1 Like

@bobbles I try your solution but I have a problem if my sensor is inactive 3min after my light switch off but I’m now again in the kitchen and my light turn on again.

I want my light turn off stay inactive 3min only but I keep your process to use in a other room, I’m not a expert but my wife knows what she wants (not a misogynist message because is Kitchen, It’s just a coincidence)

1 Like

I have done something similar but using both CoRE and the smart lighting smart app. I set smart lighting to turn on my daughter’s bathroom light when there’s motion and to turn it off 2 minutes after motion stops. The problem I was having was if the light was turned on manually and no one walked into the bathroom, then smart light would not turn the light off as smart light turns does its thing after motion stops but it doesn’t register doing that unless motion started in the first place.

I set up CoRE to turn the light off after a period of time if the motion sensor shows as inactive which allows the automation to run wether motion had started or not. I also noticed that using the toilet when people aren’t very active, the lights would go off without warning. To fix this I set CoRE to dim the lights to 2% for 10 seconds before turning the lights off, letting you know if you don’t move soon the lights will go out. Any movement after that restores the light to its previous level.

The Piston looks so complicated but it’s really simple and it works rock solid 100% of the time and evolved over time and trial and error.

Also, the reason I use smart lighting to turn on the lights is that my motion sensor and light are both run locally along with smart lighting, so that basic automation will run even if I don’t have an Internet connection. CoRE is there to do the heavy lifting when there is Internet but it’s good having a backup automation.

How do you run the Core Piston and the smart lighting together? Won’t there be a conflict?

Core will turn off the lights at 115 seconds and if it does Smart lights won’t run, but without core running smart lights turns it off at 2 minutes (120 seconds) so they don’t conflict.

1 Like

Here is how I typically set up my motion controls. It uses a second “OR” condition to guarantee a state change, which prevents the light from turning off if someone is moving around.

It also allows the lights to come on at a specific color temperature and brightness depending on time of day or mode, checks for lux, and is only active if the lights weren’t turned on by a switch or some other method (the “turnedOnByMe” variable). It also checks the status of a simulated “MotionEnabled” switch, which automatically gets turned off when nobody is home to shut down all the motion sensors. (I don’t want the silly cat tripping lights on and off all day :slight_smile: )

I’m still experimenting between using the “Wait” task, and “Stays inactive for
” to determine which I like better. I’m leaning towards the Stays function for simplicity, but the Wait works fine.

1 Like

Sorry for hijacking the thread. @bobbles, I have used a modified version of your piston as below.

I am trying to achieve the following.

  1. Turn on light on motion, only if outside lux value is <=1500.
  2. Turn off the light if no motion for 5 mins between sunrise and sunset.
  3. I would like the light to stay on for 5 mins and then turn off if manually turned on and not triggered by motion sensor.

Can you please let me know how I can amend the above piston to satisfy No.3? I haven’t tested 1 and 2 yet as I am away from home.

You could put in another group in the IF statement.
So you have:-

IF
First group.
Kitchen Motion is active
And
smartweather etc. etc.
OR
Second Group
Kitchen Light changes to on

THEN
Using Kitchen Light
Turn On.

ELSE
As you have already specified.

I would also on the first page of the piston, scroll down to advanced options.
Click on the + symbol
Where it says ‘Disable command optimisation’ put the slider to the right so that it is active.
This way the piston will ignore whatever state the device is in and run.
I’m not sure if you need expert mode enabled for this or not. I always have this active anyway.
This can be done in the settings for CoRE.

You will have an issue though if it is not between sunset and sunrise and the light gets turned on. It will not turn off. You might want to get rid of that restriction.

@bobbles thanks for the help. I will try this. I don’t want the light to automatically turn off between sunset and sunrise. I want to handle this manually.

@bobbles, I have now changed the piston based on your inputs. I have changed CoRE to expert mode, but couldn’t find anything under Advance options to ‘Disable command optimisation’. Can you please help me where this exactly will be? I looked under each condition screen and the screen which shows all the groups. Below is how the piston looks now.

When you go into
Automation -> SmartApps
you will see the CoRE app.
Click on it and open your piston,
Scroll down and you will find Advanced Options.
Click on it and you will see Disable command optimisations.

If it doesn’t appear you may need expert mode enabled.
To do this->
Automation -> SmartApps
you will see the CoRE app.
Click on it and scroll down and open settings.
You enable expert mode there.

Legend. All sorted now :).

I just hope the piston works OK. :relaxed:

I can only properly test it on Friday as I am home all day. Hopefully it should be fine :slight_smile:.

@bobbles, not sure why, but the lights don’t turn on or off as stated in the piston
 :frowning:

Don’t know why. It should work.
Take out the change only in the else.
This won’t make a difference but isn’t needed.
Go into the dashboard and watch the piston.
Does it ever go blue (true) when you either have motion (change the lux to greater than for testing if it is above the value set) or turn the light on.
EDIT: Check to make sure mode is home.

1 Like