Motion Based Light EXCEPT when Manually turned On



The problem you are going to run into is that it is very difficult to discern the switch turning on based on motion and the switch turning on manually. Also, if your motion sensor is in the room, and so is the switch, won’t it ALWAYS turn on by motion first? And now that the switch is on, you can’t turn it on again physically. It’s already on. So, to turn it on, you have to turn it off first. What you need is a second switch or button device to use as a manual override. MUCH simpler.


not really. this is already handled in the pistons in the first post in this thread.

this off course depends on the placement of the motion sensor. you could also always turn the switch off and on for manual override mode.


Then that would be a LOT simpler than what you have here. If motion is active and the light turn off followed by within X seconds turns back on, then set manual override. Much simpler, IMHO.

Isn’t that a lot easier and more reliable?


how does it get set to false?

once you type out the whole piston … it wont be any easier or any more reliable.


It gets set to false when you turn the lights off manually. Because they won’t be shut off by the motion sensor, because that is the whole point of the piston.

Alternatively, you could use this function to set a longer waiting period for the motion sensor to turn off the lights instead of the shorter one. Then when the lights turn off, you reset to the lower value of waiting for no motion.

The point is, I think that this is a way to get to the end goal. I’m not saying yours doesn’t work. I just think this is an alternative method that might be a little easier for others to be able to implement themselves.

Respectfully, I disagree.


well … share a working piston that does all of the same but is lot easier and more reliable.

without that there is nothing to compare to. :slight_smile:


I just did. :slight_smile:


yeah see that now. :slight_smile:

the original is 50 lines of code and this one is 55 lines of code without the setLevel. how is that any simpler? :slight_smile:

have you tried it … does it work? :slight_smile:


Why are you so eager to try to maintain that yours is the only solution? I didn’t say yours wouldn’t work. In fact I said the exact opposite. I just said that this was a different way to accomplish the same thing. And is a lot easier to follow, to me. So, why the hostility? I didn’t say your idea was bad or wrong or anything. But you seem hell bent to be the only one with the right answer. And I don’t understand that.

And on that note…I’m done with this thread. I really couldn’t care any less what you think or believe. Obviously it’s important to you that no one provide any alternative ideas, so I won’t.


when did i say mine was the only solution? or that your idea was bad or wrong? asking questions does not have to mean hostility - does it?

my last question was - does it work? if you have tested it and if it does work i will be happy to share your example from the main post.


Why believe me? Why don’t you try it out for yourself. That way you’ll know for sure.

There is a piston that I have that does something a little different that I’ve been using for years and uses no variables at all. This is more complicated because it’s setting different levels based on location mode but it doesn’t rely on variables to be set at all. And the best part…because of the LEDs in my bathroom lights, 85% is indistinguishable by the naked eye from 100%. So, setting them to 100% has no appreciable difference in the lighting and acts as a bypass, without have to set variables and set them back. So, here’s a 3rd way to do it.


And boiled down to JUST the motion sensing part.

Tell me THAT’s not simpler? That works 100% of the time.



I am using your smart switch, dumm light version with a Fibaro dual relay switch in my kitchen with 2 different lights, seen as independent z wave devices.

I am not managing to make this work, as if I enter both switches as necessary (and) in the logical expressions, the lights do not turn off.

Can you please help?

Thank you

Miltos Vidalis


you havent modified the piston in any way right? could you describe whats not working?


I had the similar problem using the first version (edsh2). I didn’t make any changes except the sensors and lights. I have the Hue bulbs with dumb switch. The lights were turned on with the motion but stayed longer and I had to manually turn them off. This happened three times in the last few days.


I’ve been using your piston “arhiy” to turn on a motion based light except when manually turned on. It is working successfully on a one light switch setup. However, I tried to get the exact same piston to work on my Homeseer three-way switches setup and it won’t work. The piston refuses to reset the “programmatic” variable to “true”, so when the light comes on based on motion, it stays on, whether the switch was manually turned on or not. Any ideas?




Does your lights work fine otherwise? I have a HS-WD100+ and add on switch and use this piston and it works flawless.


Yes, lights (both LEDs and lighting) work fine. Just does not work with motion detector properly. Light comes one when motion is sensed, but does not shut off after time limit of inactivity (when “manual ON” is not pressed on switch). As I mentioned, the “programmatic” variable is not setting itself to “true” at the end of the routine. Maybe I will delete the piston and rebuild it to see if that works. I thought it may have been a WD200+ and add-on switch problem, but i guess not if you got it working. Thanks.


@William_Engel, I may have mis-read your post. I missed that you were using the modified piston. I am using something almost identical to @bangali’s original one. I’m using “v9id” and I haven’t had any trouble.


OK. No luck with rebuilding the original piston. I will try v9id as you suggest. Thanks.


Can’t seem to find “v9id”. Can you steer me to it (also, is there a letter/number missing?)? Thanks.