Piston not reliably reacting to power off button


#1

1) Give a description of the problem
I am a webCoRE rookie and have a rather simple piston which is controlling an RGBW LED strip by an IKEA Trådfri 5 button remote. The execution is overall sluggish, you need to wait a few seconds before something happens after pressing something. But the issue I want to mention in this topic is that I can’t switch on/off the LED strip as expected. If the strip is on, I need to press the button for powering off twice. The log clearly shows that the light is supposed to be turned off. Is it correct to use the Switch status and the Power on / Power off actions?

2) What is the expected behaviour?
Pressing the middle button of the remote should toggle the light on/off once per press.

3) What is happening/not happening?
Pressing the button once powers on the LED. Pressing it again doesn’t power it off, pressing it a third time powers it off.

**4) Post a Green Snapshot of the piston

5) Post some screenshots showing the issue
What I find a bit weird is that it sometimes takes 2,5 seconds to execute the power off action, executing a power on takes 150 ms. The light status also remains “on” in the SmartThings app.
Delay

6) Attach logs after turning logging level to Full

+1ms ╔Received event [LED strip Dimmer middle button].button = pushed with a delay of 50ms
+83ms ║RunTime Analysis CS > 14ms > PS > 5ms > PE > 64ms > CE
+87ms ║Runtime (63065 bytes) successfully initialized in 5ms (v0.3.110.20191009) (85ms)
+88ms ║╔Execution stage started
+100ms ║║Condition #2 evaluated false (8ms)
+101ms ║║Condition group #1 evaluated false (state did not change) (9ms)
+109ms ║║Condition #33 evaluated false (6ms)
+110ms ║║Condition group #32 evaluated false (state did not change) (8ms)
+117ms ║║Condition #66 evaluated false (6ms)
+118ms ║║Condition group #64 evaluated false (state did not change) (8ms)
+126ms ║║Condition #68 evaluated false (7ms)
+127ms ║║Condition group #65 evaluated false (state did not change) (8ms)
+131ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+132ms ║║Condition #123 evaluated true (4ms)
+133ms ║║Condition group #122 evaluated true (state did not change) (5ms)
+144ms ║║Comparison (enum) on is (string) on = true (2ms)
+145ms ║║Cancelling condition #126’s schedules…
+146ms ║║Condition #126 evaluated true (11ms)
+147ms ║║Cancelling condition #124’s schedules…
+148ms ║║Condition group #124 evaluated true (state changed) (13ms)
+150ms ║║Cancelling statement #130’s schedules…
+304ms ║║Executed physical command [LED strip].off() (151ms)
+305ms ║║Executed [LED strip].off (153ms)
+311ms ║║Comparison (integer) 3 changes_to (integer) 0 = false (1ms)
+312ms ║║Condition #179 evaluated false (4ms)
+313ms ║║Condition group #176 evaluated false (state did not change) (5ms)
+317ms ║║Comparison (integer) 3 changes_to (integer) 1 = false (1ms)
+319ms ║║Condition #180 evaluated false (4ms)
+320ms ║║Condition group #177 evaluated false (state did not change) (6ms)
+324ms ║║Comparison (integer) 3 changes_to (integer) 2 = false (0ms)
+325ms ║║Condition #183 evaluated false (4ms)
+326ms ║║Condition group #178 evaluated false (state did not change) (5ms)
+330ms ║║Comparison (integer) 2 changes_to (integer) 0 = false (0ms)
+332ms ║║Condition #193 evaluated false (4ms)
+333ms ║║Condition group #188 evaluated false (state did not change) (5ms)
+336ms ║║Comparison (integer) 2 changes_to (integer) 1 = false (1ms)
+337ms ║║Condition #194 evaluated false (3ms)
+338ms ║║Condition group #189 evaluated false (state did not change) (5ms)
+341ms ║║Comparison (integer) 2 changes_to (integer) 2 = false (0ms)
+343ms ║║Condition #200 evaluated false (3ms)
+343ms ║║Condition group #190 evaluated false (state did not change) (4ms)
+347ms ║║Comparison (integer) 2 changes_to (integer) 3 = false (0ms)
+348ms ║║Condition #206 evaluated false (4ms)
+349ms ║║Condition group #191 evaluated false (state did not change) (5ms)
+352ms ║║Comparison (integer) 2 changes_to (integer) 4 = false (1ms)
+353ms ║║Condition #212 evaluated false (3ms)
+354ms ║║Condition group #192 evaluated false (state did not change) (5ms)
+356ms ║╚Execution stage complete. (268ms)
+357ms ╚Event processed successfully (357ms)

#2

Just to rule out other factors. If you create a simple piston with the basic on/off for the strip, does it have the same delay when turning off?

Also, on the trigger for dimLevel, webCoRE cannot trigger off of a local variable change but it can on globals as far as I know.


#3

Do you mean to try removing everything except the IF statement for toggling the light? I will try it tomorrow. Is “switch” correct?

Also, on the trigger for dimLevel , webCoRE cannot trigger off of a local variable change but it can on globals as far as I know.

Don’t see why there is such a limitation for local variables, but that’s good to know, thanks!


#4

The issue is specifically that ‘changes to’ works with the external event that caused the piston to fire. The piston has just set the local variable itself so it might as well deal with the consequences there and then.

Back to the original issue. It would be useful to see logs generated when three button presses didn’t behave as intended to see what might be happening.

Does the interval between presses make a difference?