Homeseer HS-WD200 Dimmer Button Mapping

Thanks for figuring that out! I indeed used the wrong name for the name of that wrapper method (I've been editing drivers that use both of these names recently and slipped here). For anyone looking for an edited version, this is what I'd use:

(And note that if the status LEDs aren't working for you, the first thing I'd try is switching to the "Device" driver before this and running "Delete All States.")

/**
 *  HomeSeer HS-WD200+
 *
 *  Original Copyright 2018 HomeSeer
 *
 *  Modified from the work by DarwinsDen device handler for the WD100 version 1.03
 *
 *
 *  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.
 *
 *	Author: HomeSeer
 *	Date: 12/2017
 *   Modified: 12/2020 by RMoRobert
 *
 *	Changelog:
 *
 * 1.0	Initial Version (HomeSeer)
 * 1.0  Adaped for Hubitat by RMoRobert
 *
 *
 *   Button Mappings:
 *
 *   ACTION          BUTTON#    BUTTON ACTION
 *   Single-Tap Up     1        pushed
 *   Single-Tap Down   2        pushed
 *   Double-Tap Up     3        pushed
 *   Double-Tap Down   4        pushed
 *   Triple-Tap Up     5        pushed
 *   Triple-Tap Down   6        pushed
 *   4 taps up         7        pushed
 *   4 taps down       8       pushed
 *   5 taps up         9       pushed
 *   5 taps down       10       pushed
 *   Hold Up           1 	     held
 *   Hold Down         2 	     held
 *
 */

import groovy.transform.Field

@Field static final Map commandClassVersions = [
   0x20: 1,   //Basic
   0x26: 1,   //SwitchMultiLevel
   0x5B: 1,   //CentralScene
   0x70: 1    //Configuration
]

metadata {
	definition (name: "WD200+ Dimmer", namespace: "homeseer", author: "support@homeseer.com") {
		capability "Switch Level"
		capability "Actuator"
		capability "Indicator"
		capability "Switch"
		capability "Polling"
		capability "Refresh"
		capability "Sensor"
      capability "PushableButton"
      capability "HoldableButton"
      //capability "ReleasableButton"
      capability "Configuration"

      
      command "push", ["NUMBER"]
      command "hold", ["NUMBER"]
      //command "release", ["NUMBER"]

      command "setStatusLed", [[name:"LED*", type: "NUMBER", description: "LED number: 1-7 (bottom to top)"],
                               [name:"Color*", type: "NUMBER", description: "Color: 0=off, 1=red, 2=green, 3=blue, 4=magenta, 5=yellow, 6=cyan, 7=white"],
                               [name:"Blink", type: "NUMBER", description: "Blink: 0=no, 1=yes"]]
      command "setSwitchModeNormal"
      command "setSwitchModeStatus"
      command "setDefaultColor", [[name:"Color*", type: "NUMBER", description: "Color: 0=white, 1=red, 2=green, 3=blue, 4=magenta, 5=yellow, 6=cyan"]]
      
      fingerprint mfr: "000C", prod: "4447", model: "3036"
}
   preferences {      
      input "doubleTapToFullBright", "bool", title: "Double-tap up sets to full brightness",  defaultValue: false,  displayDuringSetup: true, required: false	       
      input "singleTapToFullBright", "bool", title: "Single-tap up sets to full brightness",  defaultValue: false,  displayDuringSetup: true, required: false	
      input "doubleTapDownToDim",    "bool", title: "Double-tap down sets to 25% level",      defaultValue: false,  displayDuringSetup: true, required: false	       
      input "reverseSwitch", "bool", title: "Reverse Switch",  defaultValue: false,  displayDuringSetup: true, required: false
      input "bottomled", "bool", title: "Bottom LED On if Load is Off",  defaultValue: false,  displayDuringSetup: true, required: false
      input "localcontrolramprate", "number", title: "Press Configure button after changing preferences\n\nLocal Ramp Rate: Duration (0-90) (1=1 sec) [default: 3]", defaultValue: 3,range: "0..90", required: false
      input "remotecontrolramprate", "number", title: "Remote Ramp Rate: duration (0-90) (1=1 sec) [default: 3]", defaultValue: 3, range: "0..90", required: false   
      input "color", "enum", title: "Default LED Color", options: ["White", "Red", "Green", "Blue", "Magenta", "Yellow", "Cyan"], description: "Select Color", required: false
      input "enableDebug", "bool", title: "Enable debug logging"
      input "enableInfo", "bool", title: "Enable descriptionText logging"
   }
}

def parse(String description) {
	def result = null
   if (enableDebug) log.debug "parse() for: $description"
    if (description != "updated") {
	    def cmd = zwave.parse(description, commandClassVersions)	
        if (cmd) {
		    result = zwaveEvent(cmd)
	    }
    }
    if (!result){
        if (enableDebug) log.debug "Parse returned ${result} for command ${cmd}"
    }
    else {
		if (enableDebug) log.debug "Parse returned ${result}"
    }   
	return result
}

String secure(String cmd){
   return zwaveSecureEncap(cmd)
}

String secure(hubitat.zwave.Command cmd){
   return zwaveSecureEncap(cmd)
}

def zwaveEvent(hubitat.zwave.commands.basicv1.BasicReport cmd) {
   dimmerEvents(cmd)
}

def zwaveEvent(hubitat.zwave.commands.basicv1.BasicSet cmd) {
	 dimmerEvents(cmd)
}

def zwaveEvent(hubitat.zwave.commands.switchmultilevelv1.SwitchMultilevelReport cmd) {
   dimmerEvents(cmd) 
}

def zwaveEvent(hubitat.zwave.commands.switchmultilevelv1.SwitchMultilevelSet cmd) {
	dimmerEvents(cmd)
}

private dimmerEvents(hubitat.zwave.Command cmd) {
	def value = (cmd.value ? "on" : "off")
	def result = [createEvent(name: "switch", value: value)]
   if (state.lastLevel != cmd.value && enableInfo) log.info "$device.displayName level is ${cmd.value}%"
   if (value != device.currentValue("switch") && enableInfo) log.info "$device.displayName switch is ${value}" 
   state.lastLevel = cmd.value
	if (cmd.value && cmd.value <= 100) {
		result << createEvent(name: "level", value: cmd.value, unit: "%")   
	}
	return result
}

def zwaveEvent(hubitat.zwave.commands.configurationv1.ConfigurationReport cmd) {
	if (enableDebug) log.debug "ConfigurationReport $cmd"
	def value = "when off"
	if (cmd.configurationValue[0] == 1) {value = "when on"}
	if (cmd.configurationValue[0] == 2) {value = "never"}
	createEvent([name: "indicatorStatus", value: value])
}

def zwaveEvent(hubitat.zwave.commands.hailv1.Hail cmd) {
	createEvent([name: "hail", value: "hail", descriptionText: "Switch button was pressed", displayed: false])
}

def zwaveEvent(hubitat.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
	if (enableDebug) log.debug "manufacturerId:   ${cmd.manufacturerId}"
	if (enableDebug) log.debug "manufacturerName: ${cmd.manufacturerName}"
    state.manufacturer=cmd.manufacturerName
	if (enableDebug) log.debug "productId:        ${cmd.productId}"
	if (enableDebug) log.debug "productTypeId:    ${cmd.productTypeId}"
	def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
	updateDataValue("MSR", msr)	
    setFirmwareVersion()
    createEvent([descriptionText: "$device.displayName MSR: $msr", isStateChange: false])
}

def zwaveEvent(hubitat.zwave.commands.versionv1.VersionReport cmd) {	
    //updateDataValue("applicationVersion", "${cmd.applicationVersion}")
    if (enableDebug) log.debug ("received Version Report")
    if (enableDebug) log.debug "applicationVersion:      ${cmd.applicationVersion}"
    if (enableDebug) log.debug "applicationSubVersion:   ${cmd.applicationSubVersion}"
    state.firmwareVersion=cmd.applicationVersion+'.'+cmd.applicationSubVersion
    if (enableDebug) log.debug "zWaveLibraryType:        ${cmd.zWaveLibraryType}"
    if (enableDebug) log.debug "zWaveProtocolVersion:    ${cmd.zWaveProtocolVersion}"
    if (enableDebug) log.debug "zWaveProtocolSubVersion: ${cmd.zWaveProtocolSubVersion}"
    setFirmwareVersion()
    createEvent([descriptionText: "Firmware V"+state.firmwareVersion, isStateChange: false])
}

def zwaveEvent(hubitat.zwave.commands.firmwareupdatemdv2.FirmwareMdReport cmd) { 
    if (enableDebug) log.debug ("received Firmware Report")
    if (enableDebug) log.debug "checksum:       ${cmd.checksum}"
    if (enableDebug) log.debug "firmwareId:     ${cmd.firmwareId}"
    if (enableDebug) log.debug "manufacturerId: ${cmd.manufacturerId}"
    [:]
}

def zwaveEvent(hubitat.zwave.commands.switchmultilevelv1.SwitchMultilevelStopLevelChange cmd) {
   if (enableInfo) log.info "$device.displayName level is on"
	[createEvent(name:"switch", value:"on"), response(secure(zwave.switchMultilevelV1.switchMultilevelGet()))]
}

def zwaveEvent(hubitat.zwave.Command cmd) {
	// Handles all Z-Wave commands we aren't interested in
   if (enableDebug) log.debug "skip: $cmd"
	return []
}

def zwaveEvent(hubitat.zwave.commands.supervisionv1.SupervisionGet cmd) {
   if (enableDebug) log.debug "SupervisionGet: $cmd"
  hubitat.zwave.Command encapCmd = cmd.encapsulatedCommand(commandClassVersions)
  sendHubCommand(new hubitat.device.HubAction(secure(zwave.supervisionV1.supervisionReport(sessionID: cmd.sessionID, reserved: 0, moreStatusUpdates: false, status: 0xFF, duration: 0)), hubitat.device.Protocol.ZWAVE))
  if (encapCmd) {
     return zwaveEvent(encapCmd)
  }
}

def on() {
	//sendEvent(tapUp1Response("digital"))
	delayBetween([
			secure(zwave.basicV1.basicSet(value: 0xFF)),
			secure(zwave.switchMultilevelV1.switchMultilevelGet())
	], 5000)
}

def off() {
	//sendEvent(tapDown1Response("digital"))
	delayBetween([
			secure(zwave.basicV1.basicSet(value: 0x00)),
			secure(zwave.switchMultilevelV1.switchMultilevelGet())
	],5000)
}

List<String> setLevel(value) {
	if (enableDebug) log.debug "setLevel >> value: $value"
	def valueaux = value as Integer
	def level = Math.max(Math.min(valueaux, 99), 0)
   if (level <= 0) {      
      return delayBetween([
            seucre(zwave.basicV1.basicSet(value: 0x00)),
            secure(zwave.switchMultilevelV1.switchMultilevelGet())
      ],5000)
   }
   else {
      def result = []
      result += response(secure(zwave.basicV1.basicSet(value: level)))
      result += response(secure("delay 5000"))
      result += response(secure(zwave.switchMultilevelV1.switchMultilevelGet()))
      result += response(secure("delay 5000"))
      result += response(secure(zwave.switchMultilevelV1.switchMultilevelGet()))
      return result
   }
}

   List<String> setLevel(value, duration) {
	if (enableDebug) log.debug "setLevel >> value: $value, duration: $duration"
  def dimmingDuration = duration < 128 ? duration : 128 + Math.round(duration / 60)
  return [
     secure(zwave.switchMultilevelV2.switchMultilevelSet(value: value < 100 ? value : 99, dimmingDuration: dimmingDuration))
  ]
   }

/*
 *  Set dimmer to status mode, then set the color of the individual LED
 *
 *  led = 1-7
 *  color = 0=0ff
 *          1=red
 *          2=green
 *          3=blue
 *          4=magenta
 *          5=yellow
 *          6=cyan
 *          7=white
 */
def setStatusLed(led, color, blink) {
   if (enableDebug) log.debug "setStatusLED >> led: $led, color: $color, blink: $blink"
    List cmds= []
    
    if(state.statusled1==null) {    	
    	   state.statusled1=0
        state.statusled2=0
        state.statusled3=0
        state.statusled4=0
        state.statusled5=0
        state.statusled6=0
        state.statusled7=0
        state.blinkval=0
    }
    
    state."statusled{$led}" = color
   
    if(state.statusled1==0 && state.statusled2==0 && state.statusled3==0 && state.statusled4==0 && state.statusled5==0 && state.statusled6==0 && state.statusled7==0)
    {
    	// no LEDS are set, put back to NORMAL mode
        cmds << secure(zwave.configurationV2.configurationSet(scaledConfigurationValue: 0, parameterNumber: 13, size: 1))
    }
    else
    {
    	// at least one LED is set, put to status mode
        cmds << secure(zwave.configurationV2.configurationSet(scaledConfigurationValue: 1, parameterNumber: 13, size: 1))
        // set the LED to color
        cmds << secure(zwave.configurationV2.configurationSet(scaledConfigurationValue: color.toInteger(), parameterNumber: (led.toInteger() + 20), size: 1))
        // check if LED should be blinking
        Integer blinkval = state.blinkval ?: 0
        if(blink)
        {
            switch(led) {
            	case 1:
                	blinkval = blinkval | 0x1
                    break
                case 2:
                	blinkval = blinkval | 0x2
                    break
                case 3:
                	blinkval = blinkval | 0x4
                    break
                case 4:
                	blinkval = blinkval | 0x8
                    break
                case 5:
                	blinkval = blinkval | 0x10
                    break
                case 6:
                	blinkval = blinkval | 0x20
                    break
                case 7:
                	blinkval = blinkval | 0x40
                    break
            }
        	cmds << secure(zwave.configurationV2.configurationSet(scaledConfigurationValue: blinkval, parameterNumber: 31, size: 1))
            // set blink speed, also enables blink, 1=100ms blink frequency
            cmds << secure(zwave.configurationV2.configurationSet(scaledConfigurationValue: 5, parameterNumber: 30, size: 1))
            state.blinkval = blinkval
        }
        else {
        	switch(led.toInteger()) {
            	case 1:
                	blinkval = blinkval & 0xFE
                    break
                case 2:
                	blinkval = blinkval & 0xFD
                    break
                case 3:
                	blinkval = blinkval & 0xFB
                    break
                case 4:
                	blinkval = blinkval & 0xF7
                    break
                case 5:
                	blinkval = blinkval & 0xEF
                    break
                case 6:
                	blinkval = blinkval & 0xDF
                    break
                case 7:
                	blinkval = blinkval & 0xBF
                    break
            }
            cmds << secure(zwave.configurationV2.configurationSet(scaledConfigurationValue: blinkval, parameterNumber: 31, size: 1))
            state.blinkval = blinkval
        }
    }
 	return delayBetween(cmds, 500)
}

/*
 * Set Dimmer to Normal dimming mode (exit status mode)
 *
 */
def setSwitchModeNormal() {
	def cmds= []
    cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [0], parameterNumber: 13, size: 1))
    delayBetween(cmds, 500)
}

/*
 * Set Dimmer to Status mode (exit normal mode)
 *
 */
def setSwitchModeStatus() {
	def cmds= []
    cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [1], parameterNumber: 13, size: 1))
    delayBetween(cmds, 500)
}

/*
 * Set the color of the LEDS for normal dimming mode, shows the current dim level
 */
def setDefaultColor(color) {
	def cmds= []
    cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [color], parameterNumber: 14, size: 1))
    delayBetween(cmds, 500)
}


def poll() {
	secure(zwave.switchMultilevelV1.switchMultilevelGet())
}

def refresh() {
	if (enableDebug) log.debug "refresh() called"
  configure()
}

def zwaveEvent(hubitat.zwave.commands.centralscenev1.CentralSceneNotification cmd) {
    if (enableDebug) log.debug("sceneNumber: ${cmd.sceneNumber} keyAttributes: ${cmd.keyAttributes}")
    def result = []
    
    switch (cmd.sceneNumber) {
      case 1:
          // Up
          switch (cmd.keyAttributes) {
              case 0:
                   // Press Once
                  result += createEvent(tapUp1Response("physical"))  
                  result += createEvent([name: "switch", value: "on", type: "physical"])
       
                  if (singleTapToFullBright)
                  {
                     result += setLevel(99)
                     result += response(secure("delay 5000"))
                     result += response(secure(zwave.switchMultilevelV1.switchMultilevelGet()))
                  } 
                  break
              case 1:
                  result=createEvent([name: "switch", value: "on", type: "physical"])
                  break
              case 2:
                  // Hold
                  result += createEvent(holdUpResponse("physical"))  
                  result += createEvent([name: "switch", value: "on", type: "physical"])    
                  break
              case 3: 
                  // 2 Times
                  result +=createEvent(tapUp2Response("physical"))
                  if (doubleTapToFullBright)
                  {
                     result += setLevel(99)
                     result += response(secure("delay 5000"))
                     result += response(secure(zwave.switchMultilevelV1.switchMultilevelGet()))
                  }                    
                  break
              case 4:
                  // 3 times
                  result=createEvent(tapUp3Response("physical"))
                  break
              case 5:
                  // 4 times
                  result=createEvent(tapUp4Response("physical"))
                  break
              case 6:
                  // 5 times
                  result=createEvent(tapUp5Response("physical"))
                  break
              default:
                  if (enableDebug) log.debug ("unexpected up press keyAttribute: $cmd.keyAttributes")
          }
          break
          
      case 2:
          // Down
          switch (cmd.keyAttributes) {
              case 0:
                  // Press Once
                  result += createEvent(tapDown1Response("physical"))
                  result += createEvent([name: "switch", value: "off", type: "physical"]) 
                  break
              case 1:
                  result=createEvent([name: "switch", value: "off", type: "physical"])
                  break
              case 2:
                  // Hold
                  result += createEvent(holdDownResponse("physical"))
                  result += createEvent([name: "switch", value: "off", type: "physical"]) 
                  break
              case 3: 
                  // 2 Times
                  result+=createEvent(tapDown2Response("physical"))
                  if (doubleTapDownToDim)
                  {
                     result += setLevel(25)
                     result += response(secure("delay 5000"))
                     result += response(secure(zwave.switchMultilevelV1.switchMultilevelGet()))
                  }  
                  break
              case 4:
                  // 3 Times
                  result=createEvent(tapDown3Response("physical"))
                  break
              case 5:
                  // 4 Times
                  result=createEvent(tapDown4Response("physical"))
                  break
              case 6:
                  // 5 Times
                  result=createEvent(tapDown5Response("physical"))
                  break
              default:
                  if (enableDebug) log.debug ("unexpected down press keyAttribute: $cmd.keyAttributes")
           } 
           break
           
      default:
           // unexpected case
           if (enableDebug)  log.debug ("unexpected scene: $cmd.sceneNumber")
   }  
   return result
}

def tapUp1Response(String buttonType) {
   sendEvent(name: "status" , value: "Tap ▲")
	[name: "pushed", value: 1, descriptionText: "$device.displayName Tap-Up-1 (button 1) pushed", 
       isStateChange: true, type: "$buttonType"]
}

def tapDown1Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▼")
	[name: "pushed", value: 2, descriptionText: "$device.displayName Tap-Down-1 (button 2) pushed", 
      isStateChange: true, type: "$buttonType"]
}

def tapUp2Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▲▲")
	[name: "pushed", value: 3, descriptionText: "$device.displayName Tap-Up-2 (button 3) pushed", 
       isStateChange: true, type: "$buttonType"]
}

def tapDown2Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▼▼")
	[name: "pushed", value: 4, descriptionText: "$device.displayName Tap-Down-2 (button 4) pushed", 
      isStateChange: true, type: "$buttonType"]
}

def tapUp3Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▲▲▲")
	[name: "pushed", value: 5, descriptionText: "$device.displayName Tap-Up-3 (button 5) pushed", 
    isStateChange: true, type: "$buttonType"]
}

def tapUp4Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▲▲▲▲")
	[name: "pushed", value: 7, descriptionText: "$device.displayName Tap-Up-4 (button 7) pushed", 
    isStateChange: true, type: "$buttonType"]
}

def tapUp5Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▲▲▲▲▲")
	[name: "pushed", value: 9, descriptionText: "$device.displayName Tap-Up-5 (button 9) pushed", 
    isStateChange: true, type: "$buttonType"]
}

def tapDown3Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▼▼▼")
	[name: "pushed", value: 6, descriptionText: "$device.displayName Tap-Down-3 (button 6) pushed", 
    isStateChange: true, type: "$buttonType"]
}

def tapDown4Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▼▼▼▼")
	[name: "pushed", value: 8, descriptionText: "$device.displayName Tap-Down-3 (button 8) pushed", 
    isStateChange: true, type: "$buttonType"]
}

def tapDown5Response(String buttonType) {
    sendEvent(name: "status" , value: "Tap ▼▼▼▼▼")
	[name: "pushed", value: 10, descriptionText: "$device.displayName Tap-Down-3 (button 10) pushed", 
    isStateChange: true, type: "$buttonType"]
}

def holdUpResponse(String buttonType) {
    sendEvent(name: "status" , value: "Hold ▲")
	[name: "held", value: 1, descriptionText: "$device.displayName Hold-Up (button 1) held", 
    isStateChange: true, type: "$buttonType"]
}

def holdDownResponse(String buttonType) {
    sendEvent(name: "status" , value: "Hold ▼")
	[name: "held", value: 2, descriptionText: "$device.displayName Hold-Down (button 2) held", 
    isStateChange: true, type: "$buttonType"]
}

def push(Number button) {
   switch (button as Integer) {
      case 1:
         sendEvent(tapUp1Response("digital"))
         break
      case 2:
         sendEvent(tapDown1Response("digital"))
         break
      case 3:
         sendEvent(tapUp2Response("digital"))
         break
      case 4:
         sendEvent(tapDown2Response("digital"))
         break
      case 5:
         sendEvent(tapUp3Response("digital"))
         break
      case 6:
         sendEvent(tapDown3Response("digital"))
         break
      case 7:
         sendEvent(tapUp4Response("digital"))
         break
      case 8:
         sendEvent(tapDown4Response("digital"))
         break
      case 9:
         sendEvent(tapUp5Response("digital"))
         break
      case 10:
         sendEvent(tapDown5Response("digital"))
         break
      default:
         log.warn "Invalid button number in push(): $button"
   }
}

def hold(Number button) {
   if (button as Integer == 1) {
	   sendEvent(holdUpResponse("digital"))
   }
   else if (button as Integer == 2) {
      sendEvent(holdDownResponse("digital"))
   }
   else {
      log.warn "Invalid button in hold(): $button"
   }
}
/*
def release(Number button) {
   if (button as Integer == 1) {
	   sendEvent(releaseUpResponse("digital"))
   }
   else if (button as Integer == 2) {
      sendEvent(releaseDownResponse("digital"))
   }
   else {
      log.warn "Invalid button in release(): $button"
   }
}
*/


def setFirmwareVersion() {
   def versionInfo = ''
   if (state.manufacturer)
   {
      versionInfo=state.manufacturer+' '
   }
   if (state.firmwareVersion)
   {
      versionInfo=versionInfo+"Firmware V"+state.firmwareVersion
   }
   else 
   {
     versionInfo=versionInfo+"Firmware unknown"
   }   
   sendEvent(name: "firmwareVersion",  value: versionInfo, isStateChange: true, displayed: false)
}

def configure() {
   log.trace ("configure() called")
 
   sendEvent(name: "numberOfButtons", value: 10)
   def commands = []
   commands << setDimRatePrefs()
   commands << secure(zwave.switchMultilevelV1.switchMultilevelGet())
   commands << secure(zwave.manufacturerSpecificV1.manufacturerSpecificGet())
   commands << secure(zwave.versionV1.versionGet())
   return delayBetween(commands,500)
}

def setDimRatePrefs() 
{
   if (enableDebug) log.trace ("set prefs")
   def cmds = []

	if (color)
    {
        switch (color) {
        	case "White":
            	cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [0], parameterNumber: 14, size: 1))
                break
      		case "Red":
            	cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [1], parameterNumber: 14, size: 1))
                break
            case "Green":
            	cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [2], parameterNumber: 14, size: 1))
                break
            case "Blue":
            	cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [3], parameterNumber: 14, size: 1))
                break
            case "Magenta":
            	cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [4], parameterNumber: 14, size: 1))
                break
            case "Yellow":
            	cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [5], parameterNumber: 14, size: 1))
                break
            case "Cyan":
            	cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [6], parameterNumber: 14, size: 1))
                break
            
            
      	}
    }    
   
   if(localcontrolramprate != null) {
   		//if (enableDebug) log.debug localcontrolramprate
   		def localcontrolramprate = Math.max(Math.min(localcontrolramprate, 90), 0)
   		cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [localcontrolramprate], parameterNumber: 12, size: 1))
   }
   
   if(remotecontrolramprate != null) {
   		if (enableDebug) log.debug remotecontrolramprate
   		def remotecontrolramprate = Math.max(Math.min(remotecontrolramprate, 90), 0)
   		cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [remotecontrolramprate], parameterNumber: 11, size: 1))
   }
   
   if (reverseSwitch)
   {
       cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [1], parameterNumber: 4, size: 1))
   }
   else
   {
      cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [0], parameterNumber: 4, size: 1))
   }
   
   if (bottomled)
   {
       cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [0], parameterNumber: 3, size: 1))
   }
   else
   {
      cmds << secure(zwave.configurationV2.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1))
   }
   
   //Enable the following configuration gets to verify configuration in the logs
   //cmds << secure(zwave.configurationV1.configurationGet(parameterNumber: 7))
   //cmds << secure(zwave.configurationV1.configurationGet(parameterNumber: 8))
   //cmds << secure(zwave.configurationV1.configurationGet(parameterNumber: 9))
   //cmds << secure(zwave.configurationV1.configurationGet(parameterNumber: 10))
   
   return cmds
}
 
def updated()
{
   def cmds= []
   cmds << setDimRatePrefs
   delayBetween(cmds, 500)
}
3 Likes