@Steve28,
My bad, I was originally looking at the post on my phone which cut off the right side of your code which said “off” but really was “offhandler”. LOL
I do not like this forum software.
twack
@Steve28,
My bad, I was originally looking at the post on my phone which cut off the right side of your code which said “off” but really was “offhandler”. LOL
I do not like this forum software.
twack
Ok, I figured it out. I made a device type (On/Off Tile). Then changed the code to include On/Off
/**
* On/Off Tile
*
* Author: scottjones67@gmail.com
* Date: 2013-10-16
*/
preferences {
section("When this virtual switch is pushed") {
input "master", "capability.switch", title: "Where?"
}
section("Turn On/Off all of these switches") {
input "switches", "capability.switch", multiple: true
}
}
def installed()
{
subscribe(master, "switch.On", switchOn)
subscribe(master, "switch.Off", switchOff)
}
def updated()
{
unsubscribe()
subscribe(master, "switch.On", switchOn)
subscribe(master, "switch.Off", switchOff)
}
def switchOn(evt) {
//log.debug evt.value
log.debug "Turning on: " + switches
switches?.on()
}
def switchOff(evt) {
//log.debug evt.value
log.debug "Turning off: " + switches
switches?.off()
}
Thanks,
Scott
@av8,
I’m not at a place to able to test but try this:
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", switchHandler)
}
def updated()
{
unsubscribe()
subscribe(master, "momentary.pushed", switchHandler)
}
def switchHandler(evt) {
if(master.on){
switches?.off()
master.off()
}
else{
switches?.on()
master.on()
}
}
Hey @chrisb , I’m still pretty new to all of this and was hoping you could help me figure out how to create a “press to activate app” you referenced in this string. I tried looking around here in the forums but can’t seem to find any literature that helps. I’d like it to have the capability to control each of my devices (lights [on, off, specific brightness %'s], door locks [lock, unlock], etc.).
I see you mentioned it’s easily doable from within the SmartThings app, but I can’t figure it out. Any help is much appreciated!
Are you looking to control these things individually or together all at once?
all at once with the push of the app button.
Okay… so basically you want an app that, when you press the app button (in the SmartApps section of the SmartThings mobile App), it will:
Is this correct? I just want to understand exactly what you are looking for. Have you done any coding before? Are you looking for help with writing your own SmartApp?
Precisely! Coming from Vera I’ve been used to having individual “scenes” in which to control a bunch of my connected devices all at once by actively running the scene. For example, I have one for when I want to watch a movie. It sets certain lights to specific levels, locks a door, and a few other things when I hit the button (or use my voice by way of Tasked/AutoVoice/AutHomation).
Well, I do have some experience with coding, but I’m pretty novice when it comes to the coding language used for SmartApps. However, I was mainly hoping there was one already created that would allow me to do all this from one app without having to get into the code.
Hey @chrisb, just thought I’d check back in on this. Any ideas of how to create a “press to activate” smartapp to control a bunch of my devices all at once with the push of its smartapp play button without having to code? Is there not already one available that I could use as a template?
Okay… Gotcha… I think I understand that you’re looking for now… and yes, I believe there is an easy way to do this.
You could tackle it by writing and SmartApp (or having someone else do it)… it wouldn’t be too complicated. However, I think there’s an even easier way:
In the mobile app, tap on the little quote bubble at the top right of the screen. Here you can change modes and do other stuff. At the bottom right there is settings box where you can add new modes/behaviors. Tap on this and then tap on ‘Add new Action’ Give it a name, such as ‘Movie Night.’ After this you have lots of options as far as tweaking your devices to the desired results.
@triggertact In the initialize section use:
subscribe(app, appTouch)
Then make a function like:
def appTouch(evt) {
log.debug "appTouch: $evt"
}
And the code you want to execute will go there. This will give that little “play” icon in the smart app. I’ve been using it for testing something else
Edit: It’s similar to the “Big Turn Off” app… or any other example app that has the play icon when in use.
Thanks guys. I actually just ended up using the Make It So SmartApp. Allows me to adjust all the devices I need to and can touch the play button on it in the apps section. Thanks again!
Does anyone have the fully working of this smart app. The copying/pasting messed with “”.