Piston is not repeating or triggering


#1

1) Give a description of the problem
The push notification is not repeating (when the light remains on) and the trigger of stay any of home, away or vacation is not triggering.

2) What is the expected behaviour?
Piston will repeat the push until the light is off.

3) What is happening/not happening?
See #1

**4) Post a Green Snapshot of the

5) Attach logs after turning logging level to Full

Logs

3/20/2020, 12:32:08 PM +145ms
+0ms ╔Received event [Casa de Pines].time = 1584732729202 with a delay of -1058ms
+287ms ║Runtime (51686 bytes) successfully initialized in 242ms (v0.3.110.20191009) (286ms)
+288ms ║╔Execution stage started
+317ms ║║Executed virtual command setVariable (3ms)
+337ms ║║Executed virtual command sendPushNotification (17ms)
+340ms ║║Executed virtual command setState (0ms)
+344ms ║║Arabella RGBW was left on for more than 2 minutes @12:32 PM 20-Mar-20 MST
+345ms ║║Executed virtual command log (1ms)
+348ms ║╚Execution stage complete. (60ms)
+349ms ╚Event processed successfully (349ms)
3/20/2020, 12:30:08 PM +218ms
+0ms ╔Received event [Casa de Pines].time = 1584732609359 with a delay of -1141ms
+942ms ║Runtime (51686 bytes) successfully initialized in 422ms (v0.3.110.20191009) (940ms)
+943ms ║╔Execution stage started
+988ms ║╚Execution stage complete. (46ms)
+989ms ║Setting up scheduled job for Fri, Mar 20 2020 @ 12:32:09 PM MST (in 119.995s)
+998ms ╚Event processed successfully (998ms)
3/20/2020, 12:29:38 PM +998ms
+1ms ╔Received event [Casa de Pines].test = 1584732578998 with a delay of 0ms
+327ms ║Runtime (51680 bytes) successfully initialized in 271ms (v0.3.110.20191009) (324ms)
+328ms ║╔Execution stage started
+382ms ║╚Execution stage complete. (54ms)
+392ms ║Setting up scheduled job for Fri, Mar 20 2020 @ 12:30:09 PM MST (in 29.97s)
+401ms ╚Event processed successfully (401ms)


#2

I’d structure this piston a bit different.

Use one trigger as the MAIN IF BLOCK trigger (in repeat)

Repeat
   IF {light} switch stays on for {timelimit} minutes (main trigger)
       Then 
        IF Location is vacation, awat, home
        AND 
        IF Time is between X and Y
        Then 
        Do this do that

#3

Thank you, I will give that a try.

EDIT - Did not work. It worked when I tested but did not repeat or trigger by itself.


#4

Line 34 should be a condition not a trigger though,


#5

Repeat
Do This…
Until (what condition will terminate the Repeat?)


#6

I switched it to a condition but the same results


#7

What do you mean? It should terminate when the light is off


#8

You do not have a condition defined in your Until statement to terminate the loop.


#9

You MAY need a trigger at the top of you piston to initiate your repeat until. I don’t think that the Repeat Until can be initiated with a trigger from within the loop. Not sure about this one though. I have not tested it.

Execute
  IF X is true    <- Trigger
    Then
      Do
      Repeat
        Do Stuff
      Until Condition is false
  END IF
  Do other stuff
End Execute

#10

Isn’t the light staying on a trigger? I also tried an and location mode stay home, night and that didn’t trigger the piston


#11

I don’t think that you want to trigger a Repeat-Until from within the loop.

IF RGB Bulb 1's switch stays on for 2 minutes   <- Trigger
  Then
    Repeat
      Do Stuff
    Until RGB Bulb 1's switch is off

But you will need a WAIT inside the repeat to keep from firing off PUSH notifications every milisecond that the repeat loop is executed. And using WAITS with repeat-until loops can get messy.


#12

Ok I think I get what you mean. Is there an alternative to the wait. I finally got the notifications to work but as you mentioned I am getting the pushes every other sec.


#13

great catch… i missed that part.


#14

Others here may have a better solution, but I would use a WAIT right now and see how it works for you.


#15

I meant the wait isn’t working with the changes.


#16

Will you post a green shot of your piston?


#17

I have been testing the wait which is why there are two. Neither works.

Oddly enough, another piston I have uses a device local variable an even though the piston executes it doesn’t do anything to the devices within the list. Maybe these are related.


#18

Can you try something for me. I have had difficulty putting my devices into a variable and using the variable name in the code (like your line #17). Can you test just one light and replace lines #25, #33, #48 with a single light device name and not a variable? Then test that one light and include the log here.


#19

I can but to be clear. I am getting notifications when I run the test (on this lastest piston) but the notifications repeat (as you mentioned previously).

I wonder if I have to save the device lists into a variable similar to my question a few years ago here. Variable loops in notification piston

Ex. I was able to get this piston to turn off the lights but only when I used individual bulbs in the piston and not use the device list.

3/21/2020, 11:43:50 AM +41ms
+1ms ╔Received event [3rd SYLVANIA BR30 RGBW].switch = off with a delay of 195ms
+9546ms ║Piston waited at a semaphore for 9266ms
+9549ms ║Runtime (52467 bytes) successfully initialized in 9498ms (v0.3.110.20191009) (9546ms)
+9550ms ║╔Execution stage started
+9585ms ║╚Execution stage complete. (36ms)
+9586ms ╚Event processed successfully (9586ms)
3/21/2020, 11:43:49 AM +966ms
+1ms ╔Received event [2nd SYLVANIA BR30 RGBW].switch = off with a delay of 252ms
+9560ms ║Piston waited at a semaphore for 9269ms
+9563ms ║Runtime (52467 bytes) successfully initialized in 9509ms (v0.3.110.20191009) (9561ms)
+9564ms ║╔Execution stage started
+9602ms ║╚Execution stage complete. (38ms)
+9603ms ╚Event processed successfully (9603ms)
3/21/2020, 11:43:49 AM +199ms
+0ms ╔Received event [Casa de Pines].time = 1584816230405 with a delay of -1207ms
+307ms ║Runtime (52403 bytes) successfully initialized in 252ms (v0.3.110.20191009) (306ms)
+308ms ║╔Execution stage started
+341ms ║║Executed [1st SYLVANIA BR30 RGBW].off (3ms)
+356ms ║║Executed [2nd SYLVANIA BR30 RGBW].off (14ms)
+370ms ║║Executed [3rd SYLVANIA BR30 RGBW].off (12ms)
+1239ms ║║Executed [1st SYLVANIA BR30 RGBW].off (4ms)
+1244ms ║║Executed [2nd SYLVANIA BR30 RGBW].off (3ms)
+1248ms ║║Executed [3rd SYLVANIA BR30 RGBW].off (4ms)
+1251ms ║╚Execution stage complete. (943ms)
+1252ms ╚Event processed successfully (1252ms)


#20

I have had the same experience.

So it is working. Good. Maybe making the change to the device list as you have suggested will work. I am interested to see if it does!