Physical SmartThings button issue with "Press again to turn off" and adding location mode changes to action


#1

1) Give a description of the problem
I have a SmartThings physical button, that I want to have a simple “press once for on, press again for off”. And a “Hold” action for a different set of actions.

2) What is the expected behaviour?
Press once, lights tunr on. Press again, same light turns off. Hold and a bunch of lights turn off and location mode changes.

3) What is happening/not happening?
I can only do “Press once to turn on” and “Hold to turn off a bunch of lights”. But can’t figure out how to do “press again to turn off” and include a locationmode change in the “Hold” action.

**4) Post a Green Snapshot of the piston!


#2

Since you already got the “HOLD” trigger down, I will focus on your other question.
(an exercise in creativity)

define
  integer count (no value set)
end define

execute
  IF Keypad's button gets pushed
  Then

pic

  END IF
END EXECUTE

This code structure will toggle the light with each press. The only caveat would be if another device changed the light. It might take a second press to synchronize back up with the bulb.


Note: That snapshot goes inside the main IF’s THEN section.


Pro Tip:

This logic will count up indefinitely…
(It could be fun to see how high it has reached after a year :grin:)


… or totally off topic (for the true eccentric), one could add:

IF {count} = 100
Then
   Flash a light in each room
   Play "coins-jackpot.mp3"
   Speak "Congratulations! You are the 100th button presser"
END IF

Of course then you’d have to resist the urge to keep pressing the button, LOL


#3

That’s so incredibly clever. Thanks a ton.

Do you have any ideas on how to add a “change location mode” when doing the “Hold button” action? I don’t seem to have the option when trying to put together my piston.


#4

That could be a new block at the very bottom. Something like:

IF Keypad's button gets pushed
Then
    Set Location mode to (whatever)
END IF

You can find that option inside every command list.

  • Add a new task
  • Select a command
  • Set Location mode
  • Choose desired mode
  • Add