diff --git a/devicetypes/smartthings/bose-soundtouch.src/bose-soundtouch.groovy b/devicetypes/smartthings/bose-soundtouch.src/bose-soundtouch.groovy index ff6a8ee..126f9fd 100644 --- a/devicetypes/smartthings/bose-soundtouch.src/bose-soundtouch.groovy +++ b/devicetypes/smartthings/bose-soundtouch.src/bose-soundtouch.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Bose SoundTouch * diff --git a/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy b/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy index 74ce052..e51f033 100644 --- a/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy +++ b/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy @@ -108,11 +108,20 @@ def updated(){ } } +def getCommandClassVersions() { + [ + 0x20: 1, // Basic + 0x26: 1, // SwitchMultilevel + 0x56: 1, // Crc16Encap + 0x70: 1, // Configuration + ] +} + def parse(String description) { def result = null if (description != "updated") { log.debug "parse() >> zwave.parse($description)" - def cmd = zwave.parse(description, [0x20: 1, 0x26: 1, 0x70: 1]) + def cmd = zwave.parse(description, commandClassVersions) if (cmd) { result = zwaveEvent(cmd) } @@ -179,6 +188,16 @@ def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelS [createEvent(name:"switch", value:"on"), response(zwave.switchMultilevelV1.switchMultilevelGet().format())] } +def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) { + def versions = commandClassVersions + def version = versions[cmd.commandClass as Integer] + def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass) + def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data) + if (encapsulatedCommand) { + zwaveEvent(encapsulatedCommand) + } +} + def zwaveEvent(physicalgraph.zwave.Command cmd) { // Handles all Z-Wave commands we aren't interested in [:] diff --git a/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy b/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy index f5b44ca..c5a7d16 100644 --- a/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy +++ b/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Hue Bloom * diff --git a/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy b/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy index ed230c0..c5ed4eb 100644 --- a/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy +++ b/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Hue Bridge * diff --git a/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy b/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy index f2f0b99..8752ce4 100644 --- a/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy +++ b/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Hue Bulb * diff --git a/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy b/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy index bd786a1..60cfd69 100644 --- a/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy +++ b/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Hue Lux Bulb * diff --git a/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy b/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy index bae3501..0163a79 100644 --- a/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy +++ b/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Hue White Ambiance Bulb * diff --git a/devicetypes/smartthings/wemo-light-switch.src/wemo-light-switch.groovy b/devicetypes/smartthings/wemo-light-switch.src/wemo-light-switch.groovy index db21866..fcc2285 100644 --- a/devicetypes/smartthings/wemo-light-switch.src/wemo-light-switch.groovy +++ b/devicetypes/smartthings/wemo-light-switch.src/wemo-light-switch.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Copyright 2015 SmartThings * diff --git a/devicetypes/smartthings/wemo-motion.src/wemo-motion.groovy b/devicetypes/smartthings/wemo-motion.src/wemo-motion.groovy index e094d27..3598ce5 100644 --- a/devicetypes/smartthings/wemo-motion.src/wemo-motion.groovy +++ b/devicetypes/smartthings/wemo-motion.src/wemo-motion.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Copyright 2015 SmartThings * diff --git a/devicetypes/smartthings/wemo-switch.src/wemo-switch.groovy b/devicetypes/smartthings/wemo-switch.src/wemo-switch.groovy index 51894fd..783e505 100644 --- a/devicetypes/smartthings/wemo-switch.src/wemo-switch.groovy +++ b/devicetypes/smartthings/wemo-switch.src/wemo-switch.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Copyright 2015 SmartThings * diff --git a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy index 1a98c39..820e07a 100644 --- a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy +++ b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy @@ -66,22 +66,29 @@ def parse(String description) { else { sendEvent(event) } - } - else { - def cluster = zigbee.parse(description) - - if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) { - if (cluster.data[0] == 0x00) { + } else { + def descMap = zigbee.parseDescriptionAsMap(description) + if (descMap && descMap.clusterInt == 0x0006 && descMap.commandInt == 0x07) { + if (descMap.data[0] == "00") { log.debug "ON/OFF REPORTING CONFIG RESPONSE: " + cluster sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]) - } - else { + } else { log.warn "ON/OFF REPORTING CONFIG FAILED- error code:${cluster.data[0]}" } - } - else { + } else if (device.getDataValue("manufacturer") == "sengled" && descMap && descMap.clusterInt == 0x0008 && descMap.attrInt == 0x0000) { + // This is being done because the sengled element touch/classic incorrectly uses the value 0xFF for the max level. + // Per the ZCL spec for the UINT8 data type 0xFF is an invalid value, and 0xFE should be the max. Here we + // manually handle the invalid attribute value since it will be ignored by getEvent as an invalid value. + // We also set the level of the bulb to 0xFE so future level reports will be 0xFE until it is changed by + // something else. + if (descMap.value.toUpperCase() == "FF") { + descMap.value = "FE" + } + sendHubCommand(zigbee.command(zigbee.LEVEL_CONTROL_CLUSTER, 0x00, "FE0000").collect { new physicalgraph.device.HubAction(it) }, 0) + sendEvent(zigbee.getEventFromAttrData(descMap.clusterInt, descMap.attrInt, descMap.encoding, descMap.value)) + } else { log.warn "DID NOT PARSE MESSAGE for description : $description" - log.debug "${cluster}" + log.debug "${descMap}" } } } diff --git a/devicetypes/smartthings/zwave-dimmer-switch-generic.src/zwave-dimmer-switch-generic.groovy b/devicetypes/smartthings/zwave-dimmer-switch-generic.src/zwave-dimmer-switch-generic.groovy index 40f7ce6..53c850b 100644 --- a/devicetypes/smartthings/zwave-dimmer-switch-generic.src/zwave-dimmer-switch-generic.groovy +++ b/devicetypes/smartthings/zwave-dimmer-switch-generic.src/zwave-dimmer-switch-generic.groovy @@ -88,11 +88,20 @@ def updated(){ sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) } +def getCommandClassVersions() { + [ + 0x20: 1, // Basic + 0x26: 1, // SwitchMultilevel + 0x56: 1, // Crc16Encap + 0x70: 1, // Configuration + ] +} + def parse(String description) { def result = null if (description != "updated") { log.debug "parse() >> zwave.parse($description)" - def cmd = zwave.parse(description, [0x20: 1, 0x26: 1, 0x70: 1]) + def cmd = zwave.parse(description, commandClassVersions) if (cmd) { result = zwaveEvent(cmd) } @@ -159,6 +168,16 @@ def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelS [createEvent(name:"switch", value:"on"), response(zwave.switchMultilevelV1.switchMultilevelGet().format())] } +def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) { + def versions = commandClassVersions + def version = versions[cmd.commandClass as Integer] + def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass) + def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data) + if (encapsulatedCommand) { + zwaveEvent(encapsulatedCommand) + } +} + def zwaveEvent(physicalgraph.zwave.Command cmd) { // Handles all Z-Wave commands we aren't interested in [:] diff --git a/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy b/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy index 401be0b..0737806 100644 --- a/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy +++ b/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy @@ -85,11 +85,21 @@ metadata { details(["switch", "power", "energy", "levelSliderControl", "refresh", "reset"]) } +def getCommandClassVersions() { + [ + 0x20: 1, // Basic + 0x26: 3, // SwitchMultilevel + 0x56: 1, // Crc16Encap + 0x70: 1, // Configuration + 0x32: 3, // Meter + ] +} + // parse events into attributes def parse(String description) { def result = null if (description != "updated") { - def cmd = zwave.parse(description, [0x20: 1, 0x26: 3, 0x70: 1, 0x32:3]) + def cmd = zwave.parse(description, commandClassVersions) if (cmd) { result = zwaveEvent(cmd) log.debug("'$description' parsed to $result") @@ -124,6 +134,21 @@ def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv3.SwitchMultilevelR dimmerEvents(cmd) } +def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) { + def versions = commandClassVersions + def version = versions[cmd.commandClass as Integer] + def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass) + def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data) + if (encapsulatedCommand) { + zwaveEvent(encapsulatedCommand) + } +} + +def zwaveEvent(physicalgraph.zwave.Command cmd) { + // Handles all Z-Wave commands we aren't interested in + [:] +} + def dimmerEvents(physicalgraph.zwave.Command cmd) { def result = [] def value = (cmd.value ? "on" : "off") diff --git a/devicetypes/smartthings/zwave-metering-switch.src/zwave-metering-switch.groovy b/devicetypes/smartthings/zwave-metering-switch.src/zwave-metering-switch.groovy index deb07d1..4a306e2 100644 --- a/devicetypes/smartthings/zwave-metering-switch.src/zwave-metering-switch.groovy +++ b/devicetypes/smartthings/zwave-metering-switch.src/zwave-metering-switch.groovy @@ -89,10 +89,19 @@ def updated() { } catch (e) { log.debug e } } +def getCommandClassVersions() { + [ + 0x20: 1, // Basic + 0x32: 1, // SwitchMultilevel + 0x56: 1, // Crc16Encap + 0x72: 2, // ManufacturerSpecific + ] +} + def parse(String description) { def result = null if(description == "updated") return - def cmd = zwave.parse(description, [0x20: 1, 0x32: 1, 0x72: 2]) + def cmd = zwave.parse(description, commandClassVersions) if (cmd) { result = zwaveEvent(cmd) } @@ -157,6 +166,16 @@ def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerS result } +def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) { + def versions = commandClassVersions + def version = versions[cmd.commandClass as Integer] + def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass) + def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data) + if (encapsulatedCommand) { + zwaveEvent(encapsulatedCommand) + } +} + def zwaveEvent(physicalgraph.zwave.Command cmd) { log.debug "$device.displayName: Unhandled: $cmd" [:] diff --git a/devicetypes/smartthings/zwave-switch-generic.src/zwave-switch-generic.groovy b/devicetypes/smartthings/zwave-switch-generic.src/zwave-switch-generic.groovy index 2a14e8e..4cd405a 100644 --- a/devicetypes/smartthings/zwave-switch-generic.src/zwave-switch-generic.groovy +++ b/devicetypes/smartthings/zwave-switch-generic.src/zwave-switch-generic.groovy @@ -71,9 +71,17 @@ def updated(){ sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) } +def getCommandClassVersions() { + [ + 0x20: 1, // Basic + 0x56: 1, // Crc16Encap + 0x70: 1, // Configuration + ] +} + def parse(String description) { def result = null - def cmd = zwave.parse(description, [0x20: 1, 0x70: 1]) + def cmd = zwave.parse(description, commandClassVersions) if (cmd) { result = createEvent(zwaveEvent(cmd)) } @@ -120,6 +128,15 @@ def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerS createEvent([descriptionText: "$device.displayName MSR: $msr", isStateChange: false]) } +def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) { + def versions = commandClassVersions + def version = versions[cmd.commandClass as Integer] + def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass) + def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data) + if (encapsulatedCommand) { + zwaveEvent(encapsulatedCommand) + } +} def zwaveEvent(physicalgraph.zwave.Command cmd) { // Handles all Z-Wave commands we aren't interested in diff --git a/devicetypes/smartthings/zwave-switch.src/zwave-switch.groovy b/devicetypes/smartthings/zwave-switch.src/zwave-switch.groovy index 7db5f5c..6d08a1b 100644 --- a/devicetypes/smartthings/zwave-switch.src/zwave-switch.groovy +++ b/devicetypes/smartthings/zwave-switch.src/zwave-switch.groovy @@ -89,9 +89,17 @@ def updated(){ } } +def getCommandClassVersions() { + [ + 0x20: 1, // Basic + 0x56: 1, // Crc16Encap + 0x70: 1, // Configuration + ] +} + def parse(String description) { def result = null - def cmd = zwave.parse(description, [0x20: 1, 0x70: 1]) + def cmd = zwave.parse(description, commandClassVersions) if (cmd) { result = createEvent(zwaveEvent(cmd)) } @@ -138,6 +146,16 @@ def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerS createEvent([descriptionText: "$device.displayName MSR: $msr", isStateChange: false]) } +def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) { + def versions = commandClassVersions + def version = versions[cmd.commandClass as Integer] + def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass) + def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data) + if (encapsulatedCommand) { + zwaveEvent(encapsulatedCommand) + } +} + def zwaveEvent(physicalgraph.zwave.Command cmd) { // Handles all Z-Wave commands we aren't interested in diff --git a/smartapps/smartthings/bose-soundtouch-connect.src/bose-soundtouch-connect.groovy b/smartapps/smartthings/bose-soundtouch-connect.src/bose-soundtouch-connect.groovy index 883c6e8..6a2d850 100644 --- a/smartapps/smartthings/bose-soundtouch-connect.src/bose-soundtouch-connect.groovy +++ b/smartapps/smartthings/bose-soundtouch-connect.src/bose-soundtouch-connect.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Bose SoundTouch (Connect) * diff --git a/smartapps/smartthings/hue-connect.src/hue-connect.groovy b/smartapps/smartthings/hue-connect.src/hue-connect.groovy index b343b20..f72c914 100644 --- a/smartapps/smartthings/hue-connect.src/hue-connect.groovy +++ b/smartapps/smartthings/hue-connect.src/hue-connect.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Hue Service Manager * @@ -1083,7 +1085,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 +1093,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 +1108,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 +1126,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 +1137,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 +1147,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 +1205,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 +1316,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 diff --git a/smartapps/smartthings/wemo-connect.src/wemo-connect.groovy b/smartapps/smartthings/wemo-connect.src/wemo-connect.groovy index 73b4426..c0e72ca 100644 --- a/smartapps/smartthings/wemo-connect.src/wemo-connect.groovy +++ b/smartapps/smartthings/wemo-connect.src/wemo-connect.groovy @@ -1,3 +1,5 @@ +//DEPRECATED. INTEGRATION MOVED TO SUPER LAN CONNECT + /** * Copyright 2015 SmartThings *