Async Piston does not work

execution

#1

1) Give a description of the problem
I want, that the to while loops runs at the same time. If they are finished, the last statement (light 100%) should play.

2) What is the expected behaviour?
Both loops runs at the same time, when they are finished the light gets switched to 100%

3) What is happening/not happening?
The first loop runs, but the 2nd don’t.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full

+2ms ╔Received event [VSwitch-TEST].switch = off with a delay of 155ms
+66ms ║RunTime Analysis CS > 19ms > PS > 5ms > PE > 42ms > CE
+69ms ║Runtime (45713 bytes) successfully initialized in 5ms (v0.3.113.20210203) (65ms)
+70ms ║╔Execution stage started
+79ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+81ms ║║Cancelling condition #2's schedules...
+82ms ║║Condition #2 evaluated false (5ms)
+83ms ║║Cancelling condition #1's schedules...
+84ms ║║Condition group #1 evaluated false (state changed) (8ms)
+86ms ║╚Execution stage complete. (16ms)
+91ms ╚Event processed successfully (91ms)
11.5.2022, 21:46:57 +52ms
+0ms ╔Received event [Mein Zuhause].time = 1652298409600 with a delay of 7452ms
+49ms ║RunTime Analysis CS > 12ms > PS > 5ms > PE > 31ms > CE
+51ms ║Runtime (45722 bytes) successfully initialized in 5ms (v0.3.113.20210203) (50ms)
+52ms ║╔Execution stage started
+127ms ║║Executed physical command [null].off() (44ms)
+128ms ║║Executed [VSwitch10 (Emergency-Alert)].off (47ms)
+131ms ║║Executed virtual command [VSwitch10 (Emergency-Alert)].wait (0ms)
+133ms ║║Requesting a wake up for Wed, May 11 2022 @ 9:47:52 PM CEST (in 55.0s)
+138ms ║╚Execution stage complete. (86ms)
+139ms ║Setting up scheduled job for Wed, May 11 2022 @ 9:47:52 PM CEST (in 54s)
+146ms ╚Event processed successfully (146ms)
11.5.2022, 21:46:48 +173ms
+1ms ╔Received event [Mein Zuhause].time = 1652298409600 with a delay of -1427ms
+6085ms ║RunTime Analysis CS > 38ms > PS > 6016ms > PE > 30ms > CE
+6086ms ║Piston waited at a semaphore for 6012ms
+6088ms ║Runtime (45800 bytes) successfully initialized in 6016ms (v0.3.113.20210203) (6086ms)
+6089ms ║╔Execution stage started
+6090ms ║╚Execution stage complete. (1ms)
+6091ms ║Setting up scheduled job for Wed, May 11 2022 @ 9:46:49 PM CEST (in 1s)
+6098ms ╚Event processed successfully (6098ms)
11.5.2022, 21:46:44 +94ms
+0ms ╔Received event [Mein Zuhause].time = 1652298405779 with a delay of -1686ms
+63ms ║RunTime Analysis CS > 29ms > PS > 5ms > PE > 30ms > CE
+66ms ║Runtime (45725 bytes) successfully initialized in 5ms (v0.3.113.20210203) (65ms)
+67ms ║╔Execution stage started
+102ms ║║Cancelling statement #8's schedules...
+115ms ║║Executed physical command [Ofen 1.1].setColor([[hex: #00e645, hue:38, saturation:100, level:45]]) (6ms)
+116ms ║║Executed [Ofen 1.1].setColor (10ms)
+124ms ║║Executed physical command [Ofen 1.2].setColor([[hex: #00e645, hue:38, saturation:100, level:45]]) (4ms)
+125ms ║║Executed [Ofen 1.2].setColor (7ms)
+131ms ║║Executed physical command [Ofen 1.3].setColor([[hex: #00e645, hue:38, saturation:100, level:45]]) (4ms)
+132ms ║║Executed [Ofen 1.3].setColor (6ms)
+136ms ║║Cancelling statement #10's schedules...
+144ms ║║Executed physical command [Couch Licht].setColor([[hex: #FF0000, hue:0, saturation:100, level:50]]) (4ms)
+145ms ║║Executed [Couch Licht].setColor (6ms)
+154ms ║║Executed physical command [Fernseher Licht].setColor([[hex: #FF0000, hue:0, saturation:100, level:50]]) (6ms)
+155ms ║║Executed [Fernseher Licht].setColor (8ms)
+165ms ║║Comparison (enum) on is (string) on = true (2ms)
+166ms ║║Cancelling condition #19's schedules...
+167ms ║║Condition #19 evaluated true (10ms)
+168ms ║║Cancelling condition #18's schedules...
+169ms ║║Condition group #18 evaluated true (state changed) (12ms)
+171ms ║║Cancelling statement #20's schedules...
+500ms ║║Executed physical command [null].on() (324ms)
+501ms ║║Executed [VSwitch10 (Emergency-Alert)].on (326ms)
+504ms ║║Executed virtual command [VSwitch10 (Emergency-Alert)].wait (1ms)
+505ms ║║Requesting a wake up for Wed, May 11 2022 @ 9:46:49 PM CEST (in 5.0s)
+509ms ║╚Execution stage complete. (443ms)
+511ms ║Setting up scheduled job for Wed, May 11 2022 @ 9:46:49 PM CEST (in 4s)
+517ms ╚Event processed successfully (517ms)
11.5.2022, 21:46:39 +831ms
+1ms ╔Received event [VSwitch-TEST].switch = on with a delay of 58ms
+136ms ║RunTime Analysis CS > 14ms > PS > 4ms > PE > 118ms > CE
+139ms ║Runtime (45721 bytes) successfully initialized in 4ms (v0.3.113.20210203) (137ms)
+140ms ║╔Execution stage started
+148ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
+149ms ║║Cancelling condition #2's schedules...
+150ms ║║Condition #2 evaluated true (6ms)
+151ms ║║Cancelling condition #1's schedules...
+152ms ║║Condition group #1 evaluated true (state changed) (8ms)
+154ms ║║Cancelling statement #3's schedules...
+214ms ║║Skipped execution of physical command [Couch Licht].setLevel([100]) because it would make no change to the device. (44ms)
+215ms ║║Executed [Couch Licht].setLevel (45ms)
+243ms ║║Executed physical command [Esszimmer 1.1].setLevel([100]) (26ms)
+244ms ║║Executed [Esszimmer 1.1].setLevel (26ms)
+255ms ║║Skipped execution of physical command [Esszimmer 1.2].setLevel([100]) because it would make no change to the device. (10ms)
+256ms ║║Executed [Esszimmer 1.2].setLevel (11ms)
+265ms ║║Skipped execution of physical command [Esszimmer 1.3].setLevel([100]) because it would make no change to the device. (7ms)
+266ms ║║Executed [Esszimmer 1.3].setLevel (9ms)
+276ms ║║Skipped execution of physical command [Esszimmer 1.4].setLevel([100]) because it would make no change to the device. (8ms)
+277ms ║║Executed [Esszimmer 1.4].setLevel (10ms)
+323ms ║║Executed physical command [Fernseher Licht].setLevel([100]) (43ms)
+324ms ║║Executed [Fernseher Licht].setLevel (44ms)
+333ms ║║Skipped execution of physical command [Küche 1.1].setLevel([100]) because it would make no change to the device. (7ms)
+334ms ║║Executed [Küche 1.1].setLevel (8ms)
+343ms ║║Skipped execution of physical command [Küche 1.2].setLevel([100]) because it would make no change to the device. (8ms)
+344ms ║║Executed [Küche 1.2].setLevel (9ms)
+353ms ║║Skipped execution of physical command [Küche 1.3].setLevel([100]) because it would make no change to the device. (7ms)
+354ms ║║Executed [Küche 1.3].setLevel (9ms)
+365ms ║║Skipped execution of physical command [Küche 1.4].setLevel([100]) because it would make no change to the device. (9ms)
+366ms ║║Executed [Küche 1.4].setLevel (11ms)
+376ms ║║Skipped execution of physical command [Küche 1.5].setLevel([100]) because it would make no change to the device. (8ms)
+377ms ║║Executed [Küche 1.5].setLevel (10ms)
+386ms ║║Skipped execution of physical command [Küche 1.6].setLevel([100]) because it would make no change to the device. (7ms)
+387ms ║║Executed [Küche 1.6].setLevel (9ms)
+396ms ║║Skipped execution of physical command [Loggia Licht].setLevel([100]) because it would make no change to the device. (7ms)
+397ms ║║Executed [Loggia Licht].setLevel (9ms)
+407ms ║║Skipped execution of physical command [Obergeschoss 1.1].setLevel([100]) because it would make no change to the device. (8ms)
+408ms ║║Executed [Obergeschoss 1.1].setLevel (10ms)
+418ms ║║Skipped execution of physical command [Obergeschoss 1.2].setLevel([100]) because it would make no change to the device. (8ms)
+419ms ║║Executed [Obergeschoss 1.2].setLevel (10ms)
+428ms ║║Skipped execution of physical command [Obergeschoss 1.3].setLevel([100]) because it would make no change to the device. (7ms)
+429ms ║║Executed [Obergeschoss 1.3].setLevel (9ms)
+439ms ║║Skipped execution of physical command [Obergeschoss 1.4].setLevel([100]) because it would make no change to the device. (8ms)
+440ms ║║Executed [Obergeschoss 1.4].setLevel (9ms)
+450ms ║║Skipped execution of physical command [Obergeschoss 1.5].setLevel([100]) because it would make no change to the device. (8ms)
+451ms ║║Executed [Obergeschoss 1.5].setLevel (10ms)
+461ms ║║Skipped execution of physical command [Obergeschoss 1.6].setLevel([100]) because it would make no change to the device. (8ms)
+463ms ║║Executed [Obergeschoss 1.6].setLevel (11ms)
+473ms ║║Skipped execution of physical command [Ofen 1.1].setLevel([100]) because it would make no change to the device. (8ms)
+474ms ║║Executed [Ofen 1.1].setLevel (9ms)
+483ms ║║Skipped execution of physical command [Ofen 1.2].setLevel([100]) because it would make no change to the device. (6ms)
+484ms ║║Executed [Ofen 1.2].setLevel (8ms)
+493ms ║║Skipped execution of physical command [Ofen 1.3].setLevel([100]) because it would make no change to the device. (7ms)
+494ms ║║Executed [Ofen 1.3].setLevel (9ms)
+503ms ║║Skipped execution of physical command [Pascal 1.1].setLevel([100]) because it would make no change to the device. (7ms)
+504ms ║║Executed [Pascal 1.1].setLevel (8ms)
+512ms ║║Skipped execution of physical command [Pascal 1.2].setLevel([100]) because it would make no change to the device. (7ms)
+513ms ║║Executed [Pascal 1.2].setLevel (8ms)
+569ms ║║Skipped execution of physical command [Pascal 1.3].setLevel([100]) because it would make no change to the device. (55ms)
+570ms ║║Executed [Pascal 1.3].setLevel (56ms)
+580ms ║║Skipped execution of physical command [Pascal 1.4].setLevel([100]) because it would make no change to the device. (7ms)
+581ms ║║Executed [Pascal 1.4].setLevel (10ms)
+591ms ║║Skipped execution of physical command [Pascal 1.5].setLevel([100]) because it would make no change to the device. (8ms)
+592ms ║║Executed [Pascal 1.5].setLevel (10ms)
+602ms ║║Skipped execution of physical command [Pascal 1.6].setLevel([100]) because it would make no change to the device. (8ms)
+603ms ║║Executed [Pascal 1.6].setLevel (10ms)
+613ms ║║Skipped execution of physical command [Pascal 1.7].setLevel([100]) because it would make no change to the device. (8ms)
+614ms ║║Executed [Pascal 1.7].setLevel (9ms)
+649ms ║║Skipped execution of physical command [Pascal 1.8].setLevel([100]) because it would make no change to the device. (34ms)
+650ms ║║Executed [Pascal 1.8].setLevel (35ms)
+666ms ║║Executed physical command [Pascal Lightstripe].setLevel([100]) (13ms)
+667ms ║║Executed [Pascal Lightstripe].setLevel (15ms)
+675ms ║║Skipped execution of physical command [Schlagzeug 1.1].setLevel([100]) because it would make no change to the device. (7ms)
+676ms ║║Executed [Schlagzeug 1.1].setLevel (8ms)
+685ms ║║Skipped execution of physical command [Schlagzeug 1.2].setLevel([100]) because it would make no change to the device. (7ms)
+686ms ║║Executed [Schlagzeug 1.2].setLevel (9ms)
+730ms ║║Skipped execution of physical command [Schreibtisch Licht].setLevel([100]) because it would make no change to the device. (42ms)
+731ms ║║Executed [Schreibtisch Licht].setLevel (42ms)
+744ms ║║Executed physical command [Todesreck].setLevel([100]) (12ms)
+745ms ║║Executed [Todesreck].setLevel (12ms)
+759ms ║║Executed physical command [Vorzimmer 1.1].setLevel([100]) (12ms)
+759ms ║║Executed [Vorzimmer 1.1].setLevel (13ms)
+801ms ║║Executed physical command [Vorzimmer 1.2].setLevel([100]) (40ms)
+802ms ║║Executed [Vorzimmer 1.2].setLevel (41ms)
+815ms ║║Executed physical command [Vorzimmer 1.3].setLevel([100]) (10ms)
+816ms ║║Executed [Vorzimmer 1.3].setLevel (12ms)
+825ms ║║Skipped execution of physical command [Wohnzimmer 1.1].setLevel([100]) because it would make no change to the device. (8ms)
+826ms ║║Executed [Wohnzimmer 1.1].setLevel (9ms)
+836ms ║║Skipped execution of physical command [Wohnzimmer 1.2].setLevel([100]) because it would make no change to the device. (8ms)
+837ms ║║Executed [Wohnzimmer 1.2].setLevel (10ms)
+847ms ║║Skipped execution of physical command [Wohnzimmer 1.3].setLevel([100]) because it would make no change to the device. (8ms)
+848ms ║║Executed [Wohnzimmer 1.3].setLevel (10ms)
+857ms ║║Skipped execution of physical command [Wohnzimmer 1.4].setLevel([100]) because it would make no change to the device. (7ms)
+858ms ║║Executed [Wohnzimmer 1.4].setLevel (9ms)
+868ms ║║Skipped execution of physical command [Wohnzimmer 1.5].setLevel([100]) because it would make no change to the device. (8ms)
+869ms ║║Executed [Wohnzimmer 1.5].setLevel (10ms)
+879ms ║║Skipped execution of physical command [Wohnzimmer 1.6].setLevel([100]) because it would make no change to the device. (7ms)
+880ms ║║Executed [Wohnzimmer 1.6].setLevel (9ms)
+889ms ║║Skipped execution of physical command [Wohnzimmer 2.1].setLevel([100]) because it would make no change to the device. (7ms)
+890ms ║║Executed [Wohnzimmer 2.1].setLevel (8ms)
+900ms ║║Skipped execution of physical command [Wohnzimmer 2.2].setLevel([100]) because it would make no change to the device. (9ms)
+901ms ║║Executed [Wohnzimmer 2.2].setLevel (9ms)
+910ms ║║Skipped execution of physical command [Wohnzimmer 2.3].setLevel([100]) because it would make no change to the device. (8ms)
+911ms ║║Executed [Wohnzimmer 2.3].setLevel (8ms)
+921ms ║║Skipped execution of physical command [Wohnzimmer 2.4].setLevel([100]) because it would make no change to the device. (8ms)
+922ms ║║Executed [Wohnzimmer 2.4].setLevel (9ms)
+933ms ║║Skipped execution of physical command [Wohnzimmer 2.5].setLevel([100]) because it would make no change to the device. (9ms)
+933ms ║║Executed [Wohnzimmer 2.5].setLevel (10ms)
+943ms ║║Skipped execution of physical command [Wohnzimmer 2.6].setLevel([100]) because it would make no change to the device. (7ms)
+944ms ║║Executed [Wohnzimmer 2.6].setLevel (9ms)
+947ms ║║Executed virtual command [Couch Licht, Esszimmer 1.1, Esszimmer 1.2, Esszimmer 1.3, Esszimmer 1.4, Fernseher Licht, Küche 1.1, Küche 1.2, Küche 1.3, Küche 1.4, Küche 1.5, Küche 1.6, Loggia Licht, Obergeschoss 1.1, Obergeschoss 1.2, Obergeschoss 1.3, Obergeschoss 1.4, Obergeschoss 1.5, Obergeschoss 1.6, Ofen 1.1, Ofen 1.2, Ofen 1.3, Pascal 1.1, Pascal 1.2, Pascal 1.3, Pascal 1.4, Pascal 1.5, Pascal 1.6, Pascal 1.7, Pascal 1.8, Pascal Lightstripe, Schlagzeug 1.1, Schlagzeug 1.2, Schreibtisch Licht, Todesreck, Vorzimmer 1.1, Vorzimmer 1.2, Vorzimmer 1.3, Wohnzimmer 1.1, Wohnzimmer 1.2, Wohnzimmer 1.3, Wohnzimmer 1.4, Wohnzimmer 1.5, Wohnzimmer 1.6, Wohnzimmer 2.1, Wohnzimmer 2.2, Wohnzimmer 2.3, Wohnzimmer 2.4, Wohnzimmer 2.5, Wohnzimmer 2.6].wait (0ms)
+948ms ║║Requesting a wake up for Wed, May 11 2022 @ 9:46:45 PM CEST (in 5.0s)
+952ms ║╚Execution stage complete. (812ms)
+953ms ║Setting up scheduled job for Wed, May 11 2022 @ 9:46:45 PM CEST (in 4s)
+960ms ╚Event processed successfully (959ms)```

#2

Do want to try making the 2nd block not async, and at the very end of the piston set the switches the way you want?

ie only have 1 async block (1st one), and let the piston itself run the while loop.


#3

Didn’t work.
Status:


#4

Some thoughts:

  • What async does is tell the piston that if it hits a long wait it should continue with the next task and finish the async block in a new instance after the wait. So to do what you need you would need to use async on the first block only and that block would need to finish before the second one does. However …

  • When you test a device attribute in a condition the piston first looks at the event that fired the piston. If it is for the same device attribute the event data is used and the current device state is not tested. To reach your while loops the event must be the switch being on so the while condition will remain true. Even if the piston waits for an hour it is still processing the same event after that time. The first loop will not finish. The second one would probably run out of time.

  • When the switch is turned off the piston will run and cancel any current waits set up when it changed to on.

  • There may be other things going on. I’ve never used async on a while block, only on an action (with) within one, so there may be more complex behaviour.