Button Pushed vs. Held


#1

1) Give a description of the problem
Piston created to Turn on these lights (if they are off) or Turn off these lights (if they are on). Pushed uses a set of ‘these lights’, and Held uses ‘those lights’.

2) What is the expected behavior?
Pushed uses a set of ‘these lights’, and Held uses ‘those lights’.

3) What is happening/not happening?
Both ‘Pushed’ and ‘Held’ are triggering at the same time. If I ‘Push’ the button ‘these lights’ turn off…and ‘those lights’ turn on. It is supposed to be: If I ‘Push’ the button, only ‘these lights’ should respond. If I ‘Hold’ the button, only ‘those lights’ should respond. Instead, If I ‘Push’ or ‘Hold’, both sets of lights (‘these lights’ and ‘those lights’) are responding. (hope that makes sense).

4) Post a Green Snapshot of the pistonimage


Problems with Triggers
#2

I believe ELSE parts are creating a bit problem (just guessing)
for testing puposes I would go simpler (to see if your button has some issues) I had a button once and it was acting weird due to device handler etc…

IF button gets PUSHED 
turn ON 
bulb 1 2 3 

IF button gets HELD
turn on 
bulb 4 5 6

If this works without a problem, we can add the rest.


#3

I will try this now, thank you!


#4

That did the trick! Thank you so much!!

Now looks like this:


#5

Cool…
Enjoy :))))


#6

I edited the above to include the new piston setup.


#7

hımmmm
This might create some problems though???
If button is pushed it goes to TWO TRIGGERS…
If button is held it goes to TWO TRIGGERS…
Never done this one before…
Did you test it?


#8

This is why I had the other conditions under ‘else if’…

But, I’ve been testing this, and so far, so good.


#9

If that piston creates a problem,
try this
single trigger and followed by two conditions…


#10

I will test this as well


#11

Just tested, and this setup works as well.

I will keep the piston with this setup.

It now looks like this:


#12

Well, this setup is causing problems, so I’m going to go back to my previous setup for this piston.

Sometimes (more often than not), when I ‘Press’ the button, the lights will go off, and then a second or two later, they will come back on. And, every so often, when I ‘Press’ the button, the lights will go off, and then a second or two later, some of the lights will come back on. Causing and endless loop when pressing the button (because the lights that came back on will turn off, but the ones that didn’t come back on will turn on, and so on).


#13

Ok, so it’s not the pistons, because it happened again.

For some reason, the ‘Press’ commands are showing up twice in SmartThings.

When I check the ‘Recently’ in the SmartThings app for that button, the ‘Press’ is showing twice. So, that would be why the lights turn off, and then turn right back on.

Has anyone seen this before?


#14

Um… never mind. DUH, that’s me pressing it again to try to get the lights to go off.


#15

Here is the log when I press the button:

2/15/2019, 11:49:10 PM +283ms
+2ms ╔Received event [Neal Button].button = pushed with a delay of 512ms
+136ms ║RunTime Analysis CS > 27ms > PS > 85ms > PE > 25ms > CE
+139ms ║Runtime (44552 bytes) successfully initialized in 85ms (v0.3.109.20181207) (135ms)
+140ms ║╔Execution stage started
+151ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+153ms ║║Condition #2 evaluated true (6ms)
+180ms ║║Comparison (enum) on is (string) on = true (2ms)
+182ms ║║Condition #4 evaluated true (28ms)
+184ms ║║Condition group #1 evaluated true (state did not change) (37ms)
+187ms ║║Cancelling statement #5’s schedules…
+204ms ║║Executed physical command [Neal Lamp 1].off() (13ms)
+206ms ║║Executed [Neal Lamp 1].off (15ms)
+220ms ║║Executed physical command [Neal Lamp 2].off() (12ms)
+221ms ║║Executed [Neal Lamp 2].off (14ms)
+235ms ║║Executed physical command [Neal Lamp 3].off() (12ms)
+236ms ║║Executed [Neal Lamp 3].off (14ms)
+250ms ║║Executed physical command [Neal Lamp 4].off() (12ms)
+252ms ║║Executed [Neal Lamp 4].off (14ms)
+260ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+262ms ║║Condition #23 evaluated true (6ms)
+280ms ║║Comparison (enum) on is (string) off = false (2ms)
+283ms ║║Comparison (enum) on is (string) off = false (2ms)
+286ms ║║Comparison (enum) on is (string) off = false (2ms)
+289ms ║║Comparison (enum) on is (string) off = false (2ms)
+292ms ║║Condition #8 evaluated false (29ms)
+293ms ║║Condition group #7 evaluated false (state did not change) (38ms)
+303ms ║║Comparison (enum) pushed gets (string) held = false (1ms)
+305ms ║║Condition #13 evaluated false (7ms)
+306ms ║║Condition group #12 evaluated false (state did not change) (9ms)
+314ms ║║Comparison (enum) pushed gets (string) held = false (1ms)
+316ms ║║Condition #24 evaluated false (6ms)
+317ms ║║Condition group #18 evaluated false (state did not change) (8ms)
+320ms ║╚Execution stage complete. (181ms)
+321ms ╚Event processed successfully (321ms)


#16

pls share the latest version of the piston…if it’s not properly working


#17

Sorry… the above log is from this setup:


#18

Switched back to this setup, and I’m getting the same thing still:

Log:

2/16/2019, 11:10:03 PM +40ms
+1ms ╔Received event [Neal Button].button = pushed with a delay of 2444ms
+82ms ║RunTime Analysis CS > 13ms > PS > 49ms > PE > 19ms > CE
+85ms ║Runtime (44139 bytes) successfully initialized in 49ms (v0.3.109.20181207) (83ms)
+86ms ║╔Execution stage started
+98ms ║║Comparison (enum) pushed gets (string) pushed = true (1ms)
+100ms ║║Condition #2 evaluated true (6ms)
+101ms ║║Condition group #1 evaluated true (state did not change) (9ms)
+126ms ║║Comparison (enum) off is (string) on = false (2ms)
+129ms ║║Comparison (enum) off is (string) on = false (2ms)
+133ms ║║Comparison (enum) off is (string) on = false (2ms)
+142ms ║║Comparison (enum) off is (string) on = false (2ms)
+145ms ║║Cancelling condition #4’s schedules…
+147ms ║║Condition #4 evaluated false (42ms)
+148ms ║║Cancelling condition #16’s schedules…
+149ms ║║Condition group #16 evaluated false (state changed) (45ms)
+175ms ║║Comparison (enum) off is (string) off = true (2ms)
+178ms ║║Cancelling condition #20’s schedules…
+179ms ║║Condition #20 evaluated true (24ms)
+181ms ║║Cancelling condition #19’s schedules…
+182ms ║║Condition group #19 evaluated true (state changed) (27ms)
+185ms ║║Cancelling statement #21’s schedules…
+199ms ║║Executed physical command [Neal Lamp 1].on() (9ms)
+200ms ║║Executed [Neal Lamp 1].on (11ms)
+210ms ║║Executed physical command [Neal Lamp 2].on() (7ms)
+211ms ║║Executed [Neal Lamp 2].on (9ms)
+221ms ║║Executed physical command [Neal Lamp 3].on() (7ms)
+222ms ║║Executed [Neal Lamp 3].on (10ms)
+233ms ║║Executed physical command [Neal Lamp 4].on() (7ms)
+234ms ║║Executed [Neal Lamp 4].on (10ms)
+247ms ║║Executed physical command [Neal Lamp 1].setLevel([100]) (9ms)
+249ms ║║Executed [Neal Lamp 1].setLevel (11ms)
+261ms ║║Executed physical command [Neal Lamp 2].setLevel([100]) (10ms)
+262ms ║║Executed [Neal Lamp 2].setLevel (12ms)
+276ms ║║Executed physical command [Neal Lamp 3].setLevel([100]) (12ms)
+278ms ║║Executed [Neal Lamp 3].setLevel (14ms)
+289ms ║║Executed physical command [Neal Lamp 4].setLevel([100]) (9ms)
+290ms ║║Executed [Neal Lamp 4].setLevel (11ms)
+300ms ║║Comparison (enum) pushed gets (string) held = false (1ms)
+302ms ║║Condition #13 evaluated false (6ms)
+303ms ║║Condition group #12 evaluated false (state did not change) (9ms)
+306ms ║╚Execution stage complete. (220ms)
+307ms ╚Event processed successfully (307ms)


#19

Is there a command that can be added to STOP the piston after each embedded IF statement, that will keep the piston from reading any further down the line?

Something like:

-IF this button is ‘pushed’
–IF these lights are ‘OFF’
—with
----these lights
----Turn On
----Set Level to 100%
----STOP
–end IF
–IF these lights are ‘ON’
—with
----these lights
----Turn Off
----STOP
–end IF


#20

now with this latest version what is happening or not happening?

Piston can run all it wants if conditions are not MET it won’t do anything…
So if you just pushed the button, HELD part won’t be triggered because it reads FALSE.