From d3bc5981fc9b4cd552d20606542a60b4fc37a897 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Mon, 9 Sep 2019 12:18:32 +0200 Subject: [PATCH 1/3] Fingeprint and couple of tweaks for Everspring Outdoor Floodlight --- .../zwave-motion-light-sensor.groovy | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy b/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy index 26ed7d77b2a..421e5252055 100644 --- a/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy +++ b/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy @@ -31,6 +31,7 @@ metadata { fingerprint mfr: "0258", prod: "0003", model: "008D", deviceJoinName: "NEO Coolcam Motion/Light Sensor" //zw:S type:0701 mfr:0258 prod:0003 model:108D ver:3.80 zwv:4.38 lib:06 cc:5E,86,72,5A,73,80,31,71,30,70,85,59,84 role:06 ff:8C07 ui:8C07 EU version fingerprint mfr: "0258", prod: "0003", model: "108D", deviceJoinName: "NEO Coolcam Motion/Light Sensor" + fingerprint mfr: "0060", prod: "0012", model: "0001", deviceJoinName: "Everspring Outdoor Floodlight", mmnm: "SmartThings", vid: "generic-motion-light-sensor" } simulator { @@ -89,6 +90,9 @@ def updated() { def configure() { // Device wakes up every deviceCheckInterval hours, this interval allows us to miss one wakeup notification before marking offline sendEvent(name: "checkInterval", value: 2 * deviceWakeUpInterval * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) + + isEverspring() ? + response(zwave.configurationV1.configurationSet(parameterNumber: 3, size: 2, scaledConfigurationValue: 600)) : [] } def getDeviceWakeUpInterval() { @@ -121,7 +125,7 @@ private getCommandClassVersions() { def parse(String description) { def results = [] if (description.startsWith("Err")) { - results << createEvent(descriptionText: description, displayed: true) + results += createEvent(descriptionText: description, displayed: true) } else { def cmd = zwave.parse(description, commandClassVersions) if (cmd) { @@ -144,9 +148,9 @@ def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cm def results = [] if (cmd.notificationType == 0x07) { // Burglar if (cmd.event == 0x08) { // detected - results << sensorMotionEvent(1) + results += sensorMotionEvent(1) } else if (cmd.event == 0x00) { // inactive - results << sensorMotionEvent(0) + results += sensorMotionEvent(0) } } return results @@ -162,7 +166,7 @@ def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) { } else { map.value = cmd.batteryLevel } - results << createEvent(map) + results += createEvent(map) return results } @@ -179,21 +183,21 @@ def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelR default: map.descriptionText = cmd.toString() } - results << createEvent(map) + results += createEvent(map) return results } def zwaveEvent(physicalgraph.zwave.commands.wakeupv2.WakeUpNotification cmd) { def results = [] - results << createEvent(descriptionText: "$device.displayName woke up", isStateChange: false) - results << response(zwave.sensorMultilevelV5.sensorMultilevelGet(sensorType: 3, scale: 1).format()) + results += createEvent(descriptionText: "$device.displayName woke up", isStateChange: false) + results += response(zwave.sensorMultilevelV5.sensorMultilevelGet(sensorType: 3, scale: 1).format()) if (!state.lastbatt || (now() - state.lastbatt) >= 10 * 60 * 60 * 1000) { - results << response(["delay 1000", + results += response(["delay 1000", zwave.batteryV1.batteryGet().format(), "delay 2000" ]) } - results << response(zwave.wakeUpV2.wakeUpNoMoreInformation().format()) + results += response(zwave.wakeUpV2.wakeUpNoMoreInformation().format()) return results } @@ -206,9 +210,13 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) { def sensorMotionEvent(value) { def result = [] if (value) { - result << createEvent(name: "motion", value: "active", descriptionText: "$device.displayName detected motion") + result += createEvent(name: "motion", value: "active", descriptionText: "$device.displayName detected motion") } else { - result << createEvent(name: "motion", value: "inactive", descriptionText: "$device.displayName motion has stopped") + result += createEvent(name: "motion", value: "inactive", descriptionText: "$device.displayName motion has stopped") } return result } + +private isEverspring() { + zwaveInfo.mfr == "0060" +} From 538ab15259de53ca71f16c914f4b940c1a079482 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Mon, 9 Sep 2019 14:55:55 +0200 Subject: [PATCH 2/3] Syntax & comments changes in configuration. --- .../zwave-motion-light-sensor.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy b/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy index 421e5252055..1e9dc8fd64a 100644 --- a/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy +++ b/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy @@ -91,8 +91,9 @@ def configure() { // Device wakes up every deviceCheckInterval hours, this interval allows us to miss one wakeup notification before marking offline sendEvent(name: "checkInterval", value: 2 * deviceWakeUpInterval * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) - isEverspring() ? - response(zwave.configurationV1.configurationSet(parameterNumber: 3, size: 2, scaledConfigurationValue: 600)) : [] + if (isEverspring()) { + response(zwave.configurationV1.configurationSet(parameterNumber: 3, size: 2, scaledConfigurationValue: 600)) //enables illuminance report every 10 minutes + } } def getDeviceWakeUpInterval() { From 7f9cd36fce07be4ff3d1ba1135c6d9245cb6e3af Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Wed, 11 Sep 2019 09:20:02 +0200 Subject: [PATCH 3/3] Configuration change to be device specific --- .../zwave-motion-light-sensor.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy b/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy index 1e9dc8fd64a..d13faa016c1 100644 --- a/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy +++ b/devicetypes/smartthings/zwave-motion-light-sensor.src/zwave-motion-light-sensor.groovy @@ -91,7 +91,7 @@ def configure() { // Device wakes up every deviceCheckInterval hours, this interval allows us to miss one wakeup notification before marking offline sendEvent(name: "checkInterval", value: 2 * deviceWakeUpInterval * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) - if (isEverspring()) { + if (isEverspringFloodlight()) { response(zwave.configurationV1.configurationSet(parameterNumber: 3, size: 2, scaledConfigurationValue: 600)) //enables illuminance report every 10 minutes } } @@ -218,6 +218,6 @@ def sensorMotionEvent(value) { return result } -private isEverspring() { - zwaveInfo.mfr == "0060" +private isEverspringFloodlight() { + zwaveInfo.mfr == "0060" && zwaveInfo.model == "0001" }