I have a situation where there is a z-wave motion sensor right above a z-wave light switch. The client would like the motion sensor to turn the light on when there is motion and then turn it off after 10 minutes of no motion. No problem. But he would also like to be able to push the light switch and have this override the off time, basically keeping it on until manually turned off.
Has anyone seen a way to know if the light was on because of a switch being pressed as opposed to the motion sensor. Given their proximity to each other there is no way to turn on the light without tripping the motion sensor.
You’ll need an instant status switch or a scene controller to do what you want, I believe. Since you are not using an instant status switch or a scene controller, the light ends up ON with a 1 status, so he will have to shut it off to get a signal back to vera.
A very easy alternative would be to turn the light on and leave it on for say, 8hrs. It would get shut off by hand and you could have it come right back on (for your 10min). Just compare the timestamps between the motion detection and the light off, if it was less than say 10seconds, turn it off.
So, he has to turn the light off for it to automatically turn off in the 10mins and he will be momentarily in the dark while Vera acknowledges the status change.
it is the same physical steps, but not exactly what you want, and a little kludge. Perhaps your client will pay for a new switch…
I would replace the switch with a Fibaro FGS221 dual relay module behind a normal toggle (on/off) switch-plate. Use the S1 relay to control the light. Connect the toggle switch to the S2 input. If Fibaro isn’t available, another brand of module could be used. Two singles could be used if there is room behind the switch. Instant status is not essential but always an advantage.
When PLEG sees the motion sensor trip with the light off, it turns on the S1 relay and starts a ten minute Self-ReTrigger timer. Motion trips while the light is on cause a restart of the timer. When the timer ends, if the S2 switch is off, turn off the light otherwise ignore. When the S2 switch is turned off, restart the timer for thirty seconds to allow time to get away from the motion detector. The light will then be turned off when the timer ends.
Triggers Motion Motion sensor tripped LightOn Light is turned on SwitchOn S2 switch is turned on
Schedules Timer10 On: Self-ReTrigger Off: Interval 10:00
Conditions DoOn Motion and !LightOn and (!LightOn; Motion) DoMotion Motion DoExit !SwitchOn and (LightOn; !SwitchOn) DoOff LightOn and !Timer10 and (LightOn; !Timer10) and !SwitchOn
Actions DoOn Light on DoMotion PLEG StartTimer timerName=Timer10 DoExit PLEG StartTimer timerName=Timer10 intervalTime=30 DoOff Light off
Thanks @ Ds514. SmartSwitch seems to do what I’m looking for. I’d like to replicate the logic in PLEG as I have a lot of these to do and am concerned about the overhead of installing a bunch of child devices. I understand the logic but I can’t see how SmartSwitch knows when the switch has been pressed as opposed to motion turning on the device. Anyone have any ideas? Or perhaps, if in fact the overhead of a bunch of child devices is minimal and I should just go that approach?
I also just realized that I need some of these to only work at night which isn’t built into SmartSwitch so would be really good to get the same logic into PLEG. Any thoughts? Thanks again for the help.
I was using smart switch with scenes to change them based off day night trigger with that app. It worked well until my network got bigger and I had lots of smart switches. Things started to bog down. I converted to pleg and won’t look back. I am still learning and coding is one thing that is above my head but I did get it to work for my needs for motion detection in the evening. I don’t have a need to manually have lots stay on unless I am entertaining in which case I have my scenes setup to turn on the lights I want and then disable pleg so the automation stays off. Works well so far and much quicker response versus smart switch.
Thanks guys. I currently use PLEG for everything and love it. I also use the Day/Night app and it’s been great. What I’m trying to do is to get the logic of SmartSwitch into PLEG so that I can avoid using scenes and SmartSwitch. I’d love to just keep everything in PLEG. I don’t have any problem setting up the Condition and Action in PLEG to make this work, but I don’t see what input to use to know that the switch was pushed rather than the motion sensor turning the light on. Somehow SmartSwitch is able to differentiate between the two. That’s where I’m stuck. Any help would be appreciated.
this is exactly what I was looking for, tried it, it turns the lights on but the DoExit doesn’t seem to restart the timer to the shorter . Any ideas what I’m doing wrong.
Please use the Status report so we can see the sequence of events. (i.e. we need to see states and timestamps).
You do not need to hide the license … It will only work for your Vera.
I have to look into the behaviour when you RETRIGGER with an alternate interval … in particular with a shorter one.
I think it will not fire until the original longer interval. I can’t actually cancel a timer. So I count how many are outstanding … and respond when the last one happens.
When you try to shorten the interval … they can happen before the original time … and will be ignored … while it counts down to the final timer.
When I checked the logic, re-triggering the timer with a shorter interval seemed to work correctly. If there’s some doubt about it, we could add a second timer for the exit phase.
It does look as though the timer interval did not get changed by the DoExit action. See if this works any better:
Triggers Motion Motion sensor tripped LightOn Light is turned on SwitchOn S2 switch is turned on
Schedules Timer10 On: Self-ReTrigger Off: Interval 10:00 TimerEx On: Self-ReTrigger Off: Interval 30
Conditions DoOn Motion and !LightOn and (!LightOn; Motion) DoMotion Motion DoExit !SwitchOn and (LightOn; !SwitchOn) DoOff LightOn and !SwitchOn and ((!Timer10 and (LightOn; !Timer10)) or (!TimerEx and (LightOn; !TimerEx))
Actions DoOn Light on DoMotion PLEG StartTimer timerName=Timer10 DoExit PLEG StartTimer timerName=TimerEx DoOff Light off
Great Solution Rex, that did the trick.
Can I ask for some more help please?
I’m adding a variable light level condition based on time of day and whether the bedroom light is on DimLevel !Bedroom and (11:00:00; PIR) ? 10 : 100
Got that bit working, the thing I’ve not figured out yet is how to retrigger DoOn if the Bedroom light is turned on after the Halo lights are turned on.
I tried DoOn PIR and !Halo and (!Halo; PIR) or (Halo; DimLevel)
which seemed to work but only when you turn the bedroom light on, when you turn it off the Halo light remains at 100%
that did the trick, many thanks, the more you tell me the more i understand what’s going on, fantastic learning experience :kudos: to you.
I’ve attached the penultimate status report I added mirror to the DimLevel condition because if mirror is turned on I want the Halo to be 100% works great. There is only One fail mode that I’ve found, but I think this is a limitation of PLEG rather than bad code.
its after 11:00:00 (will be 23:00:00 in final PLEG but this allows me to test)
PIR turns on Halo to 1% (was 10% in previous status reports) GREAT
If I turn on Mirror (Halo turns on 100%) GREAT
Turn off Mirror, Halo goes to 1% and TimerExit starts GREAT
Oops! I forgot to clean my teeth and turn Mirror back on, halo turns back to 100% but after n seconds remaining of TimerExit the halo turns off. NOT GREAT
Seems like we need the ability to set/adjust/reset/clear the schedule of PLEG
Cheers.
Best Home Automation shopping experience. Shop at Ezlo!