Why do I get two push messages?


#1

1) Give a description of the problem
I have created a piston, that turns off specific lights and sends a push notification, when it is done.
I wonder, why I get two push notifications, when the piston runs.

2) What is the expected behaviour?
Turn off lamps and send push notification.

3) What is happening/not happening?
The lamps turn off as planned, but instead of just one push notification, I get two. Seems like the piston does the ‘then’-part twice - like a ‘for’-loop, but I wouldn’t expect that.
EDIT: I have tested and noted that I also get two push notification if only one lamp is on, so it makes no sense to me, why it ‘runs twice’.

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

Since you are triggering on natlamper devices and also change them, it could cause an issue. Note when you have a trigger like ‘switch is on’, the piston will be triggered by any change to the switch so that in can check whether it turned on or off. Since this happens quickly, it could trigger again before the device actually turns off which would send you another notification. I would try a couple things: First, put the turn off after the push notification. If that doesn’t fix the problem, try adding a delay of 1500 msec to the beginning of the piston to give the device time to switch status.


#3

Thank you for your answer.
I tried putting the turn off after the push - didn’t change anything.
I put a WAIT after the turn off - didn’t change anything.

When you say, I should add a delay to the beginning of the piston? How do I do that?


#4

Add a delay by itself before the ‘if’. You will have to add it to the end and drag it up to the top. Just click on the add statement at the bottom of the piston and then ‘add action’ and add the wait. Once created, drag the ‘with’ statement up to the top.


#5

Perfect - that fixed it.

Thank you very much :-).