Is it possible to create a Routine that is a toggle?

Is there a way to create a routine that can both turn on and turn off a group of devices, depending on the current state of those devices?

Right now, I have SmartLights in a bunch of different rooms, and having two routines (one for on, one for off) for each of those rooms is starting to get unwieldy. I have to scroll through a gigantic list of routines just to turn room lights on and off. Is there a way to make a toggle, rather than creating a separate routine for each?

I’m too tired to go into all the details, right now but I will give the concept and other people can follow up with you if you decide you want to go this route.

First, the short answer is that you can’t toggle a routine. However, you can initiate a routine when a different switch turns on, and you could have that switch be a toggle. So you would still have two routines, but instead of tapping the routine itself, you would have a widget or a virtual device and its State change within automatically run the appropriate routine of the two routines.

The medium answer is that if you have an android phone, this can be done with sharptools and Tasker.

The long answer is that if you have an iOS phone and/or you don’t want to use Tasker for some reason you can still do it just with code by setting up a virtual toggle, but the set up is a little complicated. I’m sure there’s a way to do it in Core, I just don’t know that one. Alternatively, you can see how one member did it in the following article:

Most of these methods don’t change the fact that you still have one routine to turn everything on and another routine to turn everything off. The difference is that you are now getting a toggle switch or widget that you can go directly to and it will then automatically run the right routine.

Based on what @anon36505037 posted below, if you use web core you could have a routine as a true toggle, but you still end up with one routine and one webcore piston, so two things to maintain. But the UI might be cleaner.

So I’m not sure if any of that really meets your requirements, but if it does sound like something you’d like to pursue, other people can help you get it set up.

@joshua_lyon @fabrguer @anon36505037

3 Likes

Also, if these are really just lights, no other devices like locks or anything, you should be able to just do it with a single virtual on/off switch and a smart lighting automation (not a “routine”).

Smartlighting already has the concept of “turn on when the master switch turns on and turn off when the master switch turns off.” So you only need one smartlighting automation, not two. But you still need something to be the master switch.

If you’re OK with using one of your existing physical switches in the room as the master switch for that route, then you’re all set. But otherwise you also need a virtual device.

And see the community – created wiki article on how to group lights:

http://thingsthataresmart.wiki/index.php?title=How_to_Group_Lights_Together

The main difference between using smart lighting and using a routine is that with the routine you can include devices of other device classes, like locks. So if you have to use a routine, you’ll have to use one of the methods in my first post.

But if it’s really just lights, I would look at using smart lighting instead of a routine. :sunglasses:

1 Like

If it is just devices why not use the Dashboard/Lights & Switches/Shortcuts? You can toggle the whole group on/off with one button. For example, I have one for all my outside lights, I added each device to the shortcut and it can then toggle all of them on or off at the same time.

1 Like

shortcuts was a V1 hub option that was discontinued in the fall of 2015. If you still have it, it’s because you had a hub from before that time. But it is no longer available for any new accounts. And be aware that if you ever delete the last device you have in that category, you will never be able to get the dashboard shortcuts back. :disappointed_relieved:

Unless they re-added it in the most recent app update? But I thought that was just for individual devices, not the old grouping capability.

https://support.smartthings.com/hc/en-us/articles/217215586-Favorites

1 Like

Thanks for the ideas - I was hoping it was possible by default through the app, but it seems like it requires a bit more work to get going.

1 Like

Yeah, just seems strange that something like grouping lights is so complicated and SmartThings. Especially when it used to be so simple. :disappointed_relieved:

You’ve probably already seen this, but here’s the article in the community – created wiki on how to group lights:

http://thingsthataresmart.wiki/index.php?title=How_to_Group_Lights_Together

2 Likes

I was looking to expand the capabilities of my routines as well and just cooked up a smartApp that might do what u are looking for. It’s a simple port of my button controller app but runs alongside routines. Let me know if you are interested and I’ll send you a link to my repo…very beta but functional.

Right now it lets you

  • toggle devices
  • add 2 additional dimmer groups
  • increment/decrement dimmer levels
  • send notifications
1 Like

Hi, so I think I am trying to over complicate the process.
What settings do you mark to be able to set the terms you gave in your example?

Can you send me the toggle routine… trying to toggle thought different virtual switches for the same button. Right now i can map the difference virtual switch to the button but they all turn on at the same time. I’m trying to setup something that will toggle through the virtual switches one at a time.