Need help with lighting piston, want to dim or flash lights before turning off due to lack of motion


#1

1) Give a description of the problem
I want to setup my piston such that if my motion sensors stay inactive for 15 minutes, they will then briefly dim for 3 seconds, go back to their original brightness, then wait another 30 seconds, and then turn off. The dim is to let anyone know in the room that the lights are about to go off, and they need to move if they want them to stay on.

2) What is the expected behaviour?
(PUT YOUR INFO HERE)

3) What is happening/not happening?
I can’t figure out how to dim the lights and get them back up to the original value. I tried capture and restore local state, and also adjust level, but they were getting cancelled and not executing when motion changed to active again, so I took them out(they were in at line 48). The piston works okay as it is, I would just like a warning to those in the room to move, so they can move to keep the same lights on at the same brightness, before they all go out.
My goal is to that if there are only 2 lights left on, make those two lights dim to alert they will be going off soon, motion goes to active, and those two lights stay on for at least another 15 minutes at their original brightness.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Hi there,
1 - Conditions and tiggers…
Your first IF block has them reversed. I’d change places with line 8 an line 24
2 - When you use CHANGES TO INACTIVE - in your case - your piton will fire constantly because motion sensors can go back to inactive in 15 seconds.

I would recommend something like this,

IF any of the motion sensors STAYS INACTIVE 15 minutes
Then
With dimmers
Set level to 50
WAIT 10 seconds
Set level to 100
WAIT 30 Seconds
Turn OFF

IF any of the motion sensors Changes to active
Then
With dimmers
Set level to 100
Cancel all pending tasks…

When using WAIT you need to use NEVER CANCEL TASK
and when using NEVER CANCEL TASK you need to tell your piston that it’s ok to cancel TASK when this and that situation happens


#3

Thanks Ike… I did not realize that the order of the if statements mattered. And I guess I still don’t understand why the order of them is important.

But in your example, if I use NCT with the wait, how is that going to work? Because its during the wait times of 10 seconds and 30 seconds that I would move and trigger motion to keep the lights from coming back on, but if the task cannot be cancelled while waiting… Is this fixed by telling the piston that its okay to cancel the task? How do I do that?


#4

About the triggers and conditions read this one, it explains everything perfectly

It cancels the task ONLY if new motion is detected. Other wise it would be something like this:
You are in the room, but still, piston is executed, wait period started, you move around, motion detected, but WAIT has be done first, so lights will dim no matter what, and back to brightnes.
So you might have a little disco effect:)
I ussualy test first and post later but not in the house right now so i haven’t tested what I recommend. But I’m pretty sure it will work fine.

One other thing is,
I had the same problem with my wife’s office (she can be really still - i move around a lot so my office is fine) her lights were keep turning off after few minutes and she got annoyed by it fast:)))
So i started using a little different approach but needed to use variables and an outside trigger (something like Alexa or Zwave button or ipad etc) if you are interested in that approach I can share the piston.


#5

Thanks for you help… I made the changes you suggested(at least I think I did), but I’m still having a problem. My issue is that if I only have 1 light of the six on, once I do that first set level command, all six lights come on. And then they all go to 50% afterwards. If the one light was on at 75%, I want it to return to 75% when this is done. Like if I only have 1 light on dimly watching TV, I don’t want them all to come on and stay on. I thought the set level would only set the level of the dimmer, but in this case it seems to turn any dimmers that are off to on?

I think I also have a problem with condition #20. I have it there so that when I walk into the room and a light is on, it won’t turn the rest of them on. But I think that is going to prevent me from getting back in there and cancelling tasks, because it can’t go back in unless all lights are already off. So I need to change this somehow…


#6

So I think I figured out the workaround to my condition #20 above. But what I don’t know how to do is setup condition #15 below such that the lights that are currently off stay off.


#7

If you want different lights to do different things you might want to consider creating a seperate piston for them. I’m not sure what exactly you want but even if they are in the same room, splitting them in two piston maybe the way to go…

Plus if they need to do seperate things I 'd recommend not grouping them with a variable…

or you will create more complex codes with variables.


#8

So I think I figured it out… Might still be an issue with one or two cases and never cancel tasks, but it seems to do what I want. Now that I have it working, I might change out the set level command for flash or fade to or something like that, to make it simpler.


#9

I am glad it’s working.
I ignore the ELSE command entirely. (Somehow my brain couldn’t grasp how that works in webcore LOL) I have over 150 pistons and none of them uses ELSE…
In the future start trouble shooting from ELSEs:)