Piston stops executing at 'end every'


#1

1) Give a description of the problem
Piston execution stops at end every

2) What is the expected behaviour?
Piston would run to end

3) What is happening/not happening?
I have several timed events and an on events from that monitors a switch state. All of these set a variable named ‘action’.

Following all this, I have a switch ({action}) statement. The switch statement is evaluated as expected following the on events from, but not from the every day triggers.

The first log below shows when I turn the light switch on. The switch statement is evaluated as expected.

The second log is from the every day, at 10:04:00 AM event on line 49. The variable was set, but then execution stopped at line 52 and the switch statement was never evaluated.

It makes no difference where the every day events are placed in the piston.

I set things up like this so I did not have to duplicate the actions that are taken since more than one trigger can fire off the same group of actions.

Is this a bug?

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

5) Attach logs after turning logging level to Full

Expected behavior on events from switch:

|+14ms|╔Received event [Front Yard Motion Virtual Switch].switch = on with a delay of 103ms, canQueue: true, calledMyself: false|
|---|---|
|+42ms|║RunTime initialize > 41 LockT > 1ms > rtDT > 1ms > pistonT > 0ms (first state access 39 15 26)|
|+45ms|║Runtime (9373 bytes) successfully initialized in 1ms (v0.3.110.20201015_HE)|
|+46ms|║╔Execution stage started|
|+54ms|║║Comparison (enum) on is (string) on = true (1ms)|
|+55ms|║║Cancelling condition #84's schedules...|
|+56ms|║║Condition #84 evaluated true (4ms)|
|+57ms|║║Cancelling condition #83's schedules...|
|+58ms|║║Condition group #83 evaluated true (state changed) (7ms)|
|+60ms|║║Cancelling statement #85's schedules...|
|+63ms|║║Executed virtual command setVariable (1ms)|
|+66ms|║║Evaluating switch with values [[i:89:null:0, v:[t:integer, v:3, vt:string]]]|
|+68ms|║║Comparison (integer) 3 is (integer) 0 = false (0ms)|
|+70ms|║║Comparison (integer) 3 is (integer) 1 = false (0ms)|
|+72ms|║║Comparison (integer) 3 is (integer) 2 = false (0ms)|
|+74ms|║║Comparison (integer) 3 is (integer) 3 = true (1ms)|
|+75ms|║║Cancelling statement #112's schedules...|
|+77ms|║║Executed virtual command setState (1ms)|
|+83ms|║╚Execution stage complete. (38ms)|
|+125ms|║Setting up scheduled job for Wed, Dec 16 2020 @ 5:31:00 PM EST (in 26569s), with 3 more jobs pending|
|+127ms|╚Event processed successfully (125ms)|

Incorrect (?) behavior on timed event: (notice the ‘Evaluating switch’ entry is missing)

|+2ms|╔Received event [DFB House].time = 1608131040000 with a delay of 483ms, canQueue: true, calledMyself: false|
|---|---|
|+17ms|║RunTime initialize > 16 LockT > 0ms > rtDT > 1ms > pistonT > 0ms (first state access 15 3 13)|
|+20ms|║Runtime (9354 bytes) successfully initialized in 1ms (v0.3.110.20201015_HE)|
|+22ms|║╔Execution stage started|
|+31ms|║║Cancelling statement #105's schedules...|
|+33ms|║║Executed virtual command setVariable (1ms)|
|+36ms|║╚Execution stage complete. (14ms)|
|+64ms|║Setting up scheduled job for Wed, Dec 16 2020 @ 5:31:00 PM EST (in 26819s), with 3 more jobs pending|
|+65ms|╚Event processed successfully (65ms)|

#2

No, that is how ‘every’ blocks work. They are self-contained and outside the normal flow.


#3

Seems illogical, but ok. Is this documented somewhere? All I’ve found so far is

“The every statement, also known as a timer , is an exception to the default rule, because, due to its nature, it always runs asynchronously - see below for more details”

I don’t think this issue has anything to do with that, but perhaps it does.


#4

Mine do this too. You might try to put an ‘if’ block around your case statement saying

if action changes, do 
    switch {case}
    ....

Oh, also, you might need to remove that action=-1 at the beginning for this to work (just leave it blank)