Scenes

Didnt find a smartapp that set up all of my switches, dimmers, & locks to a state where I wanted them for each mode so I tried to create one. Works great for when im going to bed and what to “shut it down”. I select “shut it down” mode and the app automatically Locks all of my doors, turns the night lights on at a dim level, turns any other lights off, shuts off power to wife’s curling iron LOL.

/**
 *  Scenes
 *
 *  Author: Ryan Nathanson
 */

preferences {
		section("When I Change To This Mode") {
		input "newMode", "mode", title: "Mode?"
        
        }
	section("Lock these doors") {
		input "lock", "capability.lock", multiple: true, required: false
	}
section("Unlock these doors") {
			input "unlock", "capability.lock", multiple: true, required: false
	}
	section("Dim These Lights") {
	input "MultilevelSwitch", "capability.switchLevel", multiple: true, required: false
	}
    
    
    section("How Bright?"){
     input "number", "number", title: "Percentage, 0-99", required: false
    }

section("Turn On These Switches"){
input "switcheson", "capability.switch", multiple: true, required: false
}

section("Turn Off These Switches"){
input "switchesoff", "capability.switch", multiple: true, required: false
}
}

def installed() {
subscribe(location)
subscribe(app)

}

def updated() {
unsubscribe()
subscribe(location)
subscribe(app)

}

def uninstalled() {
unsubscribe()
}

def changedLocationMode(evt) {

    switcheson?.on()
    switchesoff?.off()
        settings.MultilevelSwitch?.setLevel(number)
        lock?.lock()
        unlock?.unlock()
        

	       

}

def appTouch(evt) {

    switcheson?.on()
    switchesoff?.off()
        settings.MultilevelSwitch?.setLevel(number)
        lock?.lock()
        unlock?.unlock()
		
        

	       

}

Looks good…

I was just about to write this… thanks! :slight_smile:

It seems to be conflicting pretty bad with the app I have setup to auto turn on/off my bathroom dimmable lights via motion sensor. I’ll have to look at the “Lights follow me” code and see whats up with it because they are fighting each other on dim level.

Check out the Scene Machine Project for a variation of this App.