Motion Based Light EXCEPT when Manually turned On

manual
except
off
light
motion

#218

thanks, it is.
just cooked it up for OP.
right.


#219

You are DA MAN! I have two more questions:

  1. I assume it only works with booleans, correct?
  2. Does it also work on globals?

#220

works on any data type … always returns a boolean
yes


#221

Thanks to all the posters above; I’ve taken the examples for inspiration and adjusted for my use case:

I wanted the physical switch to pretty much continue to operate as a ‘dumb’ switch; but also add some motion controlled smarts for general use. I’m using the Aeotec Nano Dimmer (as I’m in the UK and the switches don’t work with my wiring).

The physical switch operates as an override to the motion detection, so if you switch it off, motion detection is ignored for the next hour. Operating the physical switch while it is in override mode just drops it back to motion detection controlled. This way if ‘someone’ forgets to turn the light off in override mode it will still eventually turn itself off…

I had a hard time understanding the logic in the first example post, as I didn’t realise that the ‘programmatic’ variable was actually a workaround to the piston not being able to differentiate ‘physical’ and ‘programmatic’. All in all good practice and a learning experience. Very open to any suggestions on how to optimise my code :slight_smile:


#222

I love this idea but would like some help with my situation. What I would like is for my motion to turn on my bulbs for 5 minutes and then turn off if no activity. If the light is manually (ST) turned on, then remain on until manually turned off. I have a “Sleep Switch” that I use that basically disables the motion during sleeping time (so the light doesn’t come on when we go to the bathroom and wake the other person up). In a strange way (timer set for 8 hours) I have the sleep switch turn off - thus the motion is reactivated. I also have a different piston that is supposed to turn on these same lights when my alarm goes off.
How can I incorporate all that into 1 (or 2) pistons? I can’t get my mind to think in combining so I have a ton of pistons running and I think they are getting as confused as I am.


#223

may be try rooms manager? :slight_smile:


#224

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.


#225

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.


#226

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?


#227

how does it get set to false?

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


#228

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.


#229

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:


#230

I just did. :slight_smile:


#231

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:


#232

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.


#233

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.


#234

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.

:smiley:

And boiled down to JUST the motion sensing part.

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


#235

Hi,

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


#236

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


#237

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.