Good Night Routine Piston firing twice!?


#21

LOL…oh. okay.

Also, with “Stays” as a trigger, that will only happen when one of the motion sensors changes to inactive and then remains that way, you know that part right?

Also, I’m surprised you have such a low timeout for your motion sensors. I have mine set a little longer than that and occasionally I have the lights turn off on me. sitting watching tv or eating a meal, it’s possible for your motion to be masked from a PIR sensor.


#22

This is the point of this piston. It detects when there is no motion downstairs and then does the Good Night Routine that turns all the lights off, blah, blah. It usually takes longer than 10 minutes because all the motion sensors have to be inactive for 10 minutes.


#23

Yeah…you think that’s going to be enough to be able to not trip accidentally?


#24

Well once the routine goes it is done. So if someone goes downstairs and motion goes and the light goes on it will go back off based on other pistons. I had to do this because hubitat doesn’t have Routines.


#25

Okay. I only question doing this based off of motion. I have a piston for Goodnight but I run it via google home or a button on my bedside.


#26

This didn’t work again until I changed the boolean wastrigger=false at the top. Then it seemed to work.


#27

I used wasTriggered is not true when I initially modified the piston because I wasn’t sure if wasTriggered =; will evaluate to false without testing it while coding the piston.

On a PC I did try to evaluate the wasTriggered =; and it does come out false, what I am not understanding early this morning is why wasTriggered is not true didn’t work to begin, I probably need more caffeine.

Edit: Also just for my ocd say, please drag the trigger with the lightning bolt (line26) to the very first line (above
the Time condition) after your IF. Knowing that pistons evaluate from top to bottom just eases my mind that when the trigger happens, it doesn’t have to go up one line and then down again to evaluate the rest of the statements.


#28

OK, I will make the change and see how it goes tonight. I will leave the wasTriggered =false at the begginning though.


#29

That is fine if it worked better in your test.


#30

It still fired twice last night but the logs don’t go back that far. I can’t figure out why it is doing it twice.


#31

What does your latest code look like? Also when replying, click the one right under the person’s post (not the blue one) so they get notified of your reply.


#32


#33

The wasTriggered variable up top needs to be set dynamically, if you set the value as false from the beginning, it will always be false when the piston runs. In this case, the piston will always run because it clears the restriction of not being true.


#34

OK, so I need to take out the =False again. It didn’t run when I tried it like that last time but I will try it again.


#35

I’m at a computer today so I can play with this a little in a test piston.


#36

OK Thanks! I appreciate all your help!


#37

I only changed the top part… and I noticed I misspelled wasTriggered lol, so it’s up to you if you want to change that.


#38

OK, I have made the change. I will see how it goes tonight.


#39

This didn’t work again. It looks like it is evaluating the wasTriggered as true right off the bat, so therefore will never run. Here is a screenshot of the top portion of the piston. The logs don’t go back to last night but I was watching it while lying in bed and it was just stuck at the top never going any further.


#40

When you say it didn’t work, it fired more than once? I do see my mistake here I think, the restriction encloses the every day timer making it not reset.

I see the wasTriggered was set to true which means it fired, it’s just the timer will not reset it to false at 7AM.