The sub-piston is scheduling itself. Not sure why


#1

1) Give a description of the problem
I use Google Home Assistant to announce when a door opens. I use this as a sub-piston so that multiple pistons that get triggered can call it. When they do, they pass the door_name as a parameter. The sub-piston has some logic to only announce once every few hours (to not drive my wife crazy). In away mode, it also sends an SMS and an email.

2) What is the expected behaviour?
The sub-piston should run and be done.

3) What is happening/not happening?
sub-piston likes to schedule itself to run. I can’t seem to figure out why. I even tried putting a logic in that ensures that if it runs directly (as in with door_name parameter empty), it will simply not run.

4) Post a Green Snapshot of the piston![image|45x37]![sub-piston|278x500] (upload://xK8WwMCzoDkDrcB1Jf27yjtZ9bq.png)
(UPLOAD YOUR IMAGE HERE)

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)
Here is one. Why is it scheduling anything at 9PM? It clearly has something to do with my time constraint on when to broadcast.

11/29/2020, 11:06:40 AM +880ms
+0ms ╔Starting piston… (v0.3.110.20191009)
+303ms ║╔Subscribing to devices…
+344ms ║║Subscribing to Home.mode…
+408ms ║╚Finished subscribing (118ms)
+597ms ║Setting up scheduled job for Sun, Nov 29 2020 @ 9:00:00 PM EST (in 35598.523s), with 1 more job pending
+609ms ╚Piston successfully started (609ms)

Here is one more.
11/29/2020, 11:00:04 AM +312ms
+0ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 0ms
+153ms ║Runtime (60167 bytes) successfully initialized in 19ms (v0.3.110.20191009) (152ms)
+154ms ║╔Execution stage started
+202ms ║║the HTTP POST response with the brodacst message —Front Door is open— was {“response”:"",“audio”:"/server/audio?v=1606665600632",“success”:true}
+203ms ║║Executed virtual command log (1ms)
+206ms ║╚Execution stage complete. (52ms)
+208ms ║Setting up scheduled job for Sun, Nov 29 2020 @ 9:00:00 PM EST (in 35995.481s)
+217ms ╚Event processed successfully (217ms)
11/29/2020, 10:59:59 AM +59ms
+1ms ╔Received event [Home].time = 1606665600000 with a delay of -941ms
+159ms ║Runtime (60168 bytes) successfully initialized in 44ms (v0.3.110.20191009) (157ms)
+160ms ║╔Execution stage started
+191ms ║║This is started from another piston. Continue
+193ms ║║Executed virtual command log (2ms)
+206ms ║║Starting the Piston
+208ms ║║Executed virtual command log (2ms)
+211ms ║║Executed virtual command cancelTasks (1ms)
+224ms ║║Front Door
+226ms ║║Executed virtual command log (2ms)
+288ms ║║currentEventDate is Sun, Nov 29 2020 @ 11:00:00 AM EST
+288ms ║║previous_broadcast_time is Sun, Nov 29 2020 @ 9:00:00 AM EST
+289ms ║║Executed virtual command log (2ms)
+311ms ║║Executed virtual command setVariable (1ms)
+329ms ║║I see an event at LEAST 7200 seconds after the previous event
+331ms ║║Executed virtual command log (2ms)
+350ms ║║Executed virtual command setVariable (5ms)
+1184ms ║║Executed virtual command sendEmail (822ms)
+1285ms ║║This was triggered by Front Door. Enough time has passed or we are in AWAY mode. We WILL broadcast
+1286ms ║║Executed virtual command log (1ms)
+1300ms ║║updating previousChangeTime to Sun, Nov 29 2020 @ 11:00:00 AM EST
+1301ms ║║Executed virtual command log (2ms)
+1308ms ║║Executed virtual command setVariable (4ms)
+1312ms ║║Executed virtual command setVariable (1ms)
+1475ms ║║Executed virtual command httpRequest (150ms)
+1476ms ║║Requesting a wake up for Sun, Nov 29 2020 @ 11:00:20 AM EST (in 20.0s)
+1610ms ║╚Execution stage complete. (1450ms)
+1612ms ║Setting up scheduled job for Sun, Nov 29 2020 @ 11:00:20 AM EST (in 19.866s), with 1 more job pending
+1618ms ╚Event processed successfully (1617ms)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

As there are no explicit triggers in the piston it is looking to see if any conditions are important to you and finding you are interested in a couple of time ranges and changes to the location mode. So it schedules the piston to run at each end of the time range and also when the location mode changes. The lines where it is doing this are indicated with the ‘lightning’ icon.

You can edit those lines and tell the piston to never subscribe, however it would be simpler to enable the piston setting and disable ‘event subscriptions’.


#3

thanks. That is exactly what I needed.