Motion Based Light EXCEPT when Manually turned On




thanks but don’t see a reference to this partial snippet you posted earlier?


Sorry that one doesn’t work either and that’s the one I used the wizard for.

This is the one from the snippet:


That’s where the time is on the very first post in this thread so I copied that.


right but that is so the light can always come on but at different levels during different times of the day.

for what you seem to want you should do what @rsmith179 suggested above.


That makes sense, I’ll try that.


In my never ending quest to complicate things, I’ve added a second bulb to this piston. So far so good, except that I can’t get the “turn off” timers to run concurrently and have to use a condition vs trigger to turn them both off.

1: No matter where I use “async”, the longer timer won’t start until the shorter one expires.
2: If I use a trigger instead of condition on line 50, the first “if” will fire but not the second.


select both the withs one by one under the if motion inactive block and change TSP to allow multiple and remove the asyncs.



Excellent. Thank you.

Thinking out loud here, but, on line 50, if I edit to “Changes to” (trigger), then once line 60 is evaluated, line 76 trigger becomes true and that action fires off, but also cancels my “turn off” timer (line 69).
Does any trigger in a piston restart it and cancel pending tasks? I guess I could use TCP to keep the timer running, but doing so would prevent the light from staying on if motion restarts, right?


yeah i cant think of a clean and easy way of getting this to work with 2 different timers. can be done but might be easier to use 2 pistons instead.


I used a variable to define two different timer times. I haven’t been able to do two timers within a single piston unfortunately.


if you change TSP to allow multiple its possible to use multiple timers in a piston but the logic does become tricky.


Went for something a bit different. Setup is a fibaro dimer and motion sensor with a dumb bulb and dumb toggle switch.


Hi bangali,

Can this edit two be done also with a toggle switch? I have a Xiaomi button. I like the idea of motion activated lights, however if a button is pressed the lights will not turn off every 5mins. Not sure if the logic can work with this device.


sure. in fact i am pretty sure i had done something similar for another user. i will check later to see if i can find it. if not i will modify this and share here.




try this:


@Drlungbarrow try this for setting up various rooms


I have kind of a mash-up of requests that made it impossible for me to get started on my own. If you give me the basic logic template, I’m sure I can take it from there, though…

  1. Lights should come on using a motion sensor
  2. Lights should turn off after 10 minutes of inactivity
  3. Lights should STAY on, if turned on with Google Home
  4. Light Level should depend on a lux sensor
    a) 35% if lux = 800-1000
    b) 70% if lux = 400 - 800

I’ve got all of this working (minus the “stay on” portion) in 4 different pistons right now, so like I said, I’m pretty confident that if you get me the basic logic structure, I can work out the kinks :slight_smile:



i dont use google home … is there a way for the piston to distinguish that the light was turned on by google home?

EDIT: note that there is a still a way to do this if the piston has no way to distinguish if the light was turned on by google home or manually. then when turned on by google home or manually the light would just stay on.

have you checked out this app? using a few settings often its possible to handle a entire room and its devices: