mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
Check for null device and send refresh() from configure()
This commit is contained in:
@@ -25,6 +25,7 @@ metadata {
|
||||
capability "Refresh"
|
||||
capability "Actuator"
|
||||
capability "Sensor"
|
||||
capability "Configuration"
|
||||
|
||||
fingerprint manufacturer: "015D", prod: "0651", model: "F51C", deviceJoinName: "Zooz ZEN 20 Power Strip"
|
||||
}
|
||||
@@ -65,6 +66,10 @@ def updated() {
|
||||
}
|
||||
}
|
||||
|
||||
def configure() {
|
||||
refresh()
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
// Event Generation //
|
||||
@@ -107,6 +112,7 @@ def zwaveBinaryEvent(cmd, endpoint) {
|
||||
def result = []
|
||||
def children = childDevices
|
||||
def childDevice = children.find{it.deviceNetworkId.endsWith("$endpoint")}
|
||||
if (childDevice) {
|
||||
childDevice.sendEvent(name: "switch", value: cmd.value ? "on" : "off")
|
||||
|
||||
if (cmd.value) {
|
||||
@@ -114,10 +120,11 @@ def zwaveBinaryEvent(cmd, endpoint) {
|
||||
result << createEvent(name: "switch", value: "on")
|
||||
} else {
|
||||
// All off and the strip is off
|
||||
if (! children.any { it.currentValue("switch") == "on" }) {
|
||||
if (!children.any { it.currentValue("switch") == "on" }) {
|
||||
result << createEvent(name: "switch", value: "off")
|
||||
}
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user