Motion Based Light EXCEPT when Manually turned On



Thanks…can I remove the last if? Not sure what that does…


yep, remove the last if and delete the define as well.




Thanks for the sample! Almost exactly what I needed! I want to take out your time frames, and figure out where to insert my “only when mode is x”, so this piston only runs in a certain mode…

The other thing id like to do is after the light has turned on because of motion, followed by 3 minutes of no motion, dim the lights 60% for 10 seconds, giving me a chance to wave an arm or go manually turn it on if I want it to stay on before completely shutting off! Any chance you could help me with this!?


sure. have you already tried modifying the sample to fit this use case? how may i help?


I honestly don’t even know where to start.


ok. the sample i posted here allows use of dumb switch to force the light to stay on when you are not moving around but sitting somewhere reading a book and there is no motion for the motion sensor to pick up. this way you dont have to shake an arm and a leg every 5 mins. :slight_smile:

did you want that feature or you dont really need this?

EDIT: when i say dumb switch, basically its a smart bulb in a socket controlled by a regular switch. the bulb is connected to ST but the switch is not.


No I don’t have anything to use with that feature. It will only run at night so I’m not too worried about having to wave an arm if I really need to, or I can always just get up and flick the switch off then on to keep it on manually right?

I think I figured out how to set the mode restriction, now I just need to set it to give me the dimmer warning after three minutes of inactivity before turning off completely 10 seconds later.



thats great. between the wait 5 mins and turn off insert these 2 tasks:

set level to 60%
wait 10 seconds

but, the way that piston is right now, it only turns off 5 mins after the last motion. so, if there is continued motion after the light turns on, it wont turn off anyways.


So I used this backup code and noticed a large section is greyed out. should that be modified for my example? It does not show up when I screen shot, but it does when I am editing.

I had a similar piston in CoRE and when I rebuilt it in WebCoRE, it was not working as it did. So I dumped it when I saw this example. Thoughts?


i just imported the piston posted in this example with the code edsh2. i am not seeing any greyed out code.

did you use the orange button to restore the piston?

EDIT: i imported the piston with code u9et. i do see the greyed out code block. very strange. not sure what is happening.

please delete the greyed out code block.


OK, I have to delete them row by row which is cool. What does “programmatic” mean? Does that just mean the inverse of what the variable currently is?

Motion/Ambient Light/Previous State based lighting piston

wait, dont delete row by row. just select the if and right click on it in the gutter and delete that entire greyed out if.

did you mean !programmatic? if yes, then yes. :slight_smile:




sure thing.


OK I think I figured out my problem of why the timer does not turn off my lights. My “light” is really a GE Smart Switch. So when I turn on the light with motion, it is turning on my switch. Is there a feature of physically turning it on vs turning it on with automation?


I have the ge "dimmer "switches. And they can’t discern from programmatic or manual. I have tried, but to no avail.


FINAL - Here is how I got around the physical switch issue. I used a variable that the motion sensor turns to true, and when the lights turn off after motion changes to inactive, the variable goes false. So if the switch is physically turned on, the variable does not change and then the lights stay on. Thanks for helping me think through this.


after the light is turned on by motion and before it turns off, if there is motion again say 30 seconds before the wait timer expires, does the light still turn off 5 minutes after that last motion?



no, this piston would reset to motion and then once the sensor changes to motion inactive, the counter goes back to 5 minutes. In my use case, I prefer it this way. I did move the row for the variable to change to false after the light is turned off. This will ensure I can move as much as possible and everything will go back to 5 minutes. Once the lights finally turn off, then the variable will become false. Thanks again for work through this with me.