Birthday piston runs 2-3 times. WTH!?!


#1

1) Give a description of the problem
I’m creating a birthday piston to sing when I tell Alexa to do so. For some reason, the piston speaks 2-3 times. I’ve tried putting multiple commands in the Alexa routine and Piston to turn the virtual switch off as quickly as possible, but that makes it repeat more.

2) What is the expected behaviour?
The piston should play one time.

3) What is happening/not happening?
It plays 2-3 times

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

7/23/2020, 9:57:25 AM +9ms
+1ms ╔Received event [Happy Birthday Switch].switch = off with a delay of 159ms
+82ms ║RunTime Analysis CS > 19ms > PS > 43ms > PE > 20ms > CE
+84ms ║Runtime (41362 bytes) successfully initialized in 43ms (v0.3.110.20191009) (83ms)
+85ms ║╔Execution stage started
+92ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+94ms ║║Cancelling condition #322’s schedules…
+94ms ║║Condition #322 evaluated false (5ms)
+95ms ║║Cancelling condition #321’s schedules…
+96ms ║║Condition group #321 evaluated false (state changed) (7ms)
+98ms ║║Cancelling statement #267’s schedules…
+102ms ║║Executed virtual command setVariable (0ms)
+104ms ║║Cancelling statement #320’s schedules…
+108ms ║║Executed virtual command setVariable (0ms)
+109ms ║╚Execution stage complete. (24ms)
+110ms ╚Event processed successfully (110ms)
7/23/2020, 9:57:24 AM +365ms
+1ms ╔Received event [Happy Birthday Switch].switch = on with a delay of 247ms
+93ms ║RunTime Analysis CS > 21ms > PS > 52ms > PE > 20ms > CE
+96ms ║Runtime (41367 bytes) successfully initialized in 52ms (v0.3.110.20191009) (93ms)
+96ms ║╔Execution stage started
+103ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+104ms ║║Cancelling condition #322’s schedules…
+105ms ║║Condition #322 evaluated true (5ms)
+106ms ║║Cancelling condition #321’s schedules…
+106ms ║║Condition group #321 evaluated true (state changed) (6ms)
+108ms ║║Cancelling statement #325’s schedules…
+122ms ║║Executed physical command [Happy Birthday Switch].off() (11ms)
+123ms ║║Executed [Happy Birthday Switch].off (11ms)
+131ms ║║Comparison (dynamic) 7/23 is (string) 7/27 = false (1ms)
+132ms ║║Condition #324 evaluated false (7ms)
+133ms ║║Condition group #323 evaluated false (state did not change) (9ms)
+136ms ║║Cancelling statement #320’s schedules…
+139ms ║║Executed virtual command setVariable (0ms)
+140ms ║╚Execution stage complete. (44ms)
+141ms ╚Event processed successfully (141ms)
7/23/2020, 9:56:58 AM +473ms
+1ms ╔Received event [Happy Birthday Switch].switch = off with a delay of 327ms
+113ms ║RunTime Analysis CS > 31ms > PS > 62ms > PE > 20ms > CE
+115ms ║Runtime (41363 bytes) successfully initialized in 62ms (v0.3.110.20191009) (113ms)
+116ms ║╔Execution stage started
+122ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+123ms ║║Cancelling condition #322’s schedules…
+124ms ║║Condition #322 evaluated false (5ms)
+125ms ║║Cancelling condition #321’s schedules…
+126ms ║║Condition group #321 evaluated false (state changed) (6ms)
+127ms ║║Cancelling statement #267’s schedules…
+130ms ║║Executed virtual command setVariable (0ms)
+133ms ║║Cancelling statement #320’s schedules…
+136ms ║║Executed virtual command setVariable (1ms)
+138ms ║╚Execution stage complete. (22ms)
+138ms ╚Event processed successfully (138ms) the solution.


#2

There is no speak command in this piston.


Also, note that one split second after the switch turns on, you are turning it off…
Meaning your ELSE block runs a few milliseconds after the THEN block.


#3

Sorry, the (Pistontrigger)=($now) sends my message to my speaking piston.


#4

As mentioned in my last post, your “o0qj” piston runs top to bottom twice in a few milliseconds… and each event writes to {@PistonTrigger}.
(notice how line 39 is outside of any blocks?)


To say this another way, whether your switch turns on or off, line 39 will execute.


I am curious… Is switch 24 a SimSwitch, or a real device?