You Left Something Open App with SmartThings

04 Nov You Left Something Open App with SmartThings

This SmartThings SmartApp checks all your doors when you enter a specific mode like Away or Night and notifies immediately if something is left open.

 * You Left It Open
 * Copyright 2014 Brian Critchlow
 * Based on Its too cold code by SmartThings
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at:
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 * for the specific language governing permissions and limitations under the License.

    name: "You Left It Open",
    namespace: "docwisdom",
    author: "Brian Critchlow",
    description: "Notifies if contact sensors are open when a mode changes",
    category: "Safety & Security",
    iconUrl: "",
    iconX2Url: ""

	section("When I enter these modes") {
		input "newMode", "mode", title: "Modes?", multiple: true, required: true
	section("Check that these are closed") {
		input "doors", "capability.contactSensor", multiple: true, required: true

def installed() {
	log.debug "Installed with settings: ${settings}"

def updated() {
	log.debug "Updated with settings: ${settings}"

def initialize() {
	if (newMode != null) {
		subscribe(location, modeChangeHandler)

def modeChangeHandler(evt) {
	log.debug "Mode change to: ${evt.value}"

    // Have to handle when they select one mode or multiple
    if (newMode.any{ it == evt.value } || newMode == evt.value) {

def checkDoors() {
	def open = doors.findAll { it?.latestValue("contact") == "open" }
    if(open) {
    	def msg = "${} was left open!" msg
    } else {
    	def msg = "All doors & windows are closed." msg
No Comments

Post A Comment