From 54179f6b1c0b8713c76f3ed9138945474c1b408c Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Mon, 8 Jun 2020 17:54:33 +0200 Subject: [PATCH 01/12] Added fingerprint for Inovelli Dimmer LZW31-SN --- .../zwave-metering-dimmer.src/zwave-metering-dimmer.groovy | 1 + 1 file changed, 1 insertion(+) 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 e0249894266..430838072b5 100644 --- a/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy +++ b/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy @@ -40,6 +40,7 @@ metadata { fingerprint mfr:"0086", prod:"0203", model:"006F", deviceJoinName: "Aeotec Dimmer Switch" //AU //Aeotec Nano Dimmer fingerprint mfr:"014F", prod:"5044", model:"3533", deviceJoinName: "GoControl Dimmer Switch" //GoControl Plug-in Dimmer fingerprint mfr:"0159", prod:"0001", model:"0055", deviceJoinName: "Qubino Dimmer Switch" //Qubino Mini Dimmer ZMNHHD1 + fingerprint mfr:"031E", prod:"0001", model:"0001", deviceJoinName: "Inovelli Dimmer Switch" //Inovelli Dimmer LZW31-SN } simulator { From 513753f6553006b932cc3db8e5b485c8161e7b17 Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Wed, 15 Jul 2020 18:02:28 +0200 Subject: [PATCH 02/12] WWST-6729 Added mcd dth for Inovelli Dimmer LZW31-SN --- .../child-color-selection.groovy | 39 ++ .../inovelli-dimmer.groovy | 599 ++++++++++++++++++ 2 files changed, 638 insertions(+) create mode 100644 devicetypes/smartthings/child-color-selection.src/child-color-selection.groovy create mode 100644 devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy diff --git a/devicetypes/smartthings/child-color-selection.src/child-color-selection.groovy b/devicetypes/smartthings/child-color-selection.src/child-color-selection.groovy new file mode 100644 index 00000000000..b08fcbc579e --- /dev/null +++ b/devicetypes/smartthings/child-color-selection.src/child-color-selection.groovy @@ -0,0 +1,39 @@ +/* Copyright 2020 SmartThings +* +* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. You may obtain a copy of the License at: +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed +* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License +* for the specific language governing permissions and limitations under the License. +* +* Child Color Selection +* +* Copyright 2020 SmartThings +* +*/ +metadata { + definition(name: "Child Color Selection", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", runLocally: false, executeCommandsLocally: false,) { + capability "Color Control" + capability "Refresh" + capability "Actuator" + } + + tiles(scale: 2){ + multiAttributeTile(name:"switch", type: "generic", width: 6, height: 4, canChangeIcon: true){ + tileAttribute ("device.color", key: "COLOR_CONTROL") { + attributeState "color", action:"setColor" + } + } + + main(["switch"]) + details(["rgbSelector", "refresh"]) + } + +} + +def setColor(value) { + parent.childSetColor(device.deviceNetworkId, value); +} diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy new file mode 100644 index 00000000000..20c189a6950 --- /dev/null +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -0,0 +1,599 @@ +/* Copyright 2020 SmartThings +* +* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. You may obtain a copy of the License at: +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed +* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License +* for the specific language governing permissions and limitations under the License. +* +* Inovelli Dimmer +* +* Copyright 2020 SmartThings +* +*/ +metadata { + definition (name: "Inovelli Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch", runLocally: false, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, genericHandler: "Z-Wave", mcdSync: true) { + capability "Actuator" + capability "Configuration" + capability "Energy Meter" + capability "Health Check" + capability "Refresh" + capability "Sensor" + capability "Switch" + capability "Switch Level" + capability "Power Meter" + + fingerprint mfr:"031E", prod:"0001", model:"0001", deviceJoinName: "Inovelli Dimmer Switch", vid: "SmartThings-smartthings-Inovelli_Dimmer"//Inovelli Dimmer LZW31-SN + } + + tiles(scale: 2) { + multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){ + tileAttribute ("device.switch", key: "PRIMARY_CONTROL") { + attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff" + attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn" + attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff" + attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn" + } + tileAttribute ("device.level", key: "SLIDER_CONTROL") { + attributeState "level", action:"switch level.setLevel" + } + } + valueTile("power", "device.power", width: 2, height: 2) { + state "default", label:'${currentValue} W' + } + valueTile("energy", "device.energy", width: 2, height: 2) { + state "default", label:'${currentValue} kWh' + } + standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) { + state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh" + } + } + + main(["switch","power","energy"]) + details(["switch", "power", "energy", "refresh"]) + + preferences { + // Preferences template begin + parameterMap.each { + input ( + title: it.name, + description: it.description, + type: "paragraph", + element: "paragraph" + ) + + switch(it.type) { + case "boolRange": + input( + name: it.key + "Boolean", + type: "bool", + title: "Enable", + description: "If you disable this option, it will overwrite setting below.", + defaultValue: it.defaultValue != it.disableValue, + required: false + ) + input( + name: it.key, + type: "number", + title: "Set value (range ${it.range})", + defaultValue: it.defaultValue, + range: it.range, + required: false + ) + break + case "boolean": + input( + type: "paragraph", + element: "paragraph", + description: "Option enabled: ${it.activeDescription}\n" + + "Option disabled: ${it.inactiveDescription}" + ) + input( + name: it.key, + type: "bool", + title: "Enable", + defaultValue: it.defaultValue == it.activeOption, + required: false + ) + break + case "enum": + input( + name: it.key, + title: "Select", + type: "enum", + options: it.values, + defaultValue: it.defaultValue, + required: false + ) + break + case "range": + input( + name: it.key, + type: "number", + title: "Set value (range ${it.range})", + defaultValue: it.defaultValue, + range: it.range, + required: false + ) + break + } + } + // Preferences template end + } +} + +def installed() { + // Device-Watch simply pings if no device events received for 32min(checkInterval) + sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) + + // Preferences template begin + state.currentPreferencesState = [:] + parameterMap.each { + state.currentPreferencesState."$it.key" = [:] + state.currentPreferencesState."$it.key".value = getPreferenceValue(it) + if (it.type == "boolRange" && getPreferenceValue(it) == it.disableValue) { + state.currentPreferencesState."$it.key".status = "disablePending" + } else { + state.currentPreferencesState."$it.key".status = "synced" + } + } + readConfigurationFromTheDevice(); +// Preferences template end + createChildDevice("smartthings", "Child Color Selection", "${device.deviceNetworkId}:" + 3, "LEDColorConfiguration", "LEDColorConfiguration") +} + +def updated() { + // Device-Watch simply pings if no device events received for 32min(checkInterval) + sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) + // Preferences template begin + parameterMap.each { + if (isPreferenceChanged(it)) { + log.debug "Preference ${it.key} has been updated from value: ${state.currentPreferencesState."$it.key".value} to ${settings."$it.key"}" + state.currentPreferencesState."$it.key".status = "syncPending" + if (it.type == "boolRange") { + def preferenceName = it.key + "Boolean" + + if (isNotNull(settings."$preferenceName")) { + if (!settings."$preferenceName") { + state.currentPreferencesState."$it.key".status = "disablePending" + } else if (state.currentPreferencesState."$it.key".status == "disabled") { + state.currentPreferencesState."$it.key".status = "syncPending" + } + } else { + state.currentPreferencesState."$it.key".status = "syncPending" + } + } + } else if (state.currentPreferencesState."$it.key".value == null) { + log.warn "Preference ${it.key} no. ${it.parameterNumber} has no value. Please check preference declaration for errors." + } + } + syncConfiguration() + // Preferences template end + + response(refresh()) +} + +private readConfigurationFromTheDevice() { + def commands = [] + parameterMap.each { + state.currentPreferencesState."$it.key".status = "reverseSyncPending" + commands += encap(zwave.configurationV2.configurationGet(parameterNumber: it.parameterNumber)) + } + sendHubCommand(commands) +} + +private syncConfiguration() { + def commands = [] + log.debug"syncConfiguration ${settings}" + parameterMap.each { + if (state.currentPreferencesState."$it.key".status == "syncPending") { + commands += encap(zwave.configurationV2.configurationSet(scaledConfigurationValue: getCommandValue(it), parameterNumber: it.parameterNumber, size: it.size)) + commands += encap(zwave.configurationV2.configurationGet(parameterNumber: it.parameterNumber)) + } else if (state.currentPreferencesState."$it.key".status == "disablePending") { + commands += encap(zwave.configurationV2.configurationSet(scaledConfigurationValue: it.disableValue, parameterNumber: it.parameterNumber, size: it.size)) + commands += encap(zwave.configurationV2.configurationGet(parameterNumber: it.parameterNumber)) + } + } + sendHubCommand(commands) +} + +def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport cmd) { + // Preferences template begin + log.debug "Configuration report: ${cmd}" + def preference = parameterMap.find( {it.parameterNumber == cmd.parameterNumber} ) + def key = preference.key + def preferenceValue = getPreferenceValue(preference, cmd.scaledConfigurationValue) + log.debug"settings.key ${settings."$key"} preferenceValue ${preferenceValue}" + + if(state.currentPreferencesState."$key".status == "reverseSyncPending"){ + log.debug "reverseSyncPending" + state.currentPreferencesState."$key".value = preferenceValue + state.currentPreferencesState."$key".status = "synced" + } else { + if (preferenceValue instanceof String && settings."$key" == preferenceValue.toBoolean()) { + state.currentPreferencesState."$key".value = settings."$key" + state.currentPreferencesState."$key".status = "synced" + } else if(preferenceValue instanceof Integer && settings."$key" == preferenceValue){ + state.currentPreferencesState."$key".value = settings."$key" + state.currentPreferencesState."$key".status = "synced" + } else if (preference.type == "boolRange") { + log.debug"${state.currentPreferencesState."$key".status}" + if (state.currentPreferencesState."$key".status == "disablePending" && preferenceValue == preference.disableValue) { + state.currentPreferencesState."$key".status = "disabled" + } else { + runIn(5, "syncConfiguration", [overwrite: true]) + } + } else { + state.currentPreferencesState."$key"?.status = "syncPending" + if(cmd.parameterNumber == 13){ + state.currentPreferencesState."$key".value = preferenceValue + state.currentPreferencesState."$key".status = "synced" + handleLEDPreferenceEvent(cmd) + } + runIn(5, "syncConfiguration", [overwrite: true]) + } + } + // Preferences template end +} + +private getPreferenceValue(preference, value = "default") { + def integerValue = value == "default" ? preference.defaultValue : value.intValue() + switch (preference.type) { + case "enum": + return String.valueOf(integerValue) + case "boolean": + return String.valueOf(preference.optionActive == integerValue) + default: + return integerValue + } +} + +private getCommandValue(preference) { + def parameterKey = preference.key + log.debug"settings parameter key ${settings."$parameterKey"} ${preference} " + switch (preference.type) { + case "boolean": + return settings."$parameterKey" ? preference.optionActive : preference.optionInactive + case "boolRange": + def parameterKeyBoolean = parameterKey + "Boolean" + return !isNotNull(settings."$parameterKeyBoolean") || settings."$parameterKeyBoolean" ? settings."$parameterKey" : preference.disableValue + case "range": + return settings."$parameterKey" + default: + return Integer.parseInt(settings."$parameterKey") + } +} + +private isNotNull(value) { + return value != null +} + +private isPreferenceChanged(preference) { + if (isNotNull(settings."$preference.key")) { + if (preference.type == "boolRange") { + def boolName = preference.key + "Boolean" + if (state.currentPreferencesState."$preference.key".status == "disabled") { + return settings."$boolName" + } else { + return state.currentPreferencesState."$preference.key".value != settings."$preference.key" || !settings."$boolName" + } + } else { + return state.currentPreferencesState."$preference.key".value != settings."$preference.key" + } + } else { + return false + } +} + +def parse(String description) { + def result = null + if (description != "updated") { + def cmd = zwave.parse(description) + if (cmd) { + result = zwaveEvent(cmd) + log.debug("'$description' parsed to $result") + } else { + log.debug("Couldn't zwave.parse '$description'") + } + } + log.debug "parsed '${description}' to ${result.inspect()}" + result +} + +def handleLEDPreferenceEvent(cmd){ + def hueState = [name: "hue", value: "${Math.round(zwaveValueToHuePercent(cmd.scaledConfigurationValue))}"] + def childDni = "${device.deviceNetworkId}:" + 3 + def childDevice = childDevices.find { it.deviceNetworkId == childDni } + childDevice?.sendEvent(hueState) + childDevice?.sendEvent(name:"saturation", value:"100") +} + +def createChildDevice(childDthNamespace, childDthName, childDni, childComponentLabel, childComponentName) { + try { + log.debug "Creating a child device: ${childDthNamespace}, ${childDthName}, ${childDni}, ${childComponentLabel}, ${childComponentName}" + def childDevice = addChildDevice(childDthNamespace, childDthName, childDni, device.hub.id, + [ completedSetup: true, + label: childComponentLabel, + isComponent: true, + componentName : childComponentName, + componentLabel: childComponentLabel + ]) + childDevice + } catch(Exception e) { + log.debug "Exception: ${e}" + } +} + +def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) { + dimmerEvents(cmd) +} + +def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv3.SwitchMultilevelReport cmd) { + dimmerEvents(cmd) +} + +def dimmerEvents(physicalgraph.zwave.Command cmd) { + log.debug "dimmer events ${cmd}" + def map = [name : "switch", value : cmd.value ? "on" : "off", descriptionText : "$device.displayName was turned $cmd.value"] + def switchEvent = createEvent(map) + def result = [switchEvent] + if (cmd.value) { + map = [name: "level", value: cmd.value == 99 ? 100 : cmd.value , unit: "%"] + result << createEvent(map) + } + if (switchEvent.isStateChange) { + result << response(["delay 3000", zwave.meterV3.meterGet(scale: 2).format()]) + } + return result +} + +def on() { + encapSequence([ + zwave.basicV1.basicSet(value: 0xFF), + zwave.basicV1.basicGet() + ], 5000) +} + +def off() { + encapSequence([ + zwave.basicV1.basicSet(value: 0x00), + zwave.basicV1.basicGet() + ], 5000) +} + +def setLevel(level){ + log.debug"setLevel" + if(level > 99) level = 99 + encapSequence([ + zwave.basicV1.basicSet(value: level), + zwave.switchMultilevelV1.switchMultilevelGet() + ], 5000) +} + +def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) { + def map = [:] + if (cmd.meterType == 1 && cmd.scale == 0){ + map = [name: "energy", value: cmd.scaledMeterValue, unit: "kWh"] + } else if(cmd.meterType == 1 && cmd.scale == 2){ + map = [name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W"] + } + createEvent(map) +} + +def zwaveEvent(physicalgraph.zwave.Command cmd) { + // Handles all Z-Wave commands we aren't interested in + log.debug "${cmd}" + [:] +} + +def childSetColor(deviceNetworkId, value) { + def id = deviceNetworkId?.split(":")[1] as Integer + sendHubCommand setColorCmd(value, id) +} + +def setColorCmd(value, id) { + if (value.hue == null || value.saturation == null) return + def ledColor = Math.round(huePercentToZwaveValue(value.hue)) + encapSequence([ + zwave.configurationV2.configurationSet(scaledConfigurationValue: ledColor, parameterNumber: 13, size: 2), + zwave.configurationV2.configurationGet(parameterNumber: 13) + ], 5000) +} + +private huePercentToZwaveValue(value){ + return value<=2?0:(value>=98?255:value/100*255) +} + +private zwaveValueToHuePercent(value){ + return value<=2?0:(value>=254?100:value/255*100) +} + +def childRefresh(deviceNetworkId) { + def id = deviceNetworkId?.split(":")[1] as Integer + sendHubCommand refresh() +} + +def refresh() { + encapSequence([ + zwave.basicV1.basicGet(), + zwave.meterV3.meterGet(scale: 0) + ], 5000) +} + +/* +* Security encapsulation support: +*/ +def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) { + def encapsulatedCommand = cmd.encapsulatedCommand(commandClassVersions) + if (encapsulatedCommand) { + log.debug "Parsed SecurityMessageEncapsulation into: ${encapsulatedCommand}" + zwaveEvent(encapsulatedCommand) + } else { + log.warn "Unable to extract Secure command from $cmd" + } +} + +def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) { + def version = commandClassVersions[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) { + log.debug "Parsed Crc16Encap into: ${encapsulatedCommand}" + zwaveEvent(encapsulatedCommand) + } else { + log.warn "Unable to extract CRC16 command from $cmd" + } +} + +private secEncap(physicalgraph.zwave.Command cmd) { + log.debug "encapsulating command using Secure Encapsulation, command: $cmd" + zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format() +} + +private crcEncap(physicalgraph.zwave.Command cmd) { + log.debug "encapsulating command using CRC16 Encapsulation, command: $cmd" + zwave.crc16EncapV1.crc16Encap().encapsulate(cmd).format() +} + +private encap(cmd, endpoint = null) { + if (cmd) { + if (endpoint) { + cmd = zwave.multiChannelV3.multiChannelCmdEncap(destinationEndPoint: endpoint).encapsulate(cmd) + } + + if (zwaveInfo.zw.endsWith("s")) { + zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format() + } else { + cmd.format() + } + } +} + +private encapSequence(cmds, Integer delay=250) { + delayBetween(cmds.collect{ encap(it) }, delay) +} + +private getParameterMap() {[ + [ + name: "Dimming Speed", key: "dimmingSpeed", type: "range", + parameterNumber: 1, size: 1, defaultValue: 3, + range: "1..100", + description: "How fast or slow the light turns on when you hold the switch (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 - Instant On, 1 = 1 second, 100 = 100 seconds. This parameter can be set without a HUB from the Configuration Button. Finally, if you are using a,dumb switch in a 3-Way setting, this parameter will not work if you manually press the dumb switch (it will only work if you press the smart switch)." + ], + [ + name: "Default Level (Z-Wave)", key: "defaultLevel(Z-Wave)", type: "range", + parameterNumber: 10, size: 1, defaultValue: 0, + range: "1..100", + description: "Default dim level for the switch when powered on via a Z-Wave command. This is useful if you'd like your switch to turn on to a certain level when remotely controlling the switch during certain times. For example, you could have your switch only turn on to 10% brightness during the hours of 10pm - 6am when you remotely control it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name: "Power On State", key: "powerOnState", type: "range", + parameterNumber: 11, size: 1, defaultValue: 0, + range: "0..101", + description: "When power is restored, the switch reverts to either On, Off, or Last Level. Example of how the values work: 0 = Off, 1-100 = Specific % On, 101 = Returns to Level before Power Outage. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name: "Association Behavior", key: "associationBehavior", type: "enum", + parameterNumber: 12, size: 1, defaultValue: 15, + values: [ + 1: "Local", + 2: "3-Way", + 3: "3-Way + Local", + 4: "Z-Wave HUB", + 5: "Z-Wave HUB + Local", + 6: "Z-Wave HUB + 3-Way", + 7: "Z-Wave HUB + Local", + 8: "Timer", + 9: "Timer + Local", + 10: "Timer + 3-Way", + 11: "Timer + Local", + 12: "Timer + Z-Wave HUB", + 13: "Timer + Local", + 14: "Timer + Z-Wave HUB", + 15: "All" + ], + description: "When should the switch send commands to associated devices." + ], + [ + name: "LED Indicator Color", key: "ledIndicatorColor", type: "range", + parameterNumber: 13, size: 2, defaultValue: 170, + range: "0..255", + description: "This will set the default color of the LED Bar. This is calculated by using a hue color circle (Value / 255 * 360). See website for more info. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name: "LED Indicator Intensity", key: "ledIndicatorIntensity", type: "range", + parameterNumber: 14, size: 1, defaultValue: 5, + range: "0..10", + description: "This will set the intensity of the LED bar (ie: how bright it is). Example of how the values work: 0 = Off, 1 = Low, 5 = Medium, 10 = High. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name: "LED Indicator Intensity (When Off)", key: "ledIndicatorIntensity(WhenOff)", type: "range", + parameterNumber: 15, size: 1, defaultValue: 1, + range: "0..10", + description: "This is the intensity of the LED bar when the switch is off. Example of how the values work: 0 = Off, 1 = Low, 5 = Medium, 10 = High. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name: "LED Indicator Timeout", key: "ledIndicatorTimeout", type: "range", + parameterNumber: 17, size: 1, defaultValue: 3, + range: "1..10", + description: "Changes the amount of time the RGB Bar shows the Dim level if the LED Bar has been disabled. Example of how the values work: 0 = Always off, 1 = 1 second after level is adjusted, 10 = 10 seconds after level is adjusted." + ], + [ + name: "Active Power Alerts", key: "activePowerAlerts", type: "boolRange", + parameterNumber: 18, size: 1, defaultValue: 10, + range: "1..100", disableValue: 0, + description: "The power level change that will result in a new power report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." + ], + [ + name: "Periodic Power + Energy Reports", key: "periodicPower+EnergyReports", type: "range", + parameterNumber: 19, size: 2, defaultValue: 3600, + range: "0..32767", + description: "Time period between consecutive power and energy reports being sent (in seconds). Example of how the values work: 0 = 0 seconds, 1 = 1 second, 32767 = 32767 seconds. The timer resets after every report is sent." + ], + [ + name: "Dimming Speed (Z-Wave)", key: "dimmingSpeed(Z-Wave)", type: "range", + parameterNumber: 2, size: 1, defaultValue: 101, + range: "101", + description: "How fast or slow the light turns dim when you adjust the switch remotely (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + ], + [ + name: "Energy Reports", key: "energyReports", type: "boolRange", + parameterNumber: 20, size: 1, defaultValue: 10, + range: "1..100", disableValue: 0, + description: "The energy level change that will result in a new energy report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." + ], + [ + name: "Ramp Rate", key: "rampRate", type: "range", + parameterNumber: 3, size: 1, defaultValue: 101, + range: "101", + description: "How fast or slow the light turns on when you press the switch 1x to bring from On to Off or Off to On. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + ], + [ + name: "Ramp Rate (Z-Wave)", key: "rampRate(Z-Wave)", type: "range", + parameterNumber: 4, size: 1, defaultValue: 101, + range: "101", + description: "How fast or slow the light turns on when you bring your switch from On to Off or Off to On remotely. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + ], + [ + name: "Invert Switch", key: "invertSwitch", type: "boolean", + parameterNumber: 7, size: 1, defaultValue: 0, + optionInactive: 0, inactiveDescription: "Disabled", + optionActive: 1, activeDescription: "Enabled", + description: "Inverts the switch (Tap Down = On, Tap Up = Off). Example of how the values work: 0 = Disabled, 1 = Enabled. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name: "Auto Off Timer", key: "autoOffTimer", type: "boolRange", + parameterNumber: 8, size: 2, defaultValue: 0, + range: "1..32767", disableValue: 0, + description: "Automatically turns the switch off after x amount of seconds. Example of how the values work: 0 = Disabled, 1 = 1 second, 32767 = 32767 seconds." + ], + [ + name: "Default Level (Local)", key: "defaultLevel(Local)", type: "range", + parameterNumber: 9, size: 1, defaultValue: 0, + range: "1..100", + description: "Default dim level for the switch when pressed locally (at the switch). This is useful if you'd like your switch to turn on to a certain level when manually pressing the switch during certain times. For example, you could have your switch turn on to 10% brightness during the hours of 10pm - 6am when you manually press it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." + ] +]} From f0222a693ef1a89b1996742d16bbc47e69c7d31b Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Wed, 15 Jul 2020 18:19:24 +0200 Subject: [PATCH 03/12] removed old reference to Inovelli Dimmer --- .../zwave-metering-dimmer.src/zwave-metering-dimmer.groovy | 1 - 1 file changed, 1 deletion(-) 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 430838072b5..e0249894266 100644 --- a/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy +++ b/devicetypes/smartthings/zwave-metering-dimmer.src/zwave-metering-dimmer.groovy @@ -40,7 +40,6 @@ metadata { fingerprint mfr:"0086", prod:"0203", model:"006F", deviceJoinName: "Aeotec Dimmer Switch" //AU //Aeotec Nano Dimmer fingerprint mfr:"014F", prod:"5044", model:"3533", deviceJoinName: "GoControl Dimmer Switch" //GoControl Plug-in Dimmer fingerprint mfr:"0159", prod:"0001", model:"0055", deviceJoinName: "Qubino Dimmer Switch" //Qubino Mini Dimmer ZMNHHD1 - fingerprint mfr:"031E", prod:"0001", model:"0001", deviceJoinName: "Inovelli Dimmer Switch" //Inovelli Dimmer LZW31-SN } simulator { From 3e78716d8d9aed28f1b53fb8b4819c61c27b0821 Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Fri, 17 Jul 2020 16:34:08 +0200 Subject: [PATCH 04/12] Changed child dth name, fixed formatting, removed unnecessary capabilities, fixed child dni --- .../child-color-control.groovy} | 7 +- .../inovelli-dimmer.groovy | 334 +++++++++--------- 2 files changed, 172 insertions(+), 169 deletions(-) rename devicetypes/smartthings/{child-color-selection.src/child-color-selection.groovy => child-color-control.src/child-color-control.groovy} (80%) diff --git a/devicetypes/smartthings/child-color-selection.src/child-color-selection.groovy b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy similarity index 80% rename from devicetypes/smartthings/child-color-selection.src/child-color-selection.groovy rename to devicetypes/smartthings/child-color-control.src/child-color-control.groovy index b08fcbc579e..644f893027c 100644 --- a/devicetypes/smartthings/child-color-selection.src/child-color-selection.groovy +++ b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy @@ -15,9 +15,8 @@ * */ metadata { - definition(name: "Child Color Selection", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", runLocally: false, executeCommandsLocally: false,) { + definition(name: "Child Color Control", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings") { capability "Color Control" - capability "Refresh" capability "Actuator" } @@ -28,8 +27,8 @@ metadata { } } - main(["switch"]) - details(["rgbSelector", "refresh"]) + main([]) + details(["rgbSelector"]) } } diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index 20c189a6950..b24839b46fd 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -15,7 +15,7 @@ * */ metadata { - definition (name: "Inovelli Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch", runLocally: false, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, genericHandler: "Z-Wave", mcdSync: true) { + definition(name: "Inovelli Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch", minHubCoreVersion: '000.017.0012', mcdSync: true) { capability "Actuator" capability "Configuration" capability "Energy Meter" @@ -26,46 +26,46 @@ metadata { capability "Switch Level" capability "Power Meter" - fingerprint mfr:"031E", prod:"0001", model:"0001", deviceJoinName: "Inovelli Dimmer Switch", vid: "SmartThings-smartthings-Inovelli_Dimmer"//Inovelli Dimmer LZW31-SN + fingerprint mfr: "031E", prod: "0001", model: "0001", deviceJoinName: "Inovelli Dimmer Switch" , vid: "SmartThings-smartthings-Inovelli_Dimmer"//Inovelli Dimmer LZW31-SN } tiles(scale: 2) { - multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){ - tileAttribute ("device.switch", key: "PRIMARY_CONTROL") { - attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff" - attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn" - attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff" - attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn" + multiAttributeTile(name: "switch", type: "lighting", width: 6, height: 4, canChangeIcon: true) { + tileAttribute("device.switch", key: "PRIMARY_CONTROL") { + attributeState "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00a0dc", nextState: "turningOff" + attributeState "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn" + attributeState "turningOn", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00a0dc", nextState: "turningOff" + attributeState "turningOff", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn" } - tileAttribute ("device.level", key: "SLIDER_CONTROL") { - attributeState "level", action:"switch level.setLevel" + tileAttribute("device.level", key: "SLIDER_CONTROL") { + attributeState "level", action: "switch level.setLevel" } } valueTile("power", "device.power", width: 2, height: 2) { - state "default", label:'${currentValue} W' + state "default", label: '${currentValue} W' } valueTile("energy", "device.energy", width: 2, height: 2) { - state "default", label:'${currentValue} kWh' + state "default", label: '${currentValue} kWh' } standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) { - state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh" + state "default", label: "", action: "refresh.refresh", icon: "st.secondary.refresh" } } - main(["switch","power","energy"]) + main(["switch", "power", "energy"]) details(["switch", "power", "energy", "refresh"]) preferences { // Preferences template begin parameterMap.each { - input ( + input( title: it.name, description: it.description, type: "paragraph", element: "paragraph" ) - switch(it.type) { + switch (it.type) { case "boolRange": input( name: it.key + "Boolean", @@ -142,7 +142,7 @@ def installed() { } readConfigurationFromTheDevice(); // Preferences template end - createChildDevice("smartthings", "Child Color Selection", "${device.deviceNetworkId}:" + 3, "LEDColorConfiguration", "LEDColorConfiguration") + createChildDevice("smartthings", "Child Color Control", "${device.deviceNetworkId}:3", "LEDColorConfiguration", "LEDColorConfiguration") } def updated() { @@ -187,7 +187,7 @@ private readConfigurationFromTheDevice() { private syncConfiguration() { def commands = [] - log.debug"syncConfiguration ${settings}" + log.debug "syncConfiguration ${settings}" parameterMap.each { if (state.currentPreferencesState."$it.key".status == "syncPending") { commands += encap(zwave.configurationV2.configurationSet(scaledConfigurationValue: getCommandValue(it), parameterNumber: it.parameterNumber, size: it.size)) @@ -203,12 +203,12 @@ private syncConfiguration() { def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport cmd) { // Preferences template begin log.debug "Configuration report: ${cmd}" - def preference = parameterMap.find( {it.parameterNumber == cmd.parameterNumber} ) + def preference = parameterMap.find({ it.parameterNumber == cmd.parameterNumber }) def key = preference.key def preferenceValue = getPreferenceValue(preference, cmd.scaledConfigurationValue) - log.debug"settings.key ${settings."$key"} preferenceValue ${preferenceValue}" + log.debug "settings.key ${settings."$key"} preferenceValue ${preferenceValue}" - if(state.currentPreferencesState."$key".status == "reverseSyncPending"){ + if (state.currentPreferencesState."$key".status == "reverseSyncPending") { log.debug "reverseSyncPending" state.currentPreferencesState."$key".value = preferenceValue state.currentPreferencesState."$key".status = "synced" @@ -216,11 +216,11 @@ def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport if (preferenceValue instanceof String && settings."$key" == preferenceValue.toBoolean()) { state.currentPreferencesState."$key".value = settings."$key" state.currentPreferencesState."$key".status = "synced" - } else if(preferenceValue instanceof Integer && settings."$key" == preferenceValue){ + } else if (preferenceValue instanceof Integer && settings."$key" == preferenceValue) { state.currentPreferencesState."$key".value = settings."$key" state.currentPreferencesState."$key".status = "synced" } else if (preference.type == "boolRange") { - log.debug"${state.currentPreferencesState."$key".status}" + log.debug "${state.currentPreferencesState."$key".status}" if (state.currentPreferencesState."$key".status == "disablePending" && preferenceValue == preference.disableValue) { state.currentPreferencesState."$key".status = "disabled" } else { @@ -228,7 +228,7 @@ def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport } } else { state.currentPreferencesState."$key"?.status = "syncPending" - if(cmd.parameterNumber == 13){ + if (cmd.parameterNumber == 13) { state.currentPreferencesState."$key".value = preferenceValue state.currentPreferencesState."$key".status = "synced" handleLEDPreferenceEvent(cmd) @@ -253,7 +253,7 @@ private getPreferenceValue(preference, value = "default") { private getCommandValue(preference) { def parameterKey = preference.key - log.debug"settings parameter key ${settings."$parameterKey"} ${preference} " + log.debug "settings parameter key ${settings."$parameterKey"} ${preference} " switch (preference.type) { case "boolean": return settings."$parameterKey" ? preference.optionActive : preference.optionInactive @@ -303,26 +303,27 @@ def parse(String description) { result } -def handleLEDPreferenceEvent(cmd){ +def handleLEDPreferenceEvent(cmd) { def hueState = [name: "hue", value: "${Math.round(zwaveValueToHuePercent(cmd.scaledConfigurationValue))}"] - def childDni = "${device.deviceNetworkId}:" + 3 + def childDni = "${device.deviceNetworkId}:3" def childDevice = childDevices.find { it.deviceNetworkId == childDni } childDevice?.sendEvent(hueState) - childDevice?.sendEvent(name:"saturation", value:"100") + childDevice?.sendEvent(name: "saturation", value: "100") } def createChildDevice(childDthNamespace, childDthName, childDni, childComponentLabel, childComponentName) { try { log.debug "Creating a child device: ${childDthNamespace}, ${childDthName}, ${childDni}, ${childComponentLabel}, ${childComponentName}" def childDevice = addChildDevice(childDthNamespace, childDthName, childDni, device.hub.id, - [ completedSetup: true, - label: childComponentLabel, - isComponent: true, - componentName : childComponentName, - componentLabel: childComponentLabel + [ + completedSetup: true, + label : childComponentLabel, + isComponent : true, + componentName : childComponentName, + componentLabel: childComponentLabel ]) childDevice - } catch(Exception e) { + } catch (Exception e) { log.debug "Exception: ${e}" } } @@ -337,11 +338,11 @@ def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv3.SwitchMultilevelR def dimmerEvents(physicalgraph.zwave.Command cmd) { log.debug "dimmer events ${cmd}" - def map = [name : "switch", value : cmd.value ? "on" : "off", descriptionText : "$device.displayName was turned $cmd.value"] + def map = [name: "switch", value: cmd.value ? "on" : "off", descriptionText: "$device.displayName was turned $cmd.value"] def switchEvent = createEvent(map) def result = [switchEvent] if (cmd.value) { - map = [name: "level", value: cmd.value == 99 ? 100 : cmd.value , unit: "%"] + map = [name: "level", value: cmd.value == 99 ? 100 : cmd.value, unit: "%"] result << createEvent(map) } if (switchEvent.isStateChange) { @@ -364,9 +365,9 @@ def off() { ], 5000) } -def setLevel(level){ - log.debug"setLevel" - if(level > 99) level = 99 +def setLevel(level) { + log.debug "setLevel" + if (level > 99) level = 99 encapSequence([ zwave.basicV1.basicSet(value: level), zwave.switchMultilevelV1.switchMultilevelGet() @@ -375,9 +376,9 @@ def setLevel(level){ def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) { def map = [:] - if (cmd.meterType == 1 && cmd.scale == 0){ + if (cmd.meterType == 1 && cmd.scale == 0) { map = [name: "energy", value: cmd.scaledMeterValue, unit: "kWh"] - } else if(cmd.meterType == 1 && cmd.scale == 2){ + } else if (cmd.meterType == 1 && cmd.scale == 2) { map = [name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W"] } createEvent(map) @@ -403,12 +404,12 @@ def setColorCmd(value, id) { ], 5000) } -private huePercentToZwaveValue(value){ - return value<=2?0:(value>=98?255:value/100*255) +private huePercentToZwaveValue(value) { + return value <= 2 ? 0 : (value >= 98 ? 255 : value / 100 * 255) } -private zwaveValueToHuePercent(value){ - return value<=2?0:(value>=254?100:value/255*100) +private zwaveValueToHuePercent(value) { + return value <= 2 ? 0 : (value >= 254 ? 100 : value / 255 * 100) } def childRefresh(deviceNetworkId) { @@ -426,6 +427,7 @@ def refresh() { /* * Security encapsulation support: */ + def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) { def encapsulatedCommand = cmd.encapsulatedCommand(commandClassVersions) if (encapsulatedCommand) { @@ -472,128 +474,130 @@ private encap(cmd, endpoint = null) { } } -private encapSequence(cmds, Integer delay=250) { - delayBetween(cmds.collect{ encap(it) }, delay) +private encapSequence(cmds, Integer delay = 250) { + delayBetween(cmds.collect { encap(it) }, delay) } -private getParameterMap() {[ - [ - name: "Dimming Speed", key: "dimmingSpeed", type: "range", - parameterNumber: 1, size: 1, defaultValue: 3, - range: "1..100", - description: "How fast or slow the light turns on when you hold the switch (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 - Instant On, 1 = 1 second, 100 = 100 seconds. This parameter can be set without a HUB from the Configuration Button. Finally, if you are using a,dumb switch in a 3-Way setting, this parameter will not work if you manually press the dumb switch (it will only work if you press the smart switch)." - ], - [ - name: "Default Level (Z-Wave)", key: "defaultLevel(Z-Wave)", type: "range", - parameterNumber: 10, size: 1, defaultValue: 0, - range: "1..100", - description: "Default dim level for the switch when powered on via a Z-Wave command. This is useful if you'd like your switch to turn on to a certain level when remotely controlling the switch during certain times. For example, you could have your switch only turn on to 10% brightness during the hours of 10pm - 6am when you remotely control it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." - ], +private getParameterMap() { [ - name: "Power On State", key: "powerOnState", type: "range", - parameterNumber: 11, size: 1, defaultValue: 0, - range: "0..101", - description: "When power is restored, the switch reverts to either On, Off, or Last Level. Example of how the values work: 0 = Off, 1-100 = Specific % On, 101 = Returns to Level before Power Outage. This parameter can be set without a HUB from the Configuration Button." - ], - [ - name: "Association Behavior", key: "associationBehavior", type: "enum", - parameterNumber: 12, size: 1, defaultValue: 15, - values: [ - 1: "Local", - 2: "3-Way", - 3: "3-Way + Local", - 4: "Z-Wave HUB", - 5: "Z-Wave HUB + Local", - 6: "Z-Wave HUB + 3-Way", - 7: "Z-Wave HUB + Local", - 8: "Timer", - 9: "Timer + Local", - 10: "Timer + 3-Way", - 11: "Timer + Local", - 12: "Timer + Z-Wave HUB", - 13: "Timer + Local", - 14: "Timer + Z-Wave HUB", - 15: "All" + [ + name : "Dimming Speed", key: "dimmingSpeed", type: "range", + parameterNumber: 1, size: 1, defaultValue: 3, + range : "1..100", + description : "How fast or slow the light turns on when you hold the switch (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 - Instant On, 1 = 1 second, 100 = 100 seconds. This parameter can be set without a HUB from the Configuration Button. Finally, if you are using a,dumb switch in a 3-Way setting, this parameter will not work if you manually press the dumb switch (it will only work if you press the smart switch)." ], - description: "When should the switch send commands to associated devices." - ], - [ - name: "LED Indicator Color", key: "ledIndicatorColor", type: "range", - parameterNumber: 13, size: 2, defaultValue: 170, - range: "0..255", - description: "This will set the default color of the LED Bar. This is calculated by using a hue color circle (Value / 255 * 360). See website for more info. This parameter can be set without a HUB from the Configuration Button." - ], - [ - name: "LED Indicator Intensity", key: "ledIndicatorIntensity", type: "range", - parameterNumber: 14, size: 1, defaultValue: 5, - range: "0..10", - description: "This will set the intensity of the LED bar (ie: how bright it is). Example of how the values work: 0 = Off, 1 = Low, 5 = Medium, 10 = High. This parameter can be set without a HUB from the Configuration Button." - ], - [ - name: "LED Indicator Intensity (When Off)", key: "ledIndicatorIntensity(WhenOff)", type: "range", - parameterNumber: 15, size: 1, defaultValue: 1, - range: "0..10", - description: "This is the intensity of the LED bar when the switch is off. Example of how the values work: 0 = Off, 1 = Low, 5 = Medium, 10 = High. This parameter can be set without a HUB from the Configuration Button." - ], - [ - name: "LED Indicator Timeout", key: "ledIndicatorTimeout", type: "range", - parameterNumber: 17, size: 1, defaultValue: 3, - range: "1..10", - description: "Changes the amount of time the RGB Bar shows the Dim level if the LED Bar has been disabled. Example of how the values work: 0 = Always off, 1 = 1 second after level is adjusted, 10 = 10 seconds after level is adjusted." - ], - [ - name: "Active Power Alerts", key: "activePowerAlerts", type: "boolRange", - parameterNumber: 18, size: 1, defaultValue: 10, - range: "1..100", disableValue: 0, - description: "The power level change that will result in a new power report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." - ], - [ - name: "Periodic Power + Energy Reports", key: "periodicPower+EnergyReports", type: "range", - parameterNumber: 19, size: 2, defaultValue: 3600, - range: "0..32767", - description: "Time period between consecutive power and energy reports being sent (in seconds). Example of how the values work: 0 = 0 seconds, 1 = 1 second, 32767 = 32767 seconds. The timer resets after every report is sent." - ], - [ - name: "Dimming Speed (Z-Wave)", key: "dimmingSpeed(Z-Wave)", type: "range", - parameterNumber: 2, size: 1, defaultValue: 101, - range: "101", - description: "How fast or slow the light turns dim when you adjust the switch remotely (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." - ], - [ - name: "Energy Reports", key: "energyReports", type: "boolRange", - parameterNumber: 20, size: 1, defaultValue: 10, - range: "1..100", disableValue: 0, - description: "The energy level change that will result in a new energy report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." - ], - [ - name: "Ramp Rate", key: "rampRate", type: "range", - parameterNumber: 3, size: 1, defaultValue: 101, - range: "101", - description: "How fast or slow the light turns on when you press the switch 1x to bring from On to Off or Off to On. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." - ], - [ - name: "Ramp Rate (Z-Wave)", key: "rampRate(Z-Wave)", type: "range", - parameterNumber: 4, size: 1, defaultValue: 101, - range: "101", - description: "How fast or slow the light turns on when you bring your switch from On to Off or Off to On remotely. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." - ], - [ - name: "Invert Switch", key: "invertSwitch", type: "boolean", - parameterNumber: 7, size: 1, defaultValue: 0, - optionInactive: 0, inactiveDescription: "Disabled", - optionActive: 1, activeDescription: "Enabled", - description: "Inverts the switch (Tap Down = On, Tap Up = Off). Example of how the values work: 0 = Disabled, 1 = Enabled. This parameter can be set without a HUB from the Configuration Button." - ], - [ - name: "Auto Off Timer", key: "autoOffTimer", type: "boolRange", - parameterNumber: 8, size: 2, defaultValue: 0, - range: "1..32767", disableValue: 0, - description: "Automatically turns the switch off after x amount of seconds. Example of how the values work: 0 = Disabled, 1 = 1 second, 32767 = 32767 seconds." - ], - [ - name: "Default Level (Local)", key: "defaultLevel(Local)", type: "range", - parameterNumber: 9, size: 1, defaultValue: 0, - range: "1..100", - description: "Default dim level for the switch when pressed locally (at the switch). This is useful if you'd like your switch to turn on to a certain level when manually pressing the switch during certain times. For example, you could have your switch turn on to 10% brightness during the hours of 10pm - 6am when you manually press it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." + [ + name : "Default Level (Z-Wave)", key: "defaultLevel(Z-Wave)", type: "range", + parameterNumber: 10, size: 1, defaultValue: 0, + range : "1..100", + description : "Default dim level for the switch when powered on via a Z-Wave command. This is useful if you'd like your switch to turn on to a certain level when remotely controlling the switch during certain times. For example, you could have your switch only turn on to 10% brightness during the hours of 10pm - 6am when you remotely control it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name : "Power On State", key: "powerOnState", type: "range", + parameterNumber: 11, size: 1, defaultValue: 0, + range : "0..101", + description : "When power is restored, the switch reverts to either On, Off, or Last Level. Example of how the values work: 0 = Off, 1-100 = Specific % On, 101 = Returns to Level before Power Outage. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name : "Association Behavior", key: "associationBehavior", type: "enum", + parameterNumber: 12, size: 1, defaultValue: 15, + values : [ + 1 : "Local", + 2 : "3-Way", + 3 : "3-Way + Local", + 4 : "Z-Wave HUB", + 5 : "Z-Wave HUB + Local", + 6 : "Z-Wave HUB + 3-Way", + 7 : "Z-Wave HUB + Local", + 8 : "Timer", + 9 : "Timer + Local", + 10: "Timer + 3-Way", + 11: "Timer + Local", + 12: "Timer + Z-Wave HUB", + 13: "Timer + Local", + 14: "Timer + Z-Wave HUB", + 15: "All" + ], + description : "When should the switch send commands to associated devices." + ], + [ + name : "LED Indicator Color", key: "ledIndicatorColor", type: "range", + parameterNumber: 13, size: 2, defaultValue: 170, + range : "0..255", + description : "This will set the default color of the LED Bar. This is calculated by using a hue color circle (Value / 255 * 360). See website for more info. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name : "LED Indicator Intensity", key: "ledIndicatorIntensity", type: "range", + parameterNumber: 14, size: 1, defaultValue: 5, + range : "0..10", + description : "This will set the intensity of the LED bar (ie: how bright it is). Example of how the values work: 0 = Off, 1 = Low, 5 = Medium, 10 = High. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name : "LED Indicator Intensity (When Off)", key: "ledIndicatorIntensity(WhenOff)", type: "range", + parameterNumber: 15, size: 1, defaultValue: 1, + range : "0..10", + description : "This is the intensity of the LED bar when the switch is off. Example of how the values work: 0 = Off, 1 = Low, 5 = Medium, 10 = High. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name : "LED Indicator Timeout", key: "ledIndicatorTimeout", type: "range", + parameterNumber: 17, size: 1, defaultValue: 3, + range : "1..10", + description : "Changes the amount of time the RGB Bar shows the Dim level if the LED Bar has been disabled. Example of how the values work: 0 = Always off, 1 = 1 second after level is adjusted, 10 = 10 seconds after level is adjusted." + ], + [ + name : "Active Power Alerts", key: "activePowerAlerts", type: "boolRange", + parameterNumber: 18, size: 1, defaultValue: 10, + range : "1..100", disableValue: 0, + description : "The power level change that will result in a new power report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." + ], + [ + name : "Periodic Power + Energy Reports", key: "periodicPower+EnergyReports", type: "range", + parameterNumber: 19, size: 2, defaultValue: 3600, + range : "0..32767", + description : "Time period between consecutive power and energy reports being sent (in seconds). Example of how the values work: 0 = 0 seconds, 1 = 1 second, 32767 = 32767 seconds. The timer resets after every report is sent." + ], + [ + name : "Dimming Speed (Z-Wave)", key: "dimmingSpeed(Z-Wave)", type: "range", + parameterNumber: 2, size: 1, defaultValue: 101, + range : "101", + description : "How fast or slow the light turns dim when you adjust the switch remotely (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + ], + [ + name : "Energy Reports", key: "energyReports", type: "boolRange", + parameterNumber: 20, size: 1, defaultValue: 10, + range : "1..100", disableValue: 0, + description : "The energy level change that will result in a new energy report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." + ], + [ + name : "Ramp Rate", key: "rampRate", type: "range", + parameterNumber: 3, size: 1, defaultValue: 101, + range : "101", + description : "How fast or slow the light turns on when you press the switch 1x to bring from On to Off or Off to On. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + ], + [ + name : "Ramp Rate (Z-Wave)", key: "rampRate(Z-Wave)", type: "range", + parameterNumber: 4, size: 1, defaultValue: 101, + range : "101", + description : "How fast or slow the light turns on when you bring your switch from On to Off or Off to On remotely. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + ], + [ + name : "Invert Switch", key: "invertSwitch", type: "boolean", + parameterNumber: 7, size: 1, defaultValue: 0, + optionInactive : 0, inactiveDescription: "Disabled", + optionActive : 1, activeDescription: "Enabled", + description : "Inverts the switch (Tap Down = On, Tap Up = Off). Example of how the values work: 0 = Disabled, 1 = Enabled. This parameter can be set without a HUB from the Configuration Button." + ], + [ + name : "Auto Off Timer", key: "autoOffTimer", type: "boolRange", + parameterNumber: 8, size: 2, defaultValue: 0, + range : "1..32767", disableValue: 0, + description : "Automatically turns the switch off after x amount of seconds. Example of how the values work: 0 = Disabled, 1 = 1 second, 32767 = 32767 seconds." + ], + [ + name : "Default Level (Local)", key: "defaultLevel(Local)", type: "range", + parameterNumber: 9, size: 1, defaultValue: 0, + range : "1..100", + description : "Default dim level for the switch when pressed locally (at the switch). This is useful if you'd like your switch to turn on to a certain level when manually pressing the switch during certain times. For example, you could have your switch turn on to 10% brightness during the hours of 10pm - 6am when you manually press it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." + ] ] -]} +} From 5e949b12067ae3b0c8d8f48ca880ec2f53742386 Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Thu, 23 Jul 2020 17:59:22 +0200 Subject: [PATCH 05/12] Added configure method, fixed parameters range, fixed formatting --- .../inovelli-dimmer.groovy | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index b24839b46fd..21319a85ca4 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -140,9 +140,12 @@ def installed() { state.currentPreferencesState."$it.key".status = "synced" } } - readConfigurationFromTheDevice(); // Preferences template end - createChildDevice("smartthings", "Child Color Control", "${device.deviceNetworkId}:3", "LEDColorConfiguration", "LEDColorConfiguration") + createChildDevice("smartthings", "Child Color Control", "${device.deviceNetworkId}:1", "LED Bar", "LEDColorConfiguration") +} + +def configure() { + sendHubCommand(getReadConfigurationFromTheDeviceCommands()) } def updated() { @@ -176,13 +179,13 @@ def updated() { response(refresh()) } -private readConfigurationFromTheDevice() { +private getReadConfigurationFromTheDeviceCommands() { def commands = [] parameterMap.each { state.currentPreferencesState."$it.key".status = "reverseSyncPending" commands += encap(zwave.configurationV2.configurationGet(parameterNumber: it.parameterNumber)) } - sendHubCommand(commands) + commands } private syncConfiguration() { @@ -305,7 +308,7 @@ def parse(String description) { def handleLEDPreferenceEvent(cmd) { def hueState = [name: "hue", value: "${Math.round(zwaveValueToHuePercent(cmd.scaledConfigurationValue))}"] - def childDni = "${device.deviceNetworkId}:3" + def childDni = "${device.deviceNetworkId}:1" def childDevice = childDevices.find { it.deviceNetworkId == childDni } childDevice?.sendEvent(hueState) childDevice?.sendEvent(name: "saturation", value: "100") @@ -489,7 +492,7 @@ private getParameterMap() { [ name : "Default Level (Z-Wave)", key: "defaultLevel(Z-Wave)", type: "range", parameterNumber: 10, size: 1, defaultValue: 0, - range : "1..100", + range : "0..100", description : "Default dim level for the switch when powered on via a Z-Wave command. This is useful if you'd like your switch to turn on to a certain level when remotely controlling the switch during certain times. For example, you could have your switch only turn on to 10% brightness during the hours of 10pm - 6am when you remotely control it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." ], [ @@ -541,7 +544,7 @@ private getParameterMap() { [ name : "LED Indicator Timeout", key: "ledIndicatorTimeout", type: "range", parameterNumber: 17, size: 1, defaultValue: 3, - range : "1..10", + range : "0..10", description : "Changes the amount of time the RGB Bar shows the Dim level if the LED Bar has been disabled. Example of how the values work: 0 = Always off, 1 = 1 second after level is adjusted, 10 = 10 seconds after level is adjusted." ], [ @@ -559,7 +562,7 @@ private getParameterMap() { [ name : "Dimming Speed (Z-Wave)", key: "dimmingSpeed(Z-Wave)", type: "range", parameterNumber: 2, size: 1, defaultValue: 101, - range : "101", + range : "0..101", description : "How fast or slow the light turns dim when you adjust the switch remotely (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." ], [ @@ -571,13 +574,13 @@ private getParameterMap() { [ name : "Ramp Rate", key: "rampRate", type: "range", parameterNumber: 3, size: 1, defaultValue: 101, - range : "101", + range : "0..101", description : "How fast or slow the light turns on when you press the switch 1x to bring from On to Off or Off to On. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." ], [ name : "Ramp Rate (Z-Wave)", key: "rampRate(Z-Wave)", type: "range", parameterNumber: 4, size: 1, defaultValue: 101, - range : "101", + range : "0..101", description : "How fast or slow the light turns on when you bring your switch from On to Off or Off to On remotely. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." ], [ From f9e7e3f9c621cba84b5db319d4c9474da84329f0 Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Fri, 24 Jul 2020 18:37:15 +0200 Subject: [PATCH 06/12] Removed unecessary parameters --- .../child-color-control.groovy | 3 +- .../inovelli-dimmer.groovy | 118 +++--------------- 2 files changed, 21 insertions(+), 100 deletions(-) diff --git a/devicetypes/smartthings/child-color-control.src/child-color-control.groovy b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy index 644f893027c..9222c714a59 100644 --- a/devicetypes/smartthings/child-color-control.src/child-color-control.groovy +++ b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy @@ -28,9 +28,8 @@ metadata { } main([]) - details(["rgbSelector"]) + details([]) } - } def setColor(value) { diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index 21319a85ca4..d5a2ce25d3f 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -58,65 +58,39 @@ metadata { preferences { // Preferences template begin parameterMap.each { - input( - title: it.name, - description: it.description, - type: "paragraph", - element: "paragraph" - ) + input(title: it.name, description: it.description, type: "paragraph", element: "paragraph") switch (it.type) { case "boolRange": input( - name: it.key + "Boolean", - type: "bool", - title: "Enable", - description: "If you disable this option, it will overwrite setting below.", - defaultValue: it.defaultValue != it.disableValue, - required: false + name: it.key + "Boolean", type: "bool", title: "Enable", description: "If you disable this option, it will overwrite setting below.", + defaultValue: it.defaultValue != it.disableValue, required: false ) input( - name: it.key, - type: "number", - title: "Set value (range ${it.range})", - defaultValue: it.defaultValue, - range: it.range, - required: false + name: it.key, type: "number", title: "Set value (range ${it.range})", + defaultValue: it.defaultValue, range: it.range, required: false ) break case "boolean": input( - type: "paragraph", - element: "paragraph", - description: "Option enabled: ${it.activeDescription}\n" + - "Option disabled: ${it.inactiveDescription}" + type: "paragraph", element: "paragraph", + description: "Option enabled: ${it.activeDescription}\n" + "Option disabled: ${it.inactiveDescription}" ) input( - name: it.key, - type: "bool", - title: "Enable", - defaultValue: it.defaultValue == it.activeOption, - required: false + name: it.key, type: "bool", title: "Enable", + defaultValue: it.defaultValue == it.activeOption, required: false ) break case "enum": input( - name: it.key, - title: "Select", - type: "enum", - options: it.values, - defaultValue: it.defaultValue, - required: false + name: it.key, title: "Select", type: "enum", + options: it.values, defaultValue: it.defaultValue, required: false ) break case "range": input( - name: it.key, - type: "number", - title: "Set value (range ${it.range})", - defaultValue: it.defaultValue, - range: it.range, - required: false + name: it.key, type: "number", title: "Set value (range ${it.range})", + defaultValue: it.defaultValue, range: it.range, required: false ) break } @@ -487,13 +461,7 @@ private getParameterMap() { name : "Dimming Speed", key: "dimmingSpeed", type: "range", parameterNumber: 1, size: 1, defaultValue: 3, range : "1..100", - description : "How fast or slow the light turns on when you hold the switch (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 - Instant On, 1 = 1 second, 100 = 100 seconds. This parameter can be set without a HUB from the Configuration Button. Finally, if you are using a,dumb switch in a 3-Way setting, this parameter will not work if you manually press the dumb switch (it will only work if you press the smart switch)." - ], - [ - name : "Default Level (Z-Wave)", key: "defaultLevel(Z-Wave)", type: "range", - parameterNumber: 10, size: 1, defaultValue: 0, - range : "0..100", - description : "Default dim level for the switch when powered on via a Z-Wave command. This is useful if you'd like your switch to turn on to a certain level when remotely controlling the switch during certain times. For example, you could have your switch only turn on to 10% brightness during the hours of 10pm - 6am when you remotely control it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." + description : "How fast or slow the light turns on when you hold the switch in seconds (ie: dimming from 10-20%, 80-60%, etc). Value 0 - Instant On. This parameter can be set without a HUB from the Configuration Button. Finally, if you are using a,dumb switch in a 3-Way setting, this parameter will not work if you manually press the dumb switch (it will only work if you press the smart switch)." ], [ name : "Power On State", key: "powerOnState", type: "range", @@ -501,28 +469,6 @@ private getParameterMap() { range : "0..101", description : "When power is restored, the switch reverts to either On, Off, or Last Level. Example of how the values work: 0 = Off, 1-100 = Specific % On, 101 = Returns to Level before Power Outage. This parameter can be set without a HUB from the Configuration Button." ], - [ - name : "Association Behavior", key: "associationBehavior", type: "enum", - parameterNumber: 12, size: 1, defaultValue: 15, - values : [ - 1 : "Local", - 2 : "3-Way", - 3 : "3-Way + Local", - 4 : "Z-Wave HUB", - 5 : "Z-Wave HUB + Local", - 6 : "Z-Wave HUB + 3-Way", - 7 : "Z-Wave HUB + Local", - 8 : "Timer", - 9 : "Timer + Local", - 10: "Timer + 3-Way", - 11: "Timer + Local", - 12: "Timer + Z-Wave HUB", - 13: "Timer + Local", - 14: "Timer + Z-Wave HUB", - 15: "All" - ], - description : "When should the switch send commands to associated devices." - ], [ name : "LED Indicator Color", key: "ledIndicatorColor", type: "range", parameterNumber: 13, size: 2, defaultValue: 170, @@ -545,62 +491,38 @@ private getParameterMap() { name : "LED Indicator Timeout", key: "ledIndicatorTimeout", type: "range", parameterNumber: 17, size: 1, defaultValue: 3, range : "0..10", - description : "Changes the amount of time the RGB Bar shows the Dim level if the LED Bar has been disabled. Example of how the values work: 0 = Always off, 1 = 1 second after level is adjusted, 10 = 10 seconds after level is adjusted." - ], - [ - name : "Active Power Alerts", key: "activePowerAlerts", type: "boolRange", - parameterNumber: 18, size: 1, defaultValue: 10, - range : "1..100", disableValue: 0, - description : "The power level change that will result in a new power report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." - ], - [ - name : "Periodic Power + Energy Reports", key: "periodicPower+EnergyReports", type: "range", - parameterNumber: 19, size: 2, defaultValue: 3600, - range : "0..32767", - description : "Time period between consecutive power and energy reports being sent (in seconds). Example of how the values work: 0 = 0 seconds, 1 = 1 second, 32767 = 32767 seconds. The timer resets after every report is sent." + description : "Changes the amount of time the RGB Bar shows the Dim level if the LED Bar has been disabled. Example of how the values work: 0 = Always off, 1 = 1 second after level is adjusted." ], [ name : "Dimming Speed (Z-Wave)", key: "dimmingSpeed(Z-Wave)", type: "range", parameterNumber: 2, size: 1, defaultValue: 101, range : "0..101", - description : "How fast or slow the light turns dim when you adjust the switch remotely (ie: dimming from 10-20%, 80-60%, etc). Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." - ], - [ - name : "Energy Reports", key: "energyReports", type: "boolRange", - parameterNumber: 20, size: 1, defaultValue: 10, - range : "1..100", disableValue: 0, - description : "The energy level change that will result in a new energy report being sent (% of previous report). Example of how the values work: 0 = Disabled, 10 = 10% of previous report, 100 = 100% of previous report." + description : "How fast or slow the light turns dim when you adjust the switch remotely (ie: dimming from 10-20%, 80-60%, etc). Entering the value of 101 = Keeps the switch in sync with Parameter 1." ], [ name : "Ramp Rate", key: "rampRate", type: "range", parameterNumber: 3, size: 1, defaultValue: 101, range : "0..101", - description : "How fast or slow the light turns on when you press the switch 1x to bring from On to Off or Off to On. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + description : "How fast or slow the light turns on when you press the switch 1x to bring from On to Off or Off to On. Entering the value of 101 = Keeps the switch in sync with Parameter 1." ], [ name : "Ramp Rate (Z-Wave)", key: "rampRate(Z-Wave)", type: "range", parameterNumber: 4, size: 1, defaultValue: 101, range : "0..101", - description : "How fast or slow the light turns on when you bring your switch from On to Off or Off to On remotely. Example of how the values work: 0 = Instant On, 1 = 1 second, 100 = 100 seconds. Entering the value of 101 = Keeps the switch in sync with Parameter 1." + description : "How fast or slow the light turns on when you bring your switch from On to Off or Off to On remotely. Entering the value of 101 = Keeps the switch in sync with Parameter 1." ], [ name : "Invert Switch", key: "invertSwitch", type: "boolean", parameterNumber: 7, size: 1, defaultValue: 0, optionInactive : 0, inactiveDescription: "Disabled", optionActive : 1, activeDescription: "Enabled", - description : "Inverts the switch (Tap Down = On, Tap Up = Off). Example of how the values work: 0 = Disabled, 1 = Enabled. This parameter can be set without a HUB from the Configuration Button." + description : "Inverts the switch" ], [ name : "Auto Off Timer", key: "autoOffTimer", type: "boolRange", parameterNumber: 8, size: 2, defaultValue: 0, range : "1..32767", disableValue: 0, - description : "Automatically turns the switch off after x amount of seconds. Example of how the values work: 0 = Disabled, 1 = 1 second, 32767 = 32767 seconds." - ], - [ - name : "Default Level (Local)", key: "defaultLevel(Local)", type: "range", - parameterNumber: 9, size: 1, defaultValue: 0, - range : "1..100", - description : "Default dim level for the switch when pressed locally (at the switch). This is useful if you'd like your switch to turn on to a certain level when manually pressing the switch during certain times. For example, you could have your switch turn on to 10% brightness during the hours of 10pm - 6am when you manually press it. Example of how the values work: 0 = Switch will return to level it was prior to being off, 1 = 1%, 100 = 100%. This parameter can be set without a HUB from the Configuration Button." + description : "Automatically turns the switch off after x amount of seconds (value 0 = Disabled)" ] ] } From b5746b1a8f7f6dd4bcd85f4203db79059f1adfa8 Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Tue, 11 Aug 2020 17:23:22 +0200 Subject: [PATCH 07/12] Deleted LED Bar color preference from settings view, shortened delay between commands --- .../child-color-control.groovy | 4 +- .../inovelli-dimmer.groovy | 78 +++++++++---------- 2 files changed, 37 insertions(+), 45 deletions(-) diff --git a/devicetypes/smartthings/child-color-control.src/child-color-control.groovy b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy index 9222c714a59..51ba406b357 100644 --- a/devicetypes/smartthings/child-color-control.src/child-color-control.groovy +++ b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy @@ -27,8 +27,8 @@ metadata { } } - main([]) - details([]) + main(["switch"]) + details(["switch"]) } } diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index d5a2ce25d3f..caebecc5973 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -178,42 +178,41 @@ private syncConfiguration() { } def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport cmd) { - // Preferences template begin - log.debug "Configuration report: ${cmd}" - def preference = parameterMap.find({ it.parameterNumber == cmd.parameterNumber }) - def key = preference.key - def preferenceValue = getPreferenceValue(preference, cmd.scaledConfigurationValue) - log.debug "settings.key ${settings."$key"} preferenceValue ${preferenceValue}" - - if (state.currentPreferencesState."$key".status == "reverseSyncPending") { - log.debug "reverseSyncPending" - state.currentPreferencesState."$key".value = preferenceValue - state.currentPreferencesState."$key".status = "synced" + if (cmd.parameterNumber == 13) { + handleLEDPreferenceEvent(cmd) } else { - if (preferenceValue instanceof String && settings."$key" == preferenceValue.toBoolean()) { - state.currentPreferencesState."$key".value = settings."$key" - state.currentPreferencesState."$key".status = "synced" - } else if (preferenceValue instanceof Integer && settings."$key" == preferenceValue) { - state.currentPreferencesState."$key".value = settings."$key" + // Preferences template begin + log.debug "Configuration report: ${cmd}" + def preference = parameterMap.find({ it.parameterNumber == cmd.parameterNumber }) + def key = preference.key + def preferenceValue = getPreferenceValue(preference, cmd.scaledConfigurationValue) + log.debug "settings.key ${settings."$key"} preferenceValue ${preferenceValue}" + + if (state.currentPreferencesState."$key".status == "reverseSyncPending") { + log.debug "reverseSyncPending" + state.currentPreferencesState."$key".value = preferenceValue state.currentPreferencesState."$key".status = "synced" - } else if (preference.type == "boolRange") { - log.debug "${state.currentPreferencesState."$key".status}" - if (state.currentPreferencesState."$key".status == "disablePending" && preferenceValue == preference.disableValue) { - state.currentPreferencesState."$key".status = "disabled" - } else { - runIn(5, "syncConfiguration", [overwrite: true]) - } } else { - state.currentPreferencesState."$key"?.status = "syncPending" - if (cmd.parameterNumber == 13) { - state.currentPreferencesState."$key".value = preferenceValue + if (preferenceValue instanceof String && settings."$key" == preferenceValue.toBoolean()) { + state.currentPreferencesState."$key".value = settings."$key" state.currentPreferencesState."$key".status = "synced" - handleLEDPreferenceEvent(cmd) + } else if (preferenceValue instanceof Integer && settings."$key" == preferenceValue) { + state.currentPreferencesState."$key".value = settings."$key" + state.currentPreferencesState."$key".status = "synced" + } else if (preference.type == "boolRange") { + log.debug "${state.currentPreferencesState."$key".status}" + if (state.currentPreferencesState."$key".status == "disablePending" && preferenceValue == preference.disableValue) { + state.currentPreferencesState."$key".status = "disabled" + } else { + runIn(5, "syncConfiguration", [overwrite: true]) + } + } else { + state.currentPreferencesState."$key"?.status = "syncPending" + runIn(5, "syncConfiguration", [overwrite: true]) } - runIn(5, "syncConfiguration", [overwrite: true]) } + // Preferences template end } - // Preferences template end } private getPreferenceValue(preference, value = "default") { @@ -291,7 +290,7 @@ def handleLEDPreferenceEvent(cmd) { def createChildDevice(childDthNamespace, childDthName, childDni, childComponentLabel, childComponentName) { try { log.debug "Creating a child device: ${childDthNamespace}, ${childDthName}, ${childDni}, ${childComponentLabel}, ${childComponentName}" - def childDevice = addChildDevice(childDthNamespace, childDthName, childDni, device.hub.id, + addChildDevice(childDthNamespace, childDthName, childDni, device.hub.id, [ completedSetup: true, label : childComponentLabel, @@ -299,7 +298,6 @@ def createChildDevice(childDthNamespace, childDthName, childDni, childComponentL componentName : childComponentName, componentLabel: childComponentLabel ]) - childDevice } catch (Exception e) { log.debug "Exception: ${e}" } @@ -323,7 +321,7 @@ def dimmerEvents(physicalgraph.zwave.Command cmd) { result << createEvent(map) } if (switchEvent.isStateChange) { - result << response(["delay 3000", zwave.meterV3.meterGet(scale: 2).format()]) + result << response(["delay 1000", zwave.meterV3.meterGet(scale: 2).format()]) } return result } @@ -332,14 +330,14 @@ def on() { encapSequence([ zwave.basicV1.basicSet(value: 0xFF), zwave.basicV1.basicGet() - ], 5000) + ], 1000) } def off() { encapSequence([ zwave.basicV1.basicSet(value: 0x00), zwave.basicV1.basicGet() - ], 5000) + ], 1000) } def setLevel(level) { @@ -348,7 +346,7 @@ def setLevel(level) { encapSequence([ zwave.basicV1.basicSet(value: level), zwave.switchMultilevelV1.switchMultilevelGet() - ], 5000) + ], 1000) } def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) { @@ -378,7 +376,7 @@ def setColorCmd(value, id) { encapSequence([ zwave.configurationV2.configurationSet(scaledConfigurationValue: ledColor, parameterNumber: 13, size: 2), zwave.configurationV2.configurationGet(parameterNumber: 13) - ], 5000) + ], 1000) } private huePercentToZwaveValue(value) { @@ -398,7 +396,7 @@ def refresh() { encapSequence([ zwave.basicV1.basicGet(), zwave.meterV3.meterGet(scale: 0) - ], 5000) + ], 1000) } /* @@ -469,12 +467,6 @@ private getParameterMap() { range : "0..101", description : "When power is restored, the switch reverts to either On, Off, or Last Level. Example of how the values work: 0 = Off, 1-100 = Specific % On, 101 = Returns to Level before Power Outage. This parameter can be set without a HUB from the Configuration Button." ], - [ - name : "LED Indicator Color", key: "ledIndicatorColor", type: "range", - parameterNumber: 13, size: 2, defaultValue: 170, - range : "0..255", - description : "This will set the default color of the LED Bar. This is calculated by using a hue color circle (Value / 255 * 360). See website for more info. This parameter can be set without a HUB from the Configuration Button." - ], [ name : "LED Indicator Intensity", key: "ledIndicatorIntensity", type: "range", parameterNumber: 14, size: 1, defaultValue: 5, From 7e16cb35627cd4e1216c330097eb5b8271c72baa Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Tue, 11 Aug 2020 18:00:09 +0200 Subject: [PATCH 08/12] Level event is created on every level change --- .../inovelli-dimmer.src/inovelli-dimmer.groovy | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index caebecc5973..e996e700183 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -312,14 +312,9 @@ def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv3.SwitchMultilevelR } def dimmerEvents(physicalgraph.zwave.Command cmd) { - log.debug "dimmer events ${cmd}" - def map = [name: "switch", value: cmd.value ? "on" : "off", descriptionText: "$device.displayName was turned $cmd.value"] - def switchEvent = createEvent(map) - def result = [switchEvent] - if (cmd.value) { - map = [name: "level", value: cmd.value == 99 ? 100 : cmd.value, unit: "%"] - result << createEvent(map) - } + def switchEvent = createEvent([name: "switch", value: cmd.value ? "on" : "off", descriptionText: "$device.displayName was turned ${cmd.value ? "on" : "off"}"]) + def dimmerEvent = createEvent([name: "level", value: cmd.value == 99 ? 100 : cmd.value, unit: "%"]) + def result = [switchEvent, dimmerEvent] if (switchEvent.isStateChange) { result << response(["delay 1000", zwave.meterV3.meterGet(scale: 2).format()]) } From ea57b5032d81a8cbd47a5908cab551adc12acd4d Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Wed, 12 Aug 2020 16:49:43 +0200 Subject: [PATCH 09/12] Deleted minHubCoreVersion added mnmn --- .../inovelli-dimmer.src/inovelli-dimmer.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index e996e700183..5d382d7aaa5 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -15,7 +15,7 @@ * */ metadata { - definition(name: "Inovelli Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch", minHubCoreVersion: '000.017.0012', mcdSync: true) { + definition(name: "Inovelli Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch", mcdSync: true) { capability "Actuator" capability "Configuration" capability "Energy Meter" @@ -26,7 +26,7 @@ metadata { capability "Switch Level" capability "Power Meter" - fingerprint mfr: "031E", prod: "0001", model: "0001", deviceJoinName: "Inovelli Dimmer Switch" , vid: "SmartThings-smartthings-Inovelli_Dimmer"//Inovelli Dimmer LZW31-SN + fingerprint mfr: "031E", prod: "0001", model: "0001", deviceJoinName: "Inovelli Dimmer Switch", mnmn: "SmartThings", vid: "SmartThings-smartthings-Inovelli_Dimmer" //Inovelli Dimmer LZW31-SN } tiles(scale: 2) { @@ -58,7 +58,7 @@ metadata { preferences { // Preferences template begin parameterMap.each { - input(title: it.name, description: it.description, type: "paragraph", element: "paragraph") + input(title: it.name, description: it.description, type: "paragraph", element: "paragraph") switch (it.type) { case "boolRange": @@ -89,7 +89,7 @@ metadata { break case "range": input( - name: it.key, type: "number", title: "Set value (range ${it.range})", + name: it.key, type: "number", title: "Set value (range ${it.range})", defaultValue: it.defaultValue, range: it.range, required: false ) break From 0a502c819bebbcef46cd3eee57c7a19c33cb6d37 Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Tue, 25 Aug 2020 08:31:28 +0200 Subject: [PATCH 10/12] Added child buttons --- .../inovelli-dimmer.groovy | 68 ++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index 5d382d7aaa5..23692290e14 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -115,7 +115,11 @@ def installed() { } } // Preferences template end - createChildDevice("smartthings", "Child Color Control", "${device.deviceNetworkId}:1", "LED Bar", "LEDColorConfiguration") + createChildButtonDevices() + def value = ['pushed', 'up', 'up_2x', 'up_3x', 'up_4x', 'up_5x', 'down', 'down_2x', 'down_3x', 'down_4x', 'down_5x'].encodeAsJson() + sendEvent(name: "supportedButtonValues", value: value) + sendEvent(name: "numberOfButtons", value: 3, displayed: true) + createChildDevice("smartthings", "Child Color Control", "${device.deviceNetworkId}:4", "LED Bar", "LEDColorConfiguration") } def configure() { @@ -281,7 +285,7 @@ def parse(String description) { def handleLEDPreferenceEvent(cmd) { def hueState = [name: "hue", value: "${Math.round(zwaveValueToHuePercent(cmd.scaledConfigurationValue))}"] - def childDni = "${device.deviceNetworkId}:1" + def childDni = "${device.deviceNetworkId}:4" def childDevice = childDevices.find { it.deviceNetworkId == childDni } childDevice?.sendEvent(hueState) childDevice?.sendEvent(name: "saturation", value: "100") @@ -354,6 +358,66 @@ def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) { createEvent(map) } +private getButtonLabel() { + [ + "Up", + "Down", + "Configuration" + ] +} + +private void createChildButtonDevices() { + for (buttonNumber in 1..3) { + def child = addChildDevice("smartthings", "Child Button", "${device.deviceNetworkId}:${buttonNumber}", device.hub.id, + [ + completedSetup: true, + label : buttonLabel[buttonNumber - 1], + isComponent : true, + componentName : "button$buttonNumber", + componentLabel: buttonLabel[buttonNumber - 1] + ]) + + child.sendEvent(name: "supportedButtonValues", value: ["pushed"].encodeAsJSON(), displayed: false) + child.sendEvent(name: "numberOfButtons", value: 1, displayed: false) + child.sendEvent(name: "button", value: "pushed", data: [buttonNumber: 1], displayed: false) + } +} + +def sendButtonEvent(gesture, buttonNumber) { + def event = createEvent([name: "button", value: gesture, data: [buttonNumber: buttonNumber], isStateChange: true]) + String childDni = "${device.deviceNetworkId}:$buttonNumber" + def child = childDevices.find { it.deviceNetworkId == childDni } + child?.sendEvent(event) + return createEvent([name: "button", value: gesture, data: [buttonNumber: buttonNumber], isStateChange: true, displayed: false]) +} + +def labelForGesture(gesture, attribute) { + if (attribute == 0) { + gesture; + } else { + def number = attribute - 1; + "${gesture}_${number}x"; + } +} + +def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotification cmd) { + log.info("CentralSceneNotification, keyAttributes=${cmd.keyAttributes}, sceneNumber=${cmd.sceneNumber}") + def singleClick = 0; + def multipleClicks = [3, 4, 5, 6] + def supportedAttributes = [singleClick] + multipleClicks + int attribute = cmd.keyAttributes + int scene = cmd.sceneNumber + if (scene == 1 && attribute in supportedAttributes) { + sendButtonEvent(labelForGesture("down", attribute), 2); + } else if (scene == 2 && attribute in supportedAttributes) { + sendButtonEvent(labelForGesture("up", attribute), 1); + } else if (scene == 3 && attribute == singleClick) { + sendButtonEvent("pushed", 3) + } else { + log.warn("Unhandled scene notification, keyAttributes=${attribute}, sceneNumber=${scene}") + } +} + def zwaveEvent(physicalgraph.zwave.Command cmd) { // Handles all Z-Wave commands we aren't interested in log.debug "${cmd}" From 8cf8c6a1c8874730d8c417a700d3caf178993f96 Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Thu, 27 Aug 2020 16:18:49 +0200 Subject: [PATCH 11/12] Changed button event from up/down to pushed, button labels and supported values. Deleted unnecessary code. --- .../child-color-control.groovy | 2 +- .../inovelli-dimmer.groovy | 39 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/devicetypes/smartthings/child-color-control.src/child-color-control.groovy b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy index 51ba406b357..38d90a05d88 100644 --- a/devicetypes/smartthings/child-color-control.src/child-color-control.groovy +++ b/devicetypes/smartthings/child-color-control.src/child-color-control.groovy @@ -33,5 +33,5 @@ metadata { } def setColor(value) { - parent.childSetColor(device.deviceNetworkId, value); + parent.childSetColor(value) } diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index 23692290e14..ff11ce60bd4 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -99,6 +99,10 @@ metadata { } } +private getUP_BUTTON(){ 1 } +private getDOWN_BUTTON(){ 2 } +private getCONFIGURATION_BUTTON(){ 3 } + def installed() { // Device-Watch simply pings if no device events received for 32min(checkInterval) sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) @@ -116,7 +120,7 @@ def installed() { } // Preferences template end createChildButtonDevices() - def value = ['pushed', 'up', 'up_2x', 'up_3x', 'up_4x', 'up_5x', 'down', 'down_2x', 'down_3x', 'down_4x', 'down_5x'].encodeAsJson() + def value = ['pushed', 'pushed_2x', 'pushed_3x', 'pushed_4x', 'pushed_5x'].encodeAsJson() sendEvent(name: "supportedButtonValues", value: value) sendEvent(name: "numberOfButtons", value: 3, displayed: true) createChildDevice("smartthings", "Child Color Control", "${device.deviceNetworkId}:4", "LED Bar", "LEDColorConfiguration") @@ -340,7 +344,6 @@ def off() { } def setLevel(level) { - log.debug "setLevel" if (level > 99) level = 99 encapSequence([ zwave.basicV1.basicSet(value: level), @@ -351,7 +354,7 @@ def setLevel(level) { def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) { def map = [:] if (cmd.meterType == 1 && cmd.scale == 0) { - map = [name: "energy", value: cmd.scaledMeterValue, unit: "kWh"] + map = [name: "energy", value: cmd.scaledMeterValue.round(1), unit: "kWh"] } else if (cmd.meterType == 1 && cmd.scale == 2) { map = [name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W"] } @@ -360,9 +363,9 @@ def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) { private getButtonLabel() { [ - "Up", - "Down", - "Configuration" + "Up button", + "Down button", + "Configuration button" ] } @@ -377,7 +380,8 @@ private void createChildButtonDevices() { componentLabel: buttonLabel[buttonNumber - 1] ]) - child.sendEvent(name: "supportedButtonValues", value: ["pushed"].encodeAsJSON(), displayed: false) + def value = buttonNumber == 3 ? ['pushed'] : ['pushed', 'pushed_2x', 'pushed_3x', 'pushed_4x', 'pushed_5x'] + child.sendEvent(name: "supportedButtonValues", value: value.encodeAsJSON(), displayed: false) child.sendEvent(name: "numberOfButtons", value: 1, displayed: false) child.sendEvent(name: "button", value: "pushed", data: [buttonNumber: 1], displayed: false) } @@ -391,7 +395,8 @@ def sendButtonEvent(gesture, buttonNumber) { return createEvent([name: "button", value: gesture, data: [buttonNumber: buttonNumber], isStateChange: true, displayed: false]) } -def labelForGesture(gesture, attribute) { +def labelForGesture( attribute) { + def gesture = "pushed" if (attribute == 0) { gesture; } else { @@ -408,11 +413,11 @@ def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotificat int attribute = cmd.keyAttributes int scene = cmd.sceneNumber if (scene == 1 && attribute in supportedAttributes) { - sendButtonEvent(labelForGesture("down", attribute), 2); + sendButtonEvent(labelForGesture(attribute), DOWN_BUTTON); } else if (scene == 2 && attribute in supportedAttributes) { - sendButtonEvent(labelForGesture("up", attribute), 1); + sendButtonEvent(labelForGesture(attribute), UP_BUTTON); } else if (scene == 3 && attribute == singleClick) { - sendButtonEvent("pushed", 3) + sendButtonEvent("pushed", CONFIGURATION_BUTTON) } else { log.warn("Unhandled scene notification, keyAttributes=${attribute}, sceneNumber=${scene}") } @@ -424,12 +429,11 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) { [:] } -def childSetColor(deviceNetworkId, value) { - def id = deviceNetworkId?.split(":")[1] as Integer - sendHubCommand setColorCmd(value, id) +def childSetColor(value) { + sendHubCommand setColorCmd(value) } -def setColorCmd(value, id) { +def setColorCmd(value) { if (value.hue == null || value.saturation == null) return def ledColor = Math.round(huePercentToZwaveValue(value.hue)) encapSequence([ @@ -446,11 +450,6 @@ private zwaveValueToHuePercent(value) { return value <= 2 ? 0 : (value >= 254 ? 100 : value / 255 * 100) } -def childRefresh(deviceNetworkId) { - def id = deviceNetworkId?.split(":")[1] as Integer - sendHubCommand refresh() -} - def refresh() { encapSequence([ zwave.basicV1.basicGet(), From 5403bdb7dc6ba170b548fe3cdd5aa88a73936b0d Mon Sep 17 00:00:00 2001 From: "Marta Wierzbinska/Home IoT Development (IoT) /SRPOL/Professional/Samsung Electronics" Date: Thu, 27 Aug 2020 19:32:53 +0200 Subject: [PATCH 12/12] Fixed energy rounding --- .../smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy index ff11ce60bd4..f0ca4278d04 100644 --- a/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy +++ b/devicetypes/smartthings/inovelli-dimmer.src/inovelli-dimmer.groovy @@ -354,7 +354,7 @@ def setLevel(level) { def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) { def map = [:] if (cmd.meterType == 1 && cmd.scale == 0) { - map = [name: "energy", value: cmd.scaledMeterValue.round(1), unit: "kWh"] + map = [name: "energy", value: cmd.scaledMeterValue.toDouble().round(1), unit: "kWh"] } else if (cmd.meterType == 1 && cmd.scale == 2) { map = [name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W"] }