How to add routine 'button' to mobile screen

I’m relatively new to SmartThings but am making good progress. I’ve used WebCoRE to create some rules and I definitely get the concepts involved.

My question - inside the default SmartThings app is a page that says ‘routines’, and by default there are a few buttons there like ‘good morning’, ‘good night’, etc. So let’s say I get my pistons up and running and all is well, how do I then add a new routine that I can click to run that particular piston? I’m not asking someone to explain the whole thing to me, just to point me in the right direction. I’ve had great luck so far finding lots of helpful examples on a variety of things, but so far no luck on this particular subject.

Thanks in advance…

I think this only works in reverse. You can create a routine and have a button or widget on the screen and execute that routine from a piston but… You can’t have a piston show up as a routine button on your screen.
I have created some common routines that I want on my screen and then call them from WC, best you can do at the moment.

ok, thanks for the great info…so maybe let me ask a different question. What I have in mind is, what is the best way for me to easily be able to turn on/off my security system at-will? I think where I’m struggling in my approach is that there is more than 1 way to skin a cat…In my case, I know how to set up alarms and door chimes, etc. But now I get up early and want to leave the house without disturbing my family. How do I disable the alarm as I leave and re-enable it once I’m away? My original thought had been, by adding simple routines I could click something that says like, turn everything off, then as soon as I’m gone, I press a button to turn it all back on.

Do I try to use the Samsung SHM to accomplish this task?

Only routines can have widgets, but you can always set up a routine which turns on a virtual switch and have that virtual switch coming on start your piston. ( there may be also be other ways to have webcore react to a routine starting, I don’t now. But a virtual switch works well. )

So you can pretty much have a widget for anything that SmartThings Home automation rules can do, you just have to trigger it with a routine. :sunglasses:

that’s great information…can you give me a link for how to map a widget to a virtual switch?

Sorry if I was confusing. You aren’t going to map the Switch itself. You’re just going to create a routine that turns on the virtual switch. The routine can have a widget so pressing the widget runs the routine which turns on the virtual switch. And the virtual switch coming on can be the trigger for your piston.

I’d have to leave any detailed discussion past that to other people.

The point is just that a widget can start a routine. So anything you can do inside of a routine, including turn on a virtual switch, can then he started from a widget.

I hope that was clearer, I’m tired this morning. :sunglasses:

You can add all Routines or individual Routines to your phone by creating the appropriate Widgets.


I think I completely understand the concept you’re describing, but when you use the term “virtual switch”, is that something akin to a piston that I can create within webCoRE?

In other words - I can see, for instance based on the options available to me right now, that I could create a global variable within webCoRE, then I also see where I could have a routine change the value of that variable. Then within my piston, I could evaluate the value of that variable as part of any conditional.

Is ‘virtual switch’ the name for the concept I just described, or is ‘virtual switch’ something I can instance from within the webCoRE creation tool? See what I mean? Like, just how I can click within a piston and ‘add a new statement’, is ‘virtual switch’ one of the ‘items’ that would be found underneath Virtual Device or Location or Physical Device, etc. (obviously not Physical Device, I’m just describing the menu options)?

thanks in advance

I believe he means going into your IDE and creating a device that is a virtual switch. Virtual switch being a switch that you can toggle that is not physical in any sense.

Once you create your virtual switch (say called disable alarm) you then set up a routine in smarthings to toggle that switch on when you run the routine.

Once you have your routine you can create a widget on your android screen to toggle the routine from outside the smartthings app.

So now you can use the state of said virtual switch (on or off)in your piston (alarm disable switch “on”) to disable or control your webcore piston.

So in essence after your all done. You would pick up your phone, toggle the widget, which would trigger the routine, which would toggle the virtual switch, which would be seen by webcore and execute your piston accordingly.

Clear as mud??

1 Like

Virtual Device is a construct which is part of the official SmartThings platform. We used to use them a lot more before Core and webcore, but they still have their uses now.

Virtual switch is a device which only exists virtually. There is no physical switch. But it does have a device type handler, and the smartthings platform will treat it just like all of your other switches. It will show up in your things list, you can subscribe to it going on and off with a routine or with webcore or the official smart lighting feature or any smart app.

So within the cloud, it looks like a switch, it acts like a switch. It’s just that there is no physical switch.

So, you can make one of these whenever you want and you add them to your account through the IDE just by doing add a new device and choosing one of the virtual device device types for that new device.

You can’t add it through the mobile app because it can’t be discovered in the physical world. But that won’t make any difference – – once you have added it to your account, as I said, it will show up on your things list. :sunglasses:

Here’s the FAQ

1 Like

Now I see…I was googling things like “webcore create virtual switch” and there aren’t many hits…but that’s because it’s created through the IDE with the other devices. I think I’m good now, I’ll keep moving forward. Thanks!

1 Like

Another way to “skin the proverbial cat”

Is to use Sharptools, which can also create widgets on your android phone.
Make your virtual switch, connect sharptools to your smarthings account, then create a widget in sharptools to toggle your virtual switch.
I haven’t used routines alot beyond the basic ones. I do use sharptools to toggle devices in smartthings both manually (by me) or through tasker.


Also on the routine route. I’m not sure if a routine can toggle your virtual switch.

So possibly you’ll have to create 2 routines? One for turning it on and one for turning it off?

@JDRoberts or one of the other smart people with more experience would know that.

A routine cannot toggle a switch, virtual or not. You have to pick turn on or turn off. but the routine can turn on the virtual switch and you can have either a piston or use the power allowance feature of smartlighting to have that virtual switch always turn itself off again after one minute. That way it will be ready to turn on again the next time. :sunglasses:

(or you can use a virtual momentary tile which will always reset itself without needing any other code)

1 Like

To add some more detail to this, SharpTools has widgets for controlling a variety of SmartThings features including Things, Routines, Modes, and SHM