From 74a35eeddb9a6d4f4dcef6acddab315129c610e9 Mon Sep 17 00:00:00 2001 From: juano2310 Date: Tue, 30 May 2017 17:50:09 -0400 Subject: [PATCH 1/4] ICP-1124 - Sylvania SMART BR30 RGBW ' s color ticker moving randomly state overwrite: true --- .../zigbee-rgbw-bulb.groovy | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy index aa2cd02..b921432 100644 --- a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy +++ b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy @@ -103,12 +103,12 @@ def parse(String description) { if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) { if(zigbeeMap.attrInt == ATTRIBUTE_HUE){ //Hue Attribute - def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) - sendEvent(name: "hue", value: hueValue, descriptionText: "Color has changed") + state.hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) + runIn(5, updateColor, [overwrite: true]) } else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute - def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) - sendEvent(name: "saturation", value: saturationValue, descriptionText: "Color has changed", displayed: false) + state.saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) + runIn(5, updateColor, [overwrite: true]) } } else if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) { @@ -127,6 +127,11 @@ def parse(String description) { } } +def updateColor() { + sendEvent(name: "hue", value: state.hueValue, descriptionText: "Color has changed") + sendEvent(name: "saturation", value: state.saturationValue, descriptionText: "Color has changed", displayed: false) +} + def on() { zigbee.on() } @@ -204,9 +209,9 @@ def setColor(value){ log.trace "setColor($value)" zigbee.on() + zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_HUE_AND_SATURATION_COMMAND, - getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") + - zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + - zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") + + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) } def setHue(value) { From d3728d95b29f6f1b2bb4e528acae7194f172d8cc Mon Sep 17 00:00:00 2001 From: Bob Florian Date: Wed, 31 May 2017 16:45:55 -0700 Subject: [PATCH 2/4] MSA-1951 added second Inovelli fingerprint --- .../inovelli-2-channel-smart-plug.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devicetypes/erocm123/inovelli-2-channel-smart-plug.src/inovelli-2-channel-smart-plug.groovy b/devicetypes/erocm123/inovelli-2-channel-smart-plug.src/inovelli-2-channel-smart-plug.groovy index 2aabca2..879189f 100644 --- a/devicetypes/erocm123/inovelli-2-channel-smart-plug.src/inovelli-2-channel-smart-plug.groovy +++ b/devicetypes/erocm123/inovelli-2-channel-smart-plug.src/inovelli-2-channel-smart-plug.groovy @@ -26,7 +26,9 @@ metadata { capability "Polling" capability "Refresh" capability "Health Check" - fingerprint manufacturer: "015D", prod: "0221", model: "251C" + + fingerprint manufacturer: "015D", prod: "0221", model: "251C", deviceJoinName: "Show Home 2-Channel Smart Plug" + fingerprint manufacturer: "0312", prod: "B221", model: "251C", deviceJoinName: "Inovelli 2-Channel Smart Plug" } simulator {} preferences {} From 4c6d1eddb2eab35b013ef1d77fed20f5e807830e Mon Sep 17 00:00:00 2001 From: Zach Varberg Date: Wed, 31 May 2017 11:11:58 -0500 Subject: [PATCH 3/4] Correctly configure Aeon Multisensor Gen5 Previously this device had been changed to use configureAfterSecure to work around the secure inclusion for Z-Wave. However, support was added hub side for handling this so it needed to be changed back to using the normal configure process. This resolves: https://smartthings.atlassian.net/browse/DVCSMP-2680 --- .../aeon-multisensor-gen5.groovy | 78 +++++++++---------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/devicetypes/smartthings/aeon-multisensor-gen5.src/aeon-multisensor-gen5.groovy b/devicetypes/smartthings/aeon-multisensor-gen5.src/aeon-multisensor-gen5.groovy index 2979531..5b31e3d 100644 --- a/devicetypes/smartthings/aeon-multisensor-gen5.src/aeon-multisensor-gen5.groovy +++ b/devicetypes/smartthings/aeon-multisensor-gen5.src/aeon-multisensor-gen5.groovy @@ -22,8 +22,6 @@ metadata { capability "Battery" capability "Health Check" - command "configureAfterSecure" - fingerprint deviceId: "0x0701", inClusters: "0x5E,0x86,0x72,0x59,0x85,0x73,0x71,0x84,0x80,0x30,0x31,0x70,0x98,0x7A", outClusters:"0x5A" fingerprint mfr:"0086", prod:"0102", model:"004A", deviceJoinName: "Aeon Labs MultiSensor (Gen 5)" } @@ -91,12 +89,12 @@ metadata { valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat", width: 2, height: 2) { state "battery", label:'${currentValue}% battery', unit:"" } - standardTile("configureAfterSecure", "device.configure", inactiveLabel: false, decoration: "flat", width: 2, height: 2) { - state "configure", label:'', action:"configureAfterSecure", icon:"st.secondary.configure" + standardTile("configure", "device.configure", inactiveLabel: false, decoration: "flat", width: 2, height: 2) { + state "configure", label:'', action:"configure", icon:"st.secondary.configure" } main(["motion", "temperature", "humidity", "illuminance"]) - details(["motion", "temperature", "humidity", "illuminance", "battery", "configureAfterSecure"]) + details(["motion", "temperature", "humidity", "illuminance", "battery", "configure"]) } } @@ -131,8 +129,8 @@ def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd) if (!isConfigured()) { // we're still in the process of configuring a newly joined device - log.debug("not sending wakeUpNoMoreInformation yet") - result += response(configureAfterSecure()) + log.debug("not sending wakeUpNoMoreInformation yet: late configure") + result += response(configure()) } else { result += response(zwave.wakeUpV1.wakeUpNoMoreInformation()) } @@ -150,11 +148,6 @@ def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulat } } -def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityCommandsSupportedReport cmd) { - // log.debug "Received SecurityCommandsSupportedReport" - response(configureAfterSecure()) -} - def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) { def map = [ name: "battery", unit: "%" ] if (cmd.batteryLevel == 0xFF) { @@ -226,36 +219,6 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) { createEvent(descriptionText: cmd.toString(), isStateChange: false) } -def configureAfterSecure() { - // log.debug "configureAfterSecure()" - - def request = [ - // send temperature, humidity, and illuminance every 8 minutes - zwave.configurationV1.configurationSet(parameterNumber: 101, size: 4, scaledConfigurationValue: 128|64|32), - zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 8*60), - - // send battery every 20 hours - zwave.configurationV1.configurationSet(parameterNumber: 102, size: 4, scaledConfigurationValue: 1), - zwave.configurationV1.configurationSet(parameterNumber: 112, size: 4, scaledConfigurationValue: 20*60*60), - - // send no-motion report 60 seconds after motion stops - zwave.configurationV1.configurationSet(parameterNumber: 3, size: 2, scaledConfigurationValue: 60), - - // send binary sensor report instead of basic set for motion - zwave.configurationV1.configurationSet(parameterNumber: 5, size: 1, scaledConfigurationValue: 2), - - // disable notification-style motion events - zwave.notificationV3.notificationSet(notificationType: 7, notificationStatus: 0), - - zwave.batteryV1.batteryGet(), - zwave.sensorBinaryV2.sensorBinaryGet(sensorType:0x0C) - ] - - setConfigured() - - secureSequence(request) + ["delay 20000", zwave.wakeUpV1.wakeUpNoMoreInformation().format()] -} - /** * PING is used by Device-Watch in attempt to reach the Device * */ @@ -265,7 +228,36 @@ def ping() { def configure() { // log.debug "configure()" - //["delay 30000"] + secure(zwave.securityV1.securityCommandsSupportedGet()) + def request = [] + // send temperature, humidity, and illuminance every 8 minutes + request << zwave.configurationV1.configurationSet(parameterNumber: 101, size: 4, scaledConfigurationValue: 128|64|32) + request << zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 8*60) + + // send battery every 20 hours + request << zwave.configurationV1.configurationSet(parameterNumber: 102, size: 4, scaledConfigurationValue: 1) + request << zwave.configurationV1.configurationSet(parameterNumber: 112, size: 4, scaledConfigurationValue: 20*60*60) + + // send no-motion report 60 seconds after motion stops + request << zwave.configurationV1.configurationSet(parameterNumber: 3, size: 2, scaledConfigurationValue: 60) + + // send binary sensor report instead of basic set for motion + request << zwave.configurationV1.configurationSet(parameterNumber: 5, size: 1, scaledConfigurationValue: 2) + + // Turn on the Multisensor Gen5 PIR sensor + request << zwave.configurationV1.configurationSet(parameterNumber: 4, size: 1, scaledConfigurationValue: 1) + + // disable notification-style motion events + request << zwave.notificationV3.notificationSet(notificationType: 7, notificationStatus: 0) + + request << zwave.batteryV1.batteryGet() + request << zwave.sensorBinaryV2.sensorBinaryGet(sensorType: 0x0C) //motion + request << zwave.sensorMultilevelV5.sensorMultilevelGet(sensorType: 0x01) //temperature + request << zwave.sensorMultilevelV5.sensorMultilevelGet(sensorType: 0x03) //illuminance + request << zwave.sensorMultilevelV5.sensorMultilevelGet(sensorType: 0x05) //humidity + + setConfigured() + + secureSequence(request) + ["delay 20000", zwave.wakeUpV1.wakeUpNoMoreInformation().format()] } private setConfigured() { From 945a97208281e7713b7697388ab4fef368ccfe6f Mon Sep 17 00:00:00 2001 From: Lars Finander Date: Mon, 5 Jun 2017 16:50:03 -0600 Subject: [PATCH 4/4] DVCSMP-2688 Remove sending turningOn/Off events -Removed createSwitchEvent() --- .../hue-connect.src/hue-connect.groovy | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/smartapps/smartthings/hue-connect.src/hue-connect.groovy b/smartapps/smartthings/hue-connect.src/hue-connect.groovy index b343b20..78f7c87 100644 --- a/smartapps/smartthings/hue-connect.src/hue-connect.groovy +++ b/smartapps/smartthings/hue-connect.src/hue-connect.groovy @@ -1083,7 +1083,6 @@ def on(childDevice) { log.debug "Executing 'on'" def id = getId(childDevice) updateInProgress() - createSwitchEvent(childDevice, "on") put("lights/$id/state", [on: true]) return "Bulb is turning On" } @@ -1092,7 +1091,6 @@ def off(childDevice) { log.debug "Executing 'off'" def id = getId(childDevice) updateInProgress() - createSwitchEvent(childDevice, "off") put("lights/$id/state", [on: false]) return "Bulb is turning Off" } @@ -1108,8 +1106,6 @@ def setLevel(childDevice, percent) { else level = Math.min(Math.round(percent * 254 / 100), 254) - createSwitchEvent(childDevice, level > 0, percent) - // For Zigbee lights, if level is set to 0 ST just turns them off without changing level // that means that the light will still be on when on is called next time // Lets emulate that here @@ -1128,7 +1124,6 @@ def setSaturation(childDevice, percent) { // 0 - 254 def level = Math.min(Math.round(percent * 254 / 100), 254) // TODO should this be done by app only or should we default to on? - createSwitchEvent(childDevice, "on") put("lights/$id/state", [sat: level, on: true]) return "Setting saturation to $percent" } @@ -1140,7 +1135,6 @@ def setHue(childDevice, percent) { // 0 - 65535 def level = Math.min(Math.round(percent * 65535 / 100), 65535) // TODO should this be done by app only or should we default to on? - createSwitchEvent(childDevice, "on") put("lights/$id/state", [hue: level, on: true]) return "Setting hue to $percent" } @@ -1151,7 +1145,6 @@ def setColorTemperature(childDevice, huesettings) { updateInProgress() // 153 (6500K) to 500 (2000K) def ct = hueSettings == 6500 ? 153 : Math.round(1000000 / huesettings) - createSwitchEvent(childDevice, "on") put("lights/$id/state", [ct: ct, on: true]) return "Setting color temperature to $ct" } @@ -1210,7 +1203,6 @@ def setColor(childDevice, huesettings) { if (huesettings.switch == "off") value.on = false - createSwitchEvent(childDevice, value.on ? "on" : "off") put("lights/$id/state", value) return "Setting color to $value" } @@ -1322,32 +1314,6 @@ private List getRealHubFirmwareVersions() { return location.hubs*.firmwareVersionString.findAll { it } } -/** - * Sends appropriate turningOn/turningOff state events depending on switch or level changes. - * - * @param childDevice device to send event for - * @param setSwitch The new switch state, "on" or "off" - * @param setLevel Optional, switchLevel between 0-100, used if you set level to 0 for example since - * that should generate "off" instead of level change - */ -private void createSwitchEvent(childDevice, setSwitch, setLevel = null) { - - if (setLevel == null) { - setLevel = childDevice.device?.currentValue("level") - } - // Create on, off, turningOn or turningOff event as necessary - def currentState = childDevice.device?.currentValue("switch") - if ((currentState == "off" || currentState == "turningOff")) { - if (setSwitch == "on" || setLevel > 0) { - childDevice.sendEvent(name: "switch", value: "turningOn", displayed: false) - } - } else if ((currentState == "on" || currentState == "turningOn")) { - if (setSwitch == "off" || setLevel == 0) { - childDevice.sendEvent(name: "switch", value: "turningOff", displayed: false) - } - } -} - /** * Return the supported color range for different Hue lights. If model is not specified * it defaults to the smallest Gamut (B) to ensure that colors set on a mix of devices