Is there a good tutorial on the virtual tiles? They seem to have a lot of potential to connected to outside pieces of hardware or software that are available through web services, and then use the devices to control some other things.
Do people have examples of how they are using them? Or ideas on different ways they may be hooked up to?
The first is a Virtual Momentary Push Button tile. You install it by adding a new device in the IDE (assigning it a name and made-up network id). Once installed you can treat it like any real switch. I then made an app that subscribes to the momentary.pushed event and I use that to turn off all of the lights in my house when I go to bed. Here’s what the app looks like:
/**
* The Big Off Switch
*
* Author: steve.sell@gmail.com
* Adapted from "the big switch" by SmartThings
*
* Date: 2013-10-15
*/
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()
}
My second is Virtual Switch tile that I have IFTTT toggle on/off when my wife’s phone arrives/leaves - I then have an app subscribe the on event and set the mode to ‘Home’ when she arrives. This is because there are MAJOR issues with the ST app using the iphone as a presence detector right now and this is a way to keep the alarm from going off when my wife gets home from work before me. Supposedly ST is testing a fix, but they’ve been saying that since sometime in November, so who knows when/if it will see the light of day.