Good Night Routine Piston firing twice!?


#1

1) Give a description of the problem
This piston did as expected at about 10:00 last night and then at 1:30 in the morning it did it again and we all got notified on sonos.

2) What is the expected behavior?
For the piston to just do it once at night

3) What is happening/not happening?
Doing it more than once at random time.

**4) Post a Green Snapshot of the piston![image|45x37]

Can anyone help with this. I tried to to put a cancel condition on the top “IF” but then it didn’t run at all.


#2

If you’re really just expecting it to run just ONCE, then set a variable with the current day as the last task in your statements. Now use that variable as a restriction for the piston to run.

Add as last task in statements
lastDay = $day

Add as restriction
only if $day is not the same as $day

I think that should work.

Edit: Hmm I just noticed you have times after midnight so that might complicate my advice above… since the $day system variable updates at midnight.


#3

The reason that I have it set like this is in case my kids are up watching TV at 1:30am, I don’t want all the lights going off while they are still up.


#4

Instead of using lastDay variable you can just use wasTriggered = true then in the restriction you can add only if wasTriggered = false

Add a timer block at the bottom that resets your wasTriggered = false to a certain time a specific time that you see fit.


#5

How do I add this?


#6

Something like this… note that I did not try to select devices… I just wanted to show where the set variables and restriction would go.


#7

How do I get the “Only When” at the top? Can I put that in with my current piston?


#8

Enable restrictions…

image


#9

Thanks! I have changed it. I will see how it goes tonight.


#10

I’m slightly confused by why you’re using a time range and an then/else statement. The else part of the statement is going to run every time the If part is fase. Also, you added the variable setting…but you didn’t add it being false as a condition to the rest of your piston. Also, using a variable, isn’t going to help you get this to only run once. it’s going to be false even more so the Else part is going to run a whole bunch of times. Every time one of your motion sensors changes to active, the else part will fire. Every time one of your motion sensors changes to inactive but not all of them are, then else part will fire. Gotta remember, the else is VERY powerful. It just won’t trigger in the exact opposite of the If, it’ll trigger in ALL other situations other than the IF.


#11

@eibyer This didn’t work last night. The logs aren’t reporting that far back. But all the lights stayed on and nothing happened.


#12

The time range is there so that if the kids are up watching TV, the house doesn’t turn all the lights off on them. I figure they will probably be in bed by 2:00 am :smirk:. I do see your point about the Else. The variable is there so that the piston doesn’t run more than once as it did the other night when we were all tucked in bed sleeping it told us again at 1:30 that the house was going to night mode. So by adding the variable it would cancel the piston once it has run.


#13

But you don’t use the variable as a condition anywhere. You just set it. You don’t actually use it.


#14

The condition is used at the very top. Only while variable is not true


#15

Will have a look when I get back to a computer.


#16

OK I have changed it to what @Ryan780 was saying above. Instead of using the Else.


#17

You’re still not using the variable as a condition. If you want to use the variable being False as a condition of running the piston, then put it in there. Otherwise, you’re setting a variable for no reason.


#18

@eibyer recommended it this way. I am wondering why it wouldn’t work like this? The only thing I can see that might be a problem is what the variable equals to begin with? True or False?


#19

I’m sorry, I didn’t look up far enough to see you had it as a restriction. But can I ask why you chose the restriction as “not true”? I’m just curious.


#20

Not sure. You would have to ask @eibyer.