Compare commits

...

4 Commits

Author SHA1 Message Date
Akbur Ghafoor
99876821dc MSA-611: A security focused SmartApp which allows you to automatically check if any window with a contact sensor is left accidentally open each night. Sends an SMS if the contact sensor is open at the scheduled time. 2015-10-09 16:13:29 -05:00
Juan Pablo Risso
6854665f68 Merge pull request #177 from juano2310/Zen_PR
Adds capabilities "Temperature Measurement" and "Relative Humidity Me…
2015-10-09 13:29:31 -04:00
Juan Pablo Risso
2534afbf81 Removed Humidity 2015-10-09 12:39:26 -04:00
Juan Pablo Risso
eb3d0c2874 Adds capabilities "Temperature Measurement" and "Relative Humidity Measurement" 2015-10-09 12:34:58 -04:00
2 changed files with 62 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ metadata {
definition (name: "Zen Thermostat", namespace: "zenwithin", author: "ZenWithin") {
capability "Actuator"
capability "Thermostat"
capability "Temperature Measurement"
capability "Configuration"
capability "Refresh"
capability "Sensor"

View File

@@ -0,0 +1,61 @@
definition(
name: "Check window is closed at night",
namespace: "akbur",
author: "Akbur Ghafoor",
description: "Checks if your window is closed at night - if not, sends an SMS alert.",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/window_contact.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/window_contact@2x.png"
)
preferences {
section("When the window is open at night...") {
input "contact1", "capability.contactSensor", title: "Where?"
}
section("Text me at...") {
input("recipients", "contact", title: "Send notifications to") {
input "phone1", "phone", title: "Phone number? (in interntional format, starting with +<country code>, e.g. +447739123456)"
}
}
section("Time to check at night") {
input "time1", "time"
}
}
def installed()
{
subscribe(contact1, "contact", contactHandler)
schedule(time1, checkWindowsHandler)
}
def updated()
{
unsubscribe()
subscribe(contact, "contact", contactHandler)
schedule(time1, checkWindowsHandler)
}
def checkWindowsHandler()
{
if (state.windowsopen)
{
sendSms(phone1, "WARNING: Your ${contact1.label ?: contact1.name} is OPEN.")
}
}
def contactHandler(evt) {
if("open" == evt.value)
{
// contact is open, log it for the night check
log.debug "Contact is in ${evt.value} state"
state.windowsopen = true;
}
if("closed" == evt.value)
{
// contact was closed, log it for the night check
log.debug "Contact is in ${evt.value} state"
state.windowsopen = false;
}
}