4 * Copyright 2014 Joseph Charette
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7 * in compliance with the License. You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
12 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
13 * for the specific language governing permissions and limitations under the License.
17 name: "Good Night House",
18 namespace: "charette.joseph@gmail.com",
19 author: "Joseph Charette",
20 description: "Some on, some off with delay for bedtime, Lock The Doors",
21 category: "Convenience",
22 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
23 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
26 * Walk Gentle Into That Good Night
28 * Author: oneaccttorulethehouse@gmail.com
33 section("When I touch the app turn these lights off…"){
34 input "switchesoff", "capability.switch", multiple: true, required:true
36 section("When I touch the app turn these lights on…"){
37 input "switcheson", "capability.switch", multiple: true, required:false
39 section("Lock theses locks...") {
40 input "lock1","capability.lock", multiple: true
42 section("And change to this mode...") {
43 input "newMode", "mode", title: "Mode?"
45 section("After so many seconds (optional)"){
46 input "waitfor", "number", title: "Off after (default 120)", required: true
53 log.debug "Installed with settings: ${settings}"
54 log.debug "Current mode = ${location.mode}"
55 subscribe(app, appTouch)
61 log.debug "Updated with settings: ${settings}"
62 log.debug "Current mode = ${location.mode}"
64 subscribe(app, appTouch)
68 log.debug "changeMode, location.mode = $location.mode, newMode = $newMode, location.modes = $location.modes"
69 if (location.mode != newMode) {
70 setLocationMode(newMode)
71 log.debug "Changed the mode to '${newMode}'"
73 log.debug "New mode is the same as the old mode, leaving it be"
75 log.debug "appTouch: $evt"
78 def delay = (waitfor != null && waitfor != "") ? waitfor * 1000 : 120000
79 switchesoff.off(delay: delay)