mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-04-03 14:23:07 +01:00
Compare commits
1 Commits
MSA-1296-1
...
MSA-1294-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c50b730cf |
@@ -94,11 +94,11 @@ def parse(String description) {
|
|||||||
def cmd = zwave.parse(description, [0x31: 1, 0x32: 1, 0x60: 3])
|
def cmd = zwave.parse(description, [0x31: 1, 0x32: 1, 0x60: 3])
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
result = createEvent(zwaveEvent(cmd))
|
result = createEvent(zwaveEvent(cmd))
|
||||||
|
log.debug "Parse returned ${result?.descriptionText}"
|
||||||
|
storeGraphData(result.name, result.value)
|
||||||
|
} else {
|
||||||
|
log.debug "zwave.parse returned null command. Cannot create event"
|
||||||
}
|
}
|
||||||
log.debug "Parse returned ${result?.descriptionText}"
|
|
||||||
|
|
||||||
storeGraphData(result.name, result.value)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* Turn on when it opens, off when closed
|
||||||
|
*/
|
||||||
|
definition(
|
||||||
|
name: "Open on Closed off",
|
||||||
|
namespace: "vancouver",
|
||||||
|
author: "SmartThings Samsung",
|
||||||
|
description: "Turn on things when the contact opens and off when it closes",
|
||||||
|
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
||||||
|
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||||
|
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
|
||||||
|
preferences {
|
||||||
|
section("When the contact opens..."){
|
||||||
|
input "contact1", "capability.contactSensor", title: "Pick a sensor:"
|
||||||
|
}
|
||||||
|
section("Pick a Light To Control..."){
|
||||||
|
input "colorLights", "capability.colorControl", multiple: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
def initialize() {
|
||||||
|
subscribe(contact, "contact.open", contactOpenHandler)
|
||||||
|
subscribe(contact, "contact.close", contactCloseHandler)
|
||||||
|
log.info( "contact is currently ->: ${contact1}" )
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* contact handler, subscribed for "open" events
|
||||||
|
*/
|
||||||
|
def contactOpenHandler(evt) {
|
||||||
|
colorLights.each {
|
||||||
|
it.on()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def contactCloseHandler(evt) {
|
||||||
|
colorLights.each {
|
||||||
|
it.off()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user