Garage Door Open/Close Notification
/**
* Garage Door Open/Close notification
*
* Author: mark@marknorgren.com
* Date: 2013-03-09
*/
def preferences()
{
return [
sections: [
[
title: "When the garage door opens or closes...",
input: [
[
name: "multisensor",
title: "Where?",
type: "device.smartSenseMulti",
description: "Tap to set",
multiple: false
]
]
]
]
]
}
def installed()
{
subscribe(multisensor.contact)
}
def updated()
{
unsubscribe()
subscribe(multisensor.contact)
}
def contact(evt) {
log.trace "$evt.value: $evt, $settings"
if (evt.value == "closed") {
log.debug "$contact1 was closed, sending push message to user"
sendPush("Your ${contact1.label ?: contact1.name} was closed")
}
if (evt.value == "open") {
log.debug "$contact1 was opened, sending push message to user"
sendPush("Your ${contact1.label ?: contact1.name} was opened")
}
}