App that uses a routine to add to SmartThings widget to toggle a switch

Looking for a smartapp that will allow my SmartThings widget to toggle a switch instead of having to create a routine to turn on a switch and a routine to turn off a switch, which would add to separate routines to the widget.

We don’t have coding access to the official SmartThings widgets, they can only be assigned to routines through account set up . So you need a different widget system.

I believe you can do this in android using the paid app sharpTools. @joshua_lyon would know.

Some people use a customized dashboard from smart tiles so that they open the browser with one tap and then they have room for about four devices that could be toggled. That should work on any phone, including windows. But it is one extra step.

1 Like

What exactly are you trying to accomplish? There may be better ways to achieve than using routines to toggle one switch. Also, what kind of switch are you working with?

Here’s code for a SmartApp that I use to do this. It uses virtual momentary buttons as the trigger, so you’ll need to create those and the routine to turn them “on”. Since they turn back off, you only need the one routine. Still a bit clunky that you need 3 pieces, but it’s the best we got since the iOS widget only allows routines.

    name: "Momentary To Toggle Lights",
    namespace: "sticks18",
    author: "",
    description: "Toggle a light(s) using a virtual momentary switch.",
    category: "My Apps",
    iconUrl: "",
    iconX2Url: ""

preferences {
	section("Select momentary switch to monitor"){
		input "theSwitch", "capability.momentary", multiple: false, required: true
    section("Toggle these lights..."){
		input "switches1", "capability.switch", multiple: true, required: false

def installed()

def updated()

def toggleHandler(evt) { evt.value
    def cnt = 0
    def curSwitch = switches1.currentValue("switch") curSwitch
    for(switchVal in curSwitch) {
    	if(curSwitch[cnt] == "on") {
    	if(curSwitch[cnt] == "off") {

def initialize() {
	subscribe(theSwitch, "momentary.pushed", toggleHandler)

If you are like me and trying to find “Virtual” or “Simulated” momentary switch as a device type it’s now innacurately (since the concept of Tiles left like 2 major app versions ago) called “Momentary Button Tile”.