[RESOLVED] Issues with lighting "Wait"

light
motion

#1

1) Give a description of the problem
The lights are turning off as the wait timer is not being reset (If I remote the “No Cancel” policy the light never shuts off.

2) What is the expected behavior?
That the light turns off after X minutes unless motion is detected then the timer resets

3) What is happening/not happening?
After the wait, the light turns off no matter that there is active motion.

**4) Post a Green Snapshot of the piston

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)


#2

Try adding a cancel all pending tasks to the last if statement.


#3

You could also try using the Trigger “stays Inactive for 2 minutes”.

Then you don’t need the wait. it’s a trigger that happens when the internal timer is done. So your motion sensor will send an event to the piston that it is inactive…then WC will set an internal timer to check again in 2 minutes. If the motion sensor is still inactive the trigger will fire. Otherwise it will essentially reset itself (as it is no longer inactive).


#4

Giving that a try, here is the updated piston:


#5

You are making things WAY too complicated. Why are you using a variable as well as the switch? Here’s an example of the most complexity you really need.


#6

The Variable was the only thing that helped differentiate from the wall switch select and the motion trigger.


#7

So, if turned on from the wall switch, you don’t want the lack of motion to turn the switch off? Your last expression changes your variable to false whenever the switch is turned off, so the first expression, which says that only when the variable is true to activate the lights will never happen. I think you are making this more complicated than it needs to. If you really don’t want the motion to turn the switch off it’s it turned on physically, then I would recommend something like this:

But you may want to consider timing as well. Which will trigger first, the switch or the motion? I’m not sure of the physical space you are setting this up in but remember that motion trips usually will take longer to register, so that might end up overriding anything physical you have already done, so you might need to check that the switch is still of in the motion activated part.


#8

I have had a couple times where the variable was showing “true” even if light was off, so I set the variable to “false” on any off action. The first “IF” statement only checks if it is off, not what the variable is. I was going to add a new if statement if the variable was false and motion was inactive for a longer period.

I do think your physical would help in the scenario, thanks for the feedback I want to see how this works for a day or two but if not I may try your approach.


#9

“Physically changes” to on is an unreliable method to use. There aren’t too many DTH that 100% of the time accurately report that back to WC. So I do not advise using that.

This is why many people make a piston like the one here. They want the ability to know whether the motion sensor turned on the light or if the switch turned on the light. If motion turned it on, then let it turn off after the motion is inactive. But if the switch turned it on…then leave it on when there is no longer any motion.

I don’t see any issue with making a piston like that if that’s what you want to do. I also don’t consider it to be “overly complicated”.

Since “physically changes” cannot accurately be determined, this is a good solution to that issue.


#10

It doesn’t matter what the variable is when the lights turn on because when they turn on you are going to set it to whatever you want. You don’t care how they got turned off when you turn them back on, you only care about how they got turned on. Like it said, you might want to check that the switch is physically off in the motion part of the piston but that would depend on your physical layout.


#11

I don’t think it’s going to accomplish what you want but if it is then go for it.
Also, with dimmers you don’t have to turn on and set level, set level gets you to on all by itself.


#12

@Ryan780, the very first if checks if motion changes to active and the light is off. Then it turns the light on and sets the variable to “True”.


#13

Since motion trips are not instant, I think you are going to run into timing issues. But if it works, then go with it.


#14

Thanks for everyone’s help, it looks to be working well now with the “stays inactive” trigger now.