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?
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?
@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.
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()
}
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.
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.
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.
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.