Is there a one-click method to change modes?

It seems Modes is hot topic the past couple of days so I’ll join in. This one is simple I think. My goal is to have something on the home screen of a tablet or smartphone to change from Home mode to Away mode, something like a widget. Is there something available now that can accomplish this, if not, is there a workaround I could use?

Thanks!

Rey,

Maybe you could use the virtual push button tile and write a quick app to change the mode… I used the virtual momentary push button in combination with a modified Big Turn Off app to make a one-push “Turn off all the lights” tile that lives on my main ST app screen.

Thanks for the tip. I’ll poke around and find me a virtual button to play with, see how far I can get. On a maybe related topic, is it possible to re-arrange the tiles yet?

@eibyer

Yes, you can rearrange tiles easily and they stay in the new order.

@stevesell

How are you adding this virtual push button tile? I’m assuming this isn’t a real (ie, physical) device, correct?

Hah! would you look at that! Thank you, now I can group related tiles instead of being sorted in the order of when they were added.

@chrisb - In the IDE, go to “My Devices” then click the “+ New Device” button. Then fill in Name, Network ID (you make this up. I used 100). Then under Type select “Momentary Button Tile” - finally, select the hub then click “Create”

You should now see a tile with “Push” on it on your phone’s main screen. You can hook this up to any app that accepts a switch capability.

What app do you know off hand that accepts switch capability? I played with the virtual device yesterday and got up to the creation of the tile but got stuck on how I can call the one line that I copied from Bon Voyage.

Ah… I kept trying to do it with a z-wave switch. That’s be the problem! :slight_smile:

Ray,

Sorry, I mean to say it will work with an app that accepts the ‘momentary’ - which I don’t think any of them do out of the box. However, I took “The Big Switch” and modified it to accept momentary buttons. So below is my app that turns off a bunch of switches when you press the tile. So install a Momentary Button Tile device, then install this app, then you can select the tile from the app’s preferences.

preferences {
	section("When this switch is pushed") {
		input "master", "capability.momentary", title: "Where?"
	}
	section("Turn off all of these switches") {
		input "switches", "capability.switch", multiple: true, required: false
	}
}

def installed()
{
	subscribe(master, "momentary.pushed", offHandler)
}

def updated()
{
	unsubscribe()
	subscribe(master, "momentary.pushed", offHandler)
}

def offHandler(evt) {
	//log.debug evt.value
    log.debug "Turning off: " + switches
	switches?.off()
}

cc: @eibyer

@stevesell

Instead of turning off switches, I want to change modes. How should I modify the code?

@dawz2

Instead of
switches?.off()

Use

setLocationMode("nameofmodeyouwant")

Btw, usually what I do is go look at one of the other apps that does something I want… In this case I just looked at one of the apps in the Mode Magic category to see how they did it. You can’t always find an example, but it’s not a bad resource.

Very helpful! I still haven’t gotten the chance to sit down and try the suggestions above. This would help out a lot when I get the time.

@stevesell

Thank you.
Well, I do look through the sample apps as well as the shared apps, but I get lost in the mess of code. I can’t determine what pieces of the code I need and what I don’t. So, your help is appreciated.
I expected code that would give me the ability to set which button and which mode in the preferences. Example: When this button is pushed, switch to this mode. It looks like your suggested code establishes a single mode to change to when the set button is pushed.

@dawz2,

Are you using iOS? I’m not familiar with the Android app but you can simply swipe left on iPhone to select mode. Would be just as quick as pressing a button/tile. I often use this method if my automated method fails to work (because of phone presence). I simply swipe and tell ST that we are away.

@DawgOnKing

Yes, we use iOS. I’m looking for more intuitive mode switching for my less techie wife and children.

@dawz2

Understood. In my brief time with ST I have learned that there are endlessly intuitive and automatic ways to do things, it’s just a matter of getting everything to cooperate. I hope it continues to get “smarter” with firmware and product upgrades.