Fibaro 2 Dimmer - Unable to Add to Hubitat

Hi,

I have installed a Fibaro 2 Dimmer Switch; when powered up the Dimmer Switch performed its calibrations as expected, however, I am unable to add the module to my Hubitat. I start the sequence of Discover a Device, but do not get any further, i.e. no device is detected. The switch is close to the hub, so range should not be a problem. Does anyone have any ideas what is wrong?

Regards

John

I'm sorry if this is an obvious question, but you did press the 'b' button on the dimmer 3 times (quickly) when you put HE into discover device mode.
I have 2 of these and haven't had an issue.

Hi,

Yes, I tried both the B Button, and toggling the switch on/off three times. I have also looked at the Dimmer 2 manual and initiated the Z-Wave network range test, which pulses Green and then glows Red. Indicating an attempt to connect to the network resulting in a fail.

Regards

John

Some of my device have been very finicky and have required multiple exclude, factory reset, include cycles before they are joined to the HE hub.

EDIT: Come to think of it, the hardest one was a Fibaro motion sensor, I have two, one joined right away the other took about 5 cycles to join

OK, I'll give it a few more goes. Thanks.

Thanks everyone, I got this to be detected after a factory reset and three or four more goes. It identified as a generic device with no functionality, does anyone recommend a good driver to use?

Regards

John

Try this.

/**
 *
 *  Fibaro Dimmer 2 (US)
 *   
 *	github: Eric Maycock (erocm123)
 *	email: erocmail@gmail.com
 *	Date: 2016-07-31 8:03PM
 *	Copyright Eric Maycock
 *
 *
 *  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.
 *
 */
 
metadata {
	definition (name: "Fibaro Dimmer 2", namespace: "erocm123", author: "Eric Maycock") {
		capability "Actuator"
		capability "Switch"
		capability "Switch Level"
		capability "Refresh"
		capability "Configuration"
		capability "Sensor"
        capability "Polling"
        capability "Energy Meter"
        capability "Power Meter"
        capability "PushableButton"
        capability "Health Check"
        
        attribute   "needUpdate", "string"

        fingerprint mfr: "010F", prod: "0102", model: "2000", deviceJoinName: "Fibaro Dimmer 2"

		fingerprint deviceId: "0x1101", inClusters: "0x72,0x86,0x70,0x85,0x8E,0x26,0x7A,0x27,0x73,0xEF,0x26,0x2B"
        fingerprint deviceId: "0x1101", inClusters: "0x5E,0x20,0x86,0x72,0x26,0x5A,0x59,0x85,0x73,0x98,0x7A,0x56,0x70,0x31,0x32,0x8E,0x60,0x75,0x71,0x27"
        
	}
    
    preferences {
        input description: "Once you change values on this page, the corner of the \"configuration\" icon will change orange until all configuration parameters are updated.", title: "Settings", displayDuringSetup: false, type: "paragraph", element: "paragraph"
		generate_preferences(configuration_model())
    }

	simulator {

	}

	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.light.on", backgroundColor:"#00a0dc", nextState:"turningOff"
				attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
				attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#00a0dc", nextState:"turningOff"
				attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
			}
            tileAttribute ("device.level", key: "SLIDER_CONTROL") {
				attributeState "level", action:"switch level.setLevel"
			}
            tileAttribute ("statusText", key: "SECONDARY_CONTROL") {
           		attributeState "statusText", label:'${currentValue}'       		
            }
	    }
		standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
		}
        valueTile("power", "device.power", decoration: "flat", width: 2, height: 2) {
			state "default", label:'${currentValue} W'
		}
		valueTile("energy", "device.energy", decoration: "flat", width: 2, height: 2) {
			state "default", label:'${currentValue} kWh'
		}
		standardTile("reset", "device.energy", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
			state "default", label:'reset kWh', action:"reset"
		}
        standardTile("configure", "device.needUpdate", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "NO" , label:'', action:"configuration.configure", icon:"st.secondary.configure"
            state "YES", label:'', action:"configuration.configure", icon:"https://github.com/erocm123/SmartThingsPublic/raw/master/devicetypes/erocm123/qubino-flush-1d-relay.src/configure@2x.png"
        }


		main "switch"
		details (["switch", "power", "energy", "refresh", "configure", "reset"])
	}
}

def parse(String description) {
	def result = null
	if (description.startsWith("Err")) {
	    result = createEvent(descriptionText:description, isStateChange:true)
	} else if (description != "updated") {
		def cmd = zwave.parse(description, [0x20: 1, 0x84: 1, 0x98: 1, 0x56: 1, 0x60: 3])
		if (cmd) {
			result = zwaveEvent(cmd)
		}
	}
    
    def statusTextmsg = ""
    if (device.currentState('power') && device.currentState('energy')) statusTextmsg = "${device.currentState('power').value} W ${device.currentState('energy').value} kWh"
    sendEvent(name:"statusText", value:statusTextmsg, displayed:false)
    
	return result
}

def zwaveEvent(hubitat.zwave.commands.basicv1.BasicReport cmd) {
    logging("BasicReport: $cmd")
    def events = []
	if (cmd.value == 0) {
		events << createEvent(name: "switch", value: "off")
	} else if (cmd.value == 255) {
		events << createEvent(name: "switch", value: "on")
	} else {
		events << createEvent(name: "switch", value: "on")
        events << createEvent(name: "switchLevel", value: cmd.value)
	}
    
    def request = update_needed_settings()
    
    if(request != []){
        return [response(commands(request)), events]
    } else {
        return events
    }
}

def zwaveEvent(hubitat.zwave.commands.sceneactivationv1.SceneActivationSet cmd) {
    logging("SceneActivationSet: $cmd")
    logging("sceneId: $cmd.sceneId")
    logging("dimmingDuration: $cmd.dimmingDuration")
    logging("Configuration for preference \"Switch Type\" is set to ${settings."20"}")
    
    if (settings."20" == "2") {
        logging("Switch configured as Roller blinds")
        switch (cmd.sceneId) {
            // Roller blinds S1
            case 10: // Turn On (1x click)
                buttonEvent(1, "pushed")
            break
            case 13: // Release
                buttonEvent(1, "held")
            break
            case 14: // 2x click
                buttonEvent(2, "pushed")
            break
            case 17: // Brightening
                buttonEvent(2, "held")
            break
            // Roller blinds S2
            case 11: // Turn Off
                buttonEvent(3, "pushed")
            break
            case 13: // Release
                buttonEvent(3, "held")
            break
            case 14: // 2x click
                buttonEvent(4, "pushed")
            break
            case 15: // 3x click
                buttonEvent(5, "pushed")
            break
            case 18: // Dimming
                buttonEvent(4, "held")
            break
            default:
                logging("Unhandled SceneActivationSet: ${cmd}")
            break
        }
    } else if (settings."20" == "1") {
        logging("Switch configured as Toggle")
        switch (cmd.sceneId) {
            // Toggle S1
            case 10: // Off to On
                buttonEvent(1, "pushed")
            break
            case 11: // On to Off
                buttonEvent(1, "held")
            break
            case 14: // 2x click
                buttonEvent(2, "pushed")
            break
            // Toggle S2
            case 20: // Off to On
                buttonEvent(3, "pushed")
            break
            case 21: // On to Off
                buttonEvent(3, "held")
            break
            case 24: // 2x click
                buttonEvent(4, "pushed")
            break
            case 25: // 3x click
                buttonEvent(5, "pushed")
            break
            default:
                logging("Unhandled SceneActivationSet: ${cmd}")
            break
        
        }
    } else {
        if (settings."20" == "0") logging("Switch configured as Momentary") else logging("Switch type not configured") 
        switch (cmd.sceneId) {
            // Momentary S1
            case 16: // 1x click
                buttonEvent(1, "pushed")
            break
            case 14: // 2x click
                buttonEvent(2, "pushed")
            break
            case 12: // held
                buttonEvent(1, "held")
            break
            case 13: // release
                buttonEvent(2, "held")
            break
            // Momentary S2
            case 26: // 1x click
                buttonEvent(3, "pushed")
            break
            case 24: // 2x click
                buttonEvent(4, "pushed")
            break
            case 25: // 3x click
                buttonEvent(5, "pushed")
            break
            case 22: // held
                buttonEvent(3, "held")
            break
            case 23: // release
                buttonEvent(4, "held")
            break
            default:
                logging("Unhandled SceneActivationSet: ${cmd}")
            break
        }
    }  
}

def buttonEvent(button, value) {
    logging("buttonEvent() Button:$button, Value:$value")
	createEvent(name: "button", value: value, data: [buttonNumber: button], descriptionText: "$device.displayName button $button was $value", isStateChange: true)
}

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

def dimmerEvents(hubitat.zwave.Command cmd) {
	logging(cmd)
	def result = []
	def value = (cmd.value ? "on" : "off")
	def switchEvent = createEvent(name: "switch", value: value, descriptionText: "$device.displayName was turned $value")
	result << switchEvent
	if (cmd.value) {
		result << createEvent(name: "level", value: cmd.value, unit: "%")
	}
	if (switchEvent.isStateChange) {
		result << response(["delay 3000", zwave.meterV2.meterGet(scale: 2).format()])
	}
	return result
}

def zwaveEvent(hubitat.zwave.commands.associationv2.AssociationReport cmd) {
	logging("AssociationReport $cmd")
    state."association${cmd.groupingIdentifier}" = cmd.nodeId[0]
}

def zwaveEvent(hubitat.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
	def encapsulatedCommand = cmd.encapsulatedCommand([0x20: 1, 0x84: 1])
	if (encapsulatedCommand) {
		state.sec = 1
		def result = zwaveEvent(encapsulatedCommand)
		result = result.collect {
			if (it instanceof hubitat.device.HubAction && !it.toString().startsWith("9881")) {
				response(cmd.CMD + "00" + it.toString())
			} else {
				it
			}
		}
		result
	}
}

def zwaveEvent(hubitat.zwave.commands.crc16encapv1.Crc16Encap cmd) {
	def versions = [0x31: 5, 0x30: 1, 0x9C: 1, 0x70: 2, 0x85: 2]
	def version = versions[cmd.commandClass as Integer]
	def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass)
	def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data)
	if (encapsulatedCommand) {
		zwaveEvent(encapsulatedCommand)
	}
}

def zwaveEvent(hubitat.zwave.Command cmd) {
    logging("Unhandled Z-Wave Event: $cmd")
}

def zwaveEvent(hubitat.zwave.commands.meterv3.MeterReport cmd) {
	logging(cmd)
	if (cmd.meterType == 1) {
		if (cmd.scale == 0) {
			return createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kWh")
		} else if (cmd.scale == 1) {
			return createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kVAh")
		} else if (cmd.scale == 2) {
			return createEvent(name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W")
		} else {
			return createEvent(name: "electric", value: cmd.scaledMeterValue, unit: ["pulses", "V", "A", "R/Z", ""][cmd.scale - 3])
		}
	}
}

def zwaveEvent(hubitat.zwave.commands.sensormultilevelv5.SensorMultilevelReport cmd){
    logging("SensorMultilevelReport: $cmd")
	def map = [:]
	switch (cmd.sensorType) {
		case 4:
			map.name = "power"
            map.value = cmd.scaledSensorValue.toInteger().toString()
            map.unit = cmd.scale == 1 ? "Btu/h" : "W"
            break
		default:
			map.descriptionText = cmd.toString()
	}
	createEvent(map)
}

def on() {
	commands([zwave.basicV1.basicSet(value: 0xFF), zwave.basicV1.basicGet()])
}

def off() {
	commands([zwave.basicV1.basicSet(value: 0x00), zwave.basicV1.basicGet()])
}

def refresh() {
   	logging("$device.displayName refresh()")

    def cmds = []
    if (state.lastRefresh != null && now() - state.lastRefresh < 5000) {
        logging("Refresh Double Press")
        def configuration = new XmlSlurper().parseText(configuration_model())
        configuration.Value.each
        {
            if ( "${it.@setting_type}" == "zwave" ) {
                cmds << zwave.configurationV1.configurationGet(parameterNumber: "${it.@index}".toInteger())
            }
        } 
        cmds << zwave.firmwareUpdateMdV2.firmwareMdGet()
    } else {
        cmds << zwave.meterV2.meterGet(scale: 0)
        cmds << zwave.meterV2.meterGet(scale: 2)
	    cmds << zwave.basicV1.basicGet()
    }

    state.lastRefresh = now()
    
    commands(cmds)
}

def ping() {
   	logging("$device.displayName ping()")

    def cmds = []

    cmds << zwave.meterV2.meterGet(scale: 0)
    cmds << zwave.meterV2.meterGet(scale: 2)
	cmds << zwave.basicV1.basicGet()

    commands(cmds)
}

def setLevel(level) {
	if(level > 99) level = 99
    if(level < 1) level = 1
    def cmds = []
    cmds << zwave.basicV1.basicSet(value: level)
    cmds << zwave.switchMultilevelV1.switchMultilevelGet()
    
	commands(cmds)
}

def updated()
{
    state.enableDebugging = settings.enableDebugging
    logging("updated() is being called")
    sendEvent(name: "checkInterval", value: 2 * 30 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
    state.needfwUpdate = ""
    
    def cmds = update_needed_settings()
    
    sendEvent(name:"needUpdate", value: device.currentValue("needUpdate"), displayed:false, isStateChange: true)
    
    response(commands(cmds))
}

private command(hubitat.zwave.Command cmd) {
	if (state.sec) {
		zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
	} else {
		cmd.format()
	}
}

private commands(commands, delay=1500) {
	delayBetween(commands.collect{ command(it) }, delay)
}

def generate_preferences(configuration_model)
{
    def configuration = new XmlSlurper().parseText(configuration_model)
   
    configuration.Value.each
    {
        switch(it.@type)
        {   
            case ["byte","short","four"]:
                input "${it.@index}", "number",
                    title:"${it.@label}\n" + "${it.Help}",
                    range: "${it.@min}..${it.@max}",
                    defaultValue: "${it.@value}",
                    displayDuringSetup: "${it.@displayDuringSetup}"
            break
            case "list":
                def items = []
                it.Item.each { items << ["${it.@value}":"${it.@label}"] }
                input "${it.@index}", "enum",
                    title:"${it.@label}\n" + "${it.Help}",
                    defaultValue: "${it.@value}",
                    displayDuringSetup: "${it.@displayDuringSetup}",
                    options: items
            break
            case "decimal":
               input "${it.@index}", "decimal",
                    title:"${it.@label}\n" + "${it.Help}",
                    range: "${it.@min}..${it.@max}",
                    defaultValue: "${it.@value}",
                    displayDuringSetup: "${it.@displayDuringSetup}"
            break
            case "boolean":
               input "${it.@index}", "boolean",
                    title:"${it.@label}\n" + "${it.Help}",
                    defaultValue: "${it.@value}",
                    displayDuringSetup: "${it.@displayDuringSetup}"
            break
        }  
    }
}


def update_current_properties(cmd)
{
    def currentProperties = state.currentProperties ?: [:]
    
    currentProperties."${cmd.parameterNumber}" = cmd.configurationValue

    if (settings."${cmd.parameterNumber}" != null)
    {
        if (settings."${cmd.parameterNumber}".toInteger() == convertParam("${cmd.parameterNumber}".toInteger(), cmd2Integer(cmd.configurationValue)))
        {
            sendEvent(name:"needUpdate", value:"NO", displayed:false, isStateChange: true)
        }
        else
        {
            sendEvent(name:"needUpdate", value:"YES", displayed:false, isStateChange: true)
        }
    }

    state.currentProperties = currentProperties
}

def update_needed_settings()
{
    def cmds = []
    def currentProperties = state.currentProperties ?: [:]
     
    def configuration = new XmlSlurper().parseText(configuration_model())
    def isUpdateNeeded = "NO"
    
    if(!state.needfwUpdate || state.needfwUpdate == ""){
       logging("Requesting device firmware version")
       cmds << zwave.firmwareUpdateMdV2.firmwareMdGet()
    }   
    if(!state.association1 || state.association1 == "" || state.association1 == "1"){
       logging("Setting association group 1")
       cmds << zwave.associationV2.associationSet(groupingIdentifier:1, nodeId:zwaveHubNodeId)
       cmds << zwave.associationV2.associationGet(groupingIdentifier:1)
    }
    if(!state.association2 || state.association2 == "" || state.association1 == "2"){
       logging("Setting association group 2")
       cmds << zwave.associationV2.associationSet(groupingIdentifier:2, nodeId:zwaveHubNodeId)
       cmds << zwave.associationV2.associationGet(groupingIdentifier:2)
    }
   
    configuration.Value.each
    {     
        if ("${it.@setting_type}" == "zwave"){
            if (currentProperties."${it.@index}" == null)
            {
                if (device.currentValue("currentFirmware") == null || "${it.@fw}".indexOf(device.currentValue("currentFirmware")) >= 0){
                    isUpdateNeeded = "YES"
                    logging("Current value of parameter ${it.@index} is unknown")
                    cmds << zwave.configurationV1.configurationGet(parameterNumber: it.@index.toInteger())
                }
            }
            else if (settings."${it.@index}" != null && convertParam(it.@index.toInteger(), cmd2Integer(currentProperties."${it.@index}")) != settings."${it.@index}".toInteger())
            { 
                if (device.currentValue("currentFirmware") == null || "${it.@fw}".indexOf(device.currentValue("currentFirmware")) >= 0){
                    isUpdateNeeded = "YES"

                    logging("Parameter ${it.@index} will be updated to " + settings."${it.@index}")
                    def convertedConfigurationValue = convertParam(it.@index.toInteger(), settings."${it.@index}".toInteger())
                    cmds << zwave.configurationV1.configurationSet(configurationValue: integer2Cmd(convertedConfigurationValue, it.@byteSize.toInteger()), parameterNumber: it.@index.toInteger(), size: it.@byteSize.toInteger())
                    cmds << zwave.configurationV1.configurationGet(parameterNumber: it.@index.toInteger())
                }
            } 
        }
    }
    
    sendEvent(name:"needUpdate", value: isUpdateNeeded, displayed:false, isStateChange: true)
    return cmds
}

/**
* Convert 1 and 2 bytes values to integer
*/
def cmd2Integer(array) { 

switch(array.size()) {
	case 1:
		array[0]
    break
	case 2:
    	((array[0] & 0xFF) << 8) | (array[1] & 0xFF)
    break
    case 3:
    	((array[0] & 0xFF) << 16) | ((array[1] & 0xFF) << 8) | (array[2] & 0xFF)
    break
	case 4:
    	((array[0] & 0xFF) << 24) | ((array[1] & 0xFF) << 16) | ((array[2] & 0xFF) << 8) | (array[3] & 0xFF)
	break
    }
}

def integer2Cmd(value, size) {
	switch(size) {
	case 1:
		[value]
    break
	case 2:
    	def short value1   = value & 0xFF
        def short value2 = (value >> 8) & 0xFF
        [value2, value1]
    break
    case 3:
    	def short value1   = value & 0xFF
        def short value2 = (value >> 8) & 0xFF
        def short value3 = (value >> 16) & 0xFF
        [value3, value2, value1]
    break
	case 4:
    	def short value1 = value & 0xFF
        def short value2 = (value >> 8) & 0xFF
        def short value3 = (value >> 16) & 0xFF
        def short value4 = (value >> 24) & 0xFF
		[value4, value3, value2, value1]
	break
	}
}

def zwaveEvent(hubitat.zwave.commands.configurationv2.ConfigurationReport cmd) {
     update_current_properties(cmd)
     logging("${device.displayName} parameter '${cmd.parameterNumber}' with a byte size of '${cmd.size}' is set to '${cmd2Integer(cmd.configurationValue)}'")
}

def zwaveEvent(hubitat.zwave.commands.firmwareupdatemdv2.FirmwareMdReport cmd){
    logging("Firmware Report ${cmd.toString()}")
    def firmwareVersion
    switch(cmd.checksum){
       case "3281":
          firmwareVersion = "3.08"
       break;
       default:
          firmwareVersion = cmd.checksum
    }
    state.needfwUpdate = "false"
    updateDataValue("firmware", firmwareVersion.toString())
    createEvent(name: "currentFirmware", value: firmwareVersion)
}

def configure() {
    state.enableDebugging = settings.enableDebugging
    logging("Configuring Device For SmartThings Use")
    def cmds = []

    cmds = update_needed_settings()
    
    if (cmds != []) commands(cmds)
}

def convertParam(number, value) {
	switch (number){
    	case 201:
        	if (value < 0)
            	256 + value
        	else if (value > 100)
            	value - 256
            else
            	value
        break
        case 202:
        	if (value < 0)
            	256 + value
        	else if (value > 100)
            	value - 256
            else
            	value
        break
        case 203:
            if (value < 0)
            	65536 + value
        	else if (value > 1000)
            	value - 65536
            else
            	value
        break
        case 204:
        	if (value < 0)
            	256 + value
        	else if (value > 100)
            	value - 256
            else
            	value
        break
        default:
        	value
        break
    }
}

private def logging(message) {
    if (state.enableDebugging == null || state.enableDebugging == "true") log.debug "$message"
}


def configuration_model()
{
'''
<configuration>
  <Value type="byte" byteSize="1" index="1" label="Minimum brightness level" min="1" max="98" value="1" setting_type="zwave" fw="3.08">
    <Help>
(parameter is set automatically during the calibration process)
The parameter can be changed manually after the calibration.
Range: 1~98
Default: 1
    </Help>
  </Value>
  <Value type="byte" byteSize="1" index="2" label="Maximum brightness level" min="2" max="99" value="99" setting_type="zwave" fw="3.08">
    <Help>
(parameter is set automatically during the calibration process)
The parameter can be changed manually after the calibration.
Range: 2~99
Default: 99
    </Help>
  </Value>
  <Value type="byte" byteSize="1" index="5" label="Automatic control - dimming step size" min="1" max="99" value="1" setting_type="zwave" fw="3.08">
    <Help>
This parameter defines the percentage value of dimming step during the automatic control.
Range: 1~99
Default: 1
    </Help>
  </Value>
    <Value type="short" byteSize="2" index="6" label="Automatic control - time of a dimming step" min="0" max="255" value="1" setting_type="zwave" fw="3.08">
    <Help>
This parameter defines the time of single dimming step set in parameter 5 during the automatic control.
Range: 0~255
Default: 1
    </Help>
  </Value>
  <Value type="byte" byteSize="1" index="7" label="Manual control - dimming step size" min="1" max="99" value="1" setting_type="zwave" fw="3.08">
    <Help>
This parameter defines the percentage value of dimming step during the manual control.
Range: 1~99
Default: 1
    </Help>
  </Value>
    <Value type="short" byteSize="2" index="8" label="Manual control - time of a dimming step" min="0" max="255" value="5" setting_type="zwave" fw="3.08">
    <Help>
This parameter defines the time of single dimming step set in parameter 7 during the manual control.
Range: 0~255
Default: 5
    </Help>
  </Value>
    <Value type="list" byteSize="1" index="9" label="State of the device after a power failure" min="0" max="1" value="1" setting_type="zwave" fw="3.08">
    <Help>
The Dimmer 2 will return to the last state before power failure.
0 - the Dimmer 2 does not save the state before a power failure, it returns to the "off" position
1 - the Dimmer 2 restores its state before power failure
Range: 0~1
Default: 1
    </Help>
        <Item label="Off" value="0" />
        <Item label="Previous State" value="1" />
  </Value>
  <Value type="short" byteSize="2" index="10" label="Timer functionality (auto - off)" min="0" max="32767" value="0" setting_type="zwave" fw="3.08">
    <Help>
This parameter allows to automatically switch off the device after specified time (seconds) from switching on the light source.
Range: 1~32767
Default: 0
    </Help>
  </Value>
  <Value type="byte" byteSize="1" index="19" label="Forced switch on brightness level" min="0" max="99" value="0" setting_type="zwave" fw="3.08">
    <Help>
If the parameter is active, switching on the Dimmer 2 (S1 single click) will always set this brightness level.
Range: 0~99
Default: 0
    </Help>
  </Value>
    <Value type="list" byteSize="1" index="20" label="Switch type" min="0" max="2" value="0" setting_type="zwave" fw="3.08">
    <Help>
Choose between momentary, toggle and roller blind switch.
Range: 0~2
Default: 0
    </Help>
    <Item label="Momentary" value="0" />
    <Item label="Toggle" value="1" />
    <Item label="Roller Blind" value="2" />
  </Value>
      <Value type="list" byteSize="1" index="22" label="Assign toggle switch status to the device status " min="0" max="1" value="0" setting_type="zwave" fw="3.08">
    <Help>
By default each change of toggle switch position results in action of Dimmer 2 (switch on/off) regardless the physical connection of contacts.
0 - device changes status on switch status change
1 - device status is synchronized with switch status 
Range: 0~1
Default: 0
    </Help>
    <Item label="Default" value="0" />
    <Item label="Synchronized" value="1" />
  </Value>
  <Value type="list" byteSize="1" index="23" label="Double click option" min="0" max="1" value="1" setting_type="zwave" fw="3.08">
    <Help>
set the brightness level to MAX
Range: 0~1
Default: 1
    </Help>
    <Item label="Disabled" value="0" />
    <Item label="Enabled" value="1" />
  </Value>
    <Value type="list" byteSize="1" index="26" label="The function of 3-way switch" min="0" max="1" value="0" setting_type="zwave" fw="3.08">
    <Help>
Switch no. 2 controls the Dimmer 2 additionally (in 3-way switch mode). Function disabled for parameter 20 set to 2 (roller blind switch). 
Range: 0~1
Default: 0
    </Help>
    <Item label="Disabled" value="0" />
    <Item label="Enabled" value="1" />
  </Value>
  <Value type="list" byteSize="1" index="28" label="Scene activation functionality" min="0" max="1" value="1" setting_type="zwave" fw="3.08">
    <Help>
SCENE ID depends on the switch type configurations. 
Range: 0~1
Default: 0
    </Help>
    <Item label="Disabled" value="0" />
    <Item label="Enabled" value="1" />
  </Value>
  <Value type="list" byteSize="1" index="29" label="Switch functionality of S1 and S2" min="0" max="1" value="0" setting_type="zwave" fw="3.08">
    <Help>
This parameter allows for switching the role of keys connected to S1 and S2 without changes in connection. 
Range: 0~1
Default: 0
    </Help>
    <Item label="Standard" value="0" />
    <Item label="Switched" value="1" />
  </Value>
    <Value type="list" byteSize="1" index="35" label="Auto-calibration after power on" min="0" max="4" value="1" setting_type="zwave" fw="3.08">
    <Help>
This parameter determines the trigger of auto-calibration procedure, e.g. power on, load error, etc.
0 - No auto-calibration of the load after power on
1 - Auto-calibration performed after first power on
2 - Auto-calibration performed after each power on
3 - Auto-calibration performed after first power on or after each LOAD ERROR alarm (no load, load failure, burnt out bulb), if parameter 37 is set to 1 also after alarms: SURGE (Dimmer 2 output overvoltage) and OVERCURRENT (Dimmer 2 output overcurrent)
4 - Auto-calibration performed after each power on or after each LOAD ERROR alarm (no load, load failure, burnt out bulb), if parameter 37 is set to 1 also after alarms: SURGE (Dimmer 2 output overvoltage) and OVERCURRENT (Dimmer 2 output overcurrent) 
Range: 0~4
Default: 1
    </Help>
    <Item label="0" value="0" />
    <Item label="1" value="1" />
    <Item label="2" value="2" />
    <Item label="3" value="3" />
    <Item label="4" value="4" />
  </Value>
<Value type="short" byteSize="2" index="39" label="Max Power load" min="0" max="350" value="250" setting_type="zwave" fw="3.08">
    <Help>
This parameter defines the maximum load for a dimmer.
Range: 0~350
Default: 250
    </Help>
  </Value>
      <Value type="list" byteSize="1" index="40" label="Reaction to General Alarm" min="0" max="3" value="3" setting_type="zwave" fw="">
    <Help>
This parameter determines how the device will react to General Alarm frame.
Range: 0~3
Default: 3 (Flash)
    </Help>
    <Item label="Alarm frame is ignored" value="0" />
    <Item label="Turn ON after receiving the alarm frame" value="1" />
    <Item label="Turn OFF after receiving the alarm frame" value="2" />
	<Item label="Flash after receiving the alarm frame" value="3" />
  </Value>
      <Value type="list" byteSize="1" index="41" label="Reaction to Flood Alarm" min="0" max="3" value="2" setting_type="zwave" fw="">
    <Help>
This parameter determines how the device will react to Flood Alarm frame.
Range: 0~3
Default: 2 (OFF)
    </Help>
    <Item label="Alarm frame is ignored" value="0" />
    <Item label="Turn ON after receiving the alarm frame" value="1" />
    <Item label="Turn OFF after receiving the alarm frame" value="2" />
	<Item label="Flash after receiving the alarm frame" value="3" />
  </Value>
      <Value type="list" byteSize="1" index="42" label="Reaction to CO/CO2/Smoke Alarm" min="0" max="3" value="3" setting_type="zwave" fw="">
    <Help>
This parameter determines how the device will react to CO, CO2 or Smoke frame. 
Range: 0~3
Default: 3 (Flash)
    </Help>
    <Item label="Alarm frame is ignored" value="0" />
    <Item label="Turn ON after receiving the alarm frame" value="1" />
    <Item label="Turn OFF after receiving the alarm frame" value="2" />
	<Item label="Flash after receiving the alarm frame" value="3" />
  </Value>
      <Value type="list" byteSize="1" index="43" label="Reaction to Heat Alarm" min="0" max="3" value="1" setting_type="zwave" fw="">
    <Help>
This parameter determines how the device will react to Heat Alarm frame.
Range: 0~3
Default: 1 (ON)
    </Help>
    <Item label="Alarm frame is ignored" value="0" />
    <Item label="Turn ON after receiving the alarm frame" value="1" />
    <Item label="Turn OFF after receiving the alarm frame" value="2" />
	<Item label="Flash after receiving the alarm frame" value="3" />
  </Value>
        <Value type="byte" byteSize="2" index="44" label="Flashing alarm duration" min="1" max="32000" value="600" setting_type="zwave" fw="">
    <Help>
This parameter allows to set duration of flashing alarm mode. 
Range: 1~32000 (1s-32000s)
Default: 600 (10 min)
    </Help>
  </Value>
    <Value type="byte" byteSize="1" index="50" label="Active power reports" min="0" max="100" value="10" setting_type="zwave" fw="3.08">
    <Help>
The parameter defines the power level change that will result in a new power report being sent. The value is a percentage of the previous report.
Range: 0~100
Default: 10
    </Help>
  </Value>
    <Value type="short" byteSize="2" index="52" label="Periodic active power and energy reports" min="0" max="32767" value="3600" setting_type="zwave" fw="3.08">
    <Help>
Parameter 52 defines a time period between consecutive reports. Timer is reset and counted from zero after each report. 
Range: 0~32767
Default: 3600
    </Help>
  </Value>
    <Value type="short" byteSize="2" index="53" label="Energy reports" min="0" max="255" value="10" setting_type="zwave" fw="3.08">
    <Help>
Energy level change which will result in sending a new energy report.
Range: 0~255
Default: 10
    </Help>
  </Value>
    <Value type="list" byteSize="1" index="54" label="Self-measurement" min="0" max="1" value="0" setting_type="zwave" fw="3.08">
    <Help>
The Dimmer 2 may include active power and energy consumed by itself in reports sent to the main controller.
Range: 0~1
Default: 0
    </Help>
    <Item label="Disabled" value="0" />
    <Item label="Enabled" value="1" />
  </Value>
    <Value type="boolean" index="enableDebugging" label="Enable Debug Logging?" value="true" setting_type="preference" fw="3.08">
    <Help>

    </Help>
  </Value>
</configuration>
'''
}

Thanks.

Or this one.
This shows the parameters.

/**
 *  
 *	Fibaro Dimmer 2 (FGD-212) Driver - For use on Hubitat
 *  
 *	Author: Robin Winbourne
 *	Date: 2018-04-01 
 */

metadata {
	definition (name: "Fibaro Dimmer 2. Robins", namespace: "Hubitat", author: "Robin Winbourne") {
		capability "Energy Meter"
		capability "Actuator"
		capability "Switch"
		capability "Power Meter"
		capability "Polling"
		capability "Refresh"
		capability "Sensor"
        capability "Switch Level"

        attribute "scene", "number"           //Extending Fibaro Dimmer 2 devices with scene attribute
        attribute "syncPending", "bool"       // Updates when parameters have synced
        
		command "reset"
        command "changeSingleParam"

       // Fingerprints:
        fingerprint mfr: "010F", prod: "0102", model: "1000"
        fingerprint type: "1101", mfr: "010F", cc: "5E,86,72,59,73,22,31,32,71,56,98,7A"
        fingerprint type: "1101", mfr: "010F", cc: "5E,86,72,59,73,22,31,32,71,56,98,7A", sec: "20,5A,85,26,8E,60,70,75,27", secOut: "2B"
	}

   preferences {
       input name: "param1", type: "number", range: "1..98", defaultValue: "1", required: true,
            title: "1. Minimum brightness level. " +
                   "Set automatically during the calibration process, but can be changed afterwards. " +
                   "Values: 1-98 = Brightness level (%). Default value: 1."
               
       input name: "param2", type: "number", range: "2..99", defaultValue: "99", required: true,
            title: "2. maximum brightness level. " +
                   "Set automatically during the calibration process, but can be changed afterwards. " +
                   "Values: 2-99 = Brightness level (%). Default value: 99."

       input name: "param3", type: "number", range: "1..99", defaultValue: "1", required: true,
            title: "3. Incandescence Level of CFLs. " +
                   "The Dimmer 2 will set to this value after first switch on. It is required for warming up and switching dimmable compact fluorescent lamps and certain types of light sources. " +
                   "Values: 1-99 = Brightness level (%). Default value: 1"

        input name: "param4", type: "number", range: "0..255", defaultValue: "0", required: true,
            title: "4. Incandescence Time of CFLs. " +
                   "The time required for switching compact fluorescent lamps and certain types of light sources. " +
                   "Values: 0 = Function Disabled. 1-255 = 0.1-25.5s in 0.1s steps. Default value: 0."

        input name: "param5", type: "number", range: "1..99", defaultValue: "1", required: true,
            title: "5. Dimming Step Size (Auto). " +
                   "The percentage value of a dimming step during automatic control. " +
                   "Values: 1-99 = Dimming step (%). Default value: 1."

        input name: "param6", type: "number", range: "0..255", defaultValue: "1", required: true,
            title: "6. Dimming Step Time (Auto). " +
                   "The time of a single dimming step during automatic control. " +
                   "Values: 0-255 = 0-2.55s, in 10ms steps. Default value: 1."

        input name: "param7", type: "number", range: "1..99", defaultValue: "1", required: true,
            title: "7. Dimming Step Size (Manual). " +
                   "The percentage value of a dimming step during manual control. " +
                   "Values: 1-99 = Dimming step (%). Default value: 1."

        input name: "param8", type: "number", range: "0..255", defaultValue: "5", required: true,
            title: "8. Dimming Step Time (Manual). " +
                   "The time of a single dimming step during manual control. " +
                   "Values: 0-255 = 0-2.55s, in 10ms steps. Default value: 5."
       
        input name: "param9", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - Off"],
                      ["1" : "1 - Restore Previous State"]],
            title: "9. Dimmer dtate After Power Failure. " +
                   "The Dimmer can save its current state before a power failure and restore that state after a power failure. Default value: 1"

        input name: "param10", type: "number", range: "0..32767", defaultValue: "0", required: true,
            title: "10. Timer functionality (auto off). " +
                   "Automatically switch off the device after a specified time. " +
                   "Values: 0 = Function Disabled. 1-32767 = time in seconds. Default value: 0."

        input name: "param11", type: "enum", defaultValue: "255", required: true,
            options: [["0" : "0 - All ON not active, All OFF not active"],
                      ["1" : "1 - All ON not active, All OFF active"],
                      ["2" : "2 - All ON active, All OFF not active"],
                      ["255" : "255 - All ON active, All OFF active"]],
            title: "11. ALL ON / ALL OFF function. " +
                   "Dimmer response to SWITCH_ALL_SET commands which can be sent from other zwave devices. Default value: 255."
       
        input name: "param13", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - Readout"],
                      ["1" : "1 - force auto-calibration of the load WITHOUT Fibaro Bypass 2"],
                      ["2" : "2 - force auto-calibration of the load WITH Fibaro Bypass 2"]],
            title: "13. Force auto-calibration. " +
                   "Set this parameter to 1 or 2 to trigger an auto calibration. Parameter switches back to 0 upon completion (but not updated here). Default value: 0."

        input name: "param15", type: "number", range: "0..99", defaultValue: "30", required: true,
            title: "15. Burnt out bulb detection. " +
                   "Power variation, compared to standard power consumption (measured during calibration). " +
                   "Values: 0 = Function Disabled. 1-99 = Power variation (%). Default value: 30."

        input name: "param16", type: "number", range: "0..255", defaultValue: "5", required: true,
            title: "16. Time Delay for Burnt Out Bulb/Overload Detection. " +
                   "Time delay (in seconds) for LOAD ERROR or OVERLOAD detection. " +
                   "Values: 0 = Detection Disabled. 1-255 = Time delay (s). Default value: 5."

        input name: "param19", type: "number", range: "0..99", defaultValue: "0", required: true,
            title: "19. Forced switch on brightness level. " +
                   "Switching on the dimmer will always set this brightness level. " +
                   "Values: 0 = Function Disabled. 1-99 = Brightness level (%). Default value: 0."
               
       input name: "param20", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - Momentary switch"],
                      ["1" : "1 - Toggle switch"],
                      ["2" : "2 - Roller blind switch"]],
            title: "20. Switch Type Selection. " +
                   "Physical switch type: Momentary, Toggle, or Roller Blind (middle rest position, up to brighten, down to dim). Default value: 0."
          
       input name: "param21", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - 0xFF"],
                      ["1" : "1 - Current Level"]],
            title: "21. Value Sent to Associated Devices on Single Click. " +
         		   "0xFF will set associated devices to their last-saved state. Current Level will synchronise the state of all devices with this dimmer. Default value: 0."

       input name: "param22", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - Change on Every Switch State Change"],
                      ["1" : "1 - Synchronise with Switch State"]],
            title: "22. Assign Toggle Switch Status to Device Status. " +
         		   "By default, each change of toggle switch position results in an on/off action regardless the physical connection of contacts. Default value: 0."

       input name: "param23", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - Double-click DISABLED"],
                      ["1" : "1 - Double-click ENABLED"]],
            title: "23. Double-click sets Max Brightness. " +
         		   "Double-clicking will set brightness level to maximum. Default value: 1."

       input name: "param24", type: "number", range: "0..31", defaultValue: "0", required: true,
            title: "24. Command Frames Sent to 2nd and 3rd Association Groups (S1 Associations). " +
                   "Determines which actions will not result in sending frames to association groups. Values (add together): " +
                   "0 = All actions sent to association groups, " +
                   "1 = Do not send when switching ON (single click), " +
                   "2 = Do not send when switching OFF (single click), " +
                   "4 = Do not send when changing dimming level (holding and releasing), " +
                   "8 = Do not send on double click, " +
                   "16 = Send 0xFF value on double click. Default value: 0."

       input name: "param25", type: "number", range: "0..31", defaultValue: "0", required: true,
            title: "25. Command Frames Sent to 4th and 5th Association Groups (S2 Associations). " +
                   "Determines which actions will not result in sending frames to association groups. Values (add together): " +
                   "0 = All actions sent to association groups, " +
                   "1 = Do not send when switching ON (single click), " +
                   "2 = Do not send when switching OFF (single click), " +
                   "4 = Do not send when changing dimming level (holding and releasing), " +
                   "8 = Do not send on double click, " +
                   "16 = Send 0xFF value on double click. Default value: 0."
              
       input name: "param26", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - 3-way switch function for S2 DISABLED"],
                      ["1" : "1 - 3-way switch function for S2 ENABLED"]],
            title: "26. 3-way Switch Function. " +
         		   "Switch S2 also controls the dimmer when in 3-way switch mode. Function is disabled if parameter #20 is set to 2 (roller blind switch). Default value: 0."
              
       input name: "param27", type: "number", range: "0..15", defaultValue: "15", required: true,
            title: "27. Association Group Security Mode. " +
                   "Defines if commands sent to association groups are secure or non-secure. Values (add together): " +
                   "0 = all groups sent as non-secure, " +
                   "1 = 2nd group sent as secure, " +
                   "2 = 3rd group sent as secure, " +
                   "4 = 4th group sent as secure, " +
                   "8 = 5th group sent as secure. " +
                   "E.g. 15 = all groups (2-5) sent as secure. Default value: 15."

       input name: "param28", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - Function DISABLED"],
                      ["1" : "1 - Function ENABLED"]],
            title: "28. Scene Activation. " +
         		   "Defines if SCENE_ACTIVATION_SET commands are sent. " +
                   "For Momentary: S1 input: 16 = 1 x click, 14 = 2 x click, 12 = hold, 13 = release. " +
                   "S2 input: 26 = 1 x click, 24 = 2 x click, 25 = 3 x click, 22 = hold, 23 = release (see manual for other switch types). Default value: 0."
       
       input name: "param29", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - Standard Mode"],
                      ["1" : "1 - S1 operates as S2, S2 operates as S1"]],
            title: "29. Swap S1 and S2. " +
         		   "Swap the roles of S1 and S2 without changes to physical wiring. Default value: 0."
              
       input name: "param30", type: "enum", defaultValue: "2", required: true,
            options: [["0" : "0 - Force leading edge mode"],
                      ["1" : "1 - Force trailing edge mode"],
                      ["2" : "2 - Automatic (based on auto-calibration)"]],
            title: "30. Load Control Mode. " +
         		   "Override the dimmer mode (i.e. leading or trailing edge). Default value: 2."
        
       input name: "param32", type: "enum", defaultValue: "2", required: true,
            options: [["0" : "0 - On/Off mode DISABLED (dimming is possible)"],
                      ["1" : "1 - On/Off mode ENABLED (dimming not possible)"],
                      ["2" : "2 - Automatic (based on auto-calibration)"]],
            title: "32. On/Off Mode. " +
         		   "This mode is necessary when connecting non-dimmable light sources. Default value: 2."

       input name: "param34", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No soft-start"],
                      ["1" : "1 - Short soft-start (0.1s)"],
                      ["2" : "2 - Long soft-start (0.5s)"]],
            title: "34. Soft-Start. " +
         		   "Time required to warm up the filament of halogen bulbs. Default value: 1."

       input name: "param35", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No auto-calibration"],
                      ["1" : "1 - Auto-calibration after first power on only"],
                      ["2" : "2 - Auto-calibration after each power on"],
                      ["3" : "3 - Auto-calibration after first power on and after each LOAD ERROR"],
                      ["4" : "4 - Auto-calibration after each power on and after each LOAD ERROR"]],
            title: "35. Auto-calibration. " +
         		   "Determines when auto-calibration is triggered. Default value: 1."
       
       input name: "param37", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - Device disabled until command or external switch"],
                      ["1" : "1 - Three attempts to turn on the load"]],
            title: "37. Behaviour After OVERCURRENT or SURGE. " +
         		   "The dimmer will turn off when a surge or overcurrent is detected. Default value: 1."

        input name: "param39", type: "number", range: "0..350", defaultValue: "250", required: true,
             title: "39. Power limit - OVERLOAD. " +
                    "Reaching the defined value will result in turning off the load. Additional apparent power limit of 350VA is active by default. " +
                    "Values: 0 = Function Disabled, 1-350 = Power limit (W). Default value: 250."

       input name: "param40", type: "enum", defaultValue: "3", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Turn ON the load"],
                      ["2" : "2 - Turn OFF the load"],
                      ["3" : "3 - Load blinking"]],
            title: "40. Response to General Purpose Alarm. " +
         		   "Default value: 3."

       input name: "param41", type: "enum", defaultValue: "2", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Turn ON the load"],
                      ["2" : "2 - Turn OFF the load"],
                      ["3" : "3 - Load blinking"]],
            title: "41. Response to Water Flooding Alarm. " +
         		   "Default value: 2."
       
      input name: "param42", type: "enum", defaultValue: "3", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Turn ON the load"],
                      ["2" : "2 - Turn OFF the load"],
                      ["3" : "3 - Load blinking"]],
            title: "42. Response to Smoke, CO or CO2 Alarm. " +
         		   "Default value: 3."

       input name: "param43", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Turn ON the load"],
                      ["2" : "2 - Turn OFF the load"],
                      ["3" : "3 - Load blinking"]],
            title: "43. Response to Temperature Alarm. " +
         		   "Default value: 1."  

        input name: "param44", type: "number", range: "1..32767", defaultValue: "600", required: true,
             title: "44. Time of alarm state. " +
                    "Values: 1-32767 = Time (s). Default value: 600."
              
       input name: "param45", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Send an alarm frame"]],
            title: "45. OVERLOAD Alarm Report. " +
         		   "Power consumption above Power Limit. Default value: 1."

       input name: "param46", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Send an alarm frame"]],
            title: "46. LOAD ERROR Alarm Report. " +
         		   "No load, load failure, or burnt out bulb. Default value: 1."
       
       input name: "param47", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Send an alarm frame"]],
            title: "47. OVERCURRENT Alarm Report. " +
         		   "Short circuit, or burnt out bulb causing overcurrent. Default value: 1."
       
       input name: "param48", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Send an alarm frame"]],
            title: "48. SURGE Alarm Report. " +
         		   "Dimmer 2 output overvoltage. Default value: 1."

       input name: "param49", type: "enum", defaultValue: "1", required: true,
            options: [["0" : "0 - No reaction"],
                      ["1" : "1 - Send an alarm frame"]],
            title: "49. OVERHEAT and VOLTAGE DROP Alarm Report. " +
         		   "Critical temperature, or low voltage. Default value: 1."

        input name: "param50", type: "number", range: "0..100", defaultValue: "10", required: true,
             title: "50. Power Reports Threshold. " +
                    "Power level change that will result in a new power report being sent. " +
                    "Values: 0 = Reports disabled, 1-100 = % change from previous report. Default value: 10."

        input name: "param52", type: "number", range: "0..32767", defaultValue: "3600", required: true,
             title: "52. Reporting Period. " +
                    "The time period between consecutive power and energy reports. " +
                    "Values: 0 = Reports disabled, 1-32767 = Time period (s). Default value: 3600."

        input name: "param53", type: "number", range: "0..255", defaultValue: "10", required: true,
             title: "53. Energy Reports Threshold. " +
                    "Energy level change that will result in a new energy report being sent. " +
                    "Values: 0 = Reports disabled, 1-255 = 0.01-2.55 kWh. Default value: 10."

       input name: "param54", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - Self-measurement DISABLED"],
                      ["1" : "1 - Self-measurement ENABLED"]],
            title: "54. Self-measurement. " +
         		   "Include power and energy consumed by the device itself in reports. Default value: 0."
       
       input name: "param58", type: "enum", defaultValue: "0", required: true,
            options: [["0" : "0 - Standard algorithm"],
                      ["1" : "1 - Based on calibration data"],
                      ["2" : "2 - Based on control angle"]],
            title: "58. Method of Calculating Active Power. " +
         		   "Useful in 2-wire configurations with non-resistive loads. Default value: 0."
  
        input name: "param59", type: "number", range: "0..500", defaultValue: "0", required: true,
             title: "59. Approximated Power at Max Brightness. " +
                    "Determines the approximate value of the power that will be reported by the device at it's maximum brightness level. " +
                    "Values: 0-500 = Power (W). Default value: 0."

        input name: "paramAssociationGroup1", type: "bool", defaultValue: true, required: true,
             title: "The Dimmer 2 provides the association of five groups. " +
                    "1st Association Group 'Lifeline'. Default value: true"

        input name: "paramAssociationGroup2", type: "bool", defaultValue: true, required: true,
             title: "2nd Association Group 'On/Off (S1)'. Default value: true"

        input name: "paramAssociationGroup3", type: "bool", defaultValue: false, required: true,
             title: "3rd Association Group 'Dimmer (S1)'. Default value: false"

        input name: "paramAssociationGroup4", type: "bool", defaultValue: false, required: true,
             title: "4th Association Group 'On/Off (S2)'. Default value: false"

        input name: "paramAssociationGroup5", type: "bool", defaultValue: false, required: true,
             title: "5th Association Group 'Dimmer (S2)'. Default value: false"
    }
}

def parse(String description) {
	log.trace(description)
    log.debug("RAW command: $description")
	def result = null

    if (description != "updated") {
		def cmd = zwave.parse(description.replace("98C1", "9881"), [0x20: 1, 0x26: 3, 0x32: 3, 0x25: 1, 0x98: 1, 0x70: 1, 0x85: 2, 0x9B: 1, 0x90: 1, 0x73: 1, 0x30: 1, 0x28: 1, 0x72: 1])
		if (cmd) {
			result = zwaveEvent(cmd)
		}
    }
    log.debug "Parsed '${description}' to ${result.inspect()}"
	return result
}

def zwaveEvent(hubitat.zwave.commands.sceneactivationv1.SceneActivationSet cmd) {
	log.debug( "Scene ID: $cmd.sceneId")
    log.debug( "Dimming Duration: $cmd.dimmingDuration")

    sendEvent(name: "scene", value: "$cmd.sceneId", data: [switchType: "$settings.param20"], descriptionText: "Scene id $cmd.sceneId was activated", isStateChange: true)
    log.debug( "Scene id $cmd.sceneId was activated" )
}

// Devices that support the Security command class can send messages in an encrypted form;
// they arrive wrapped in a SecurityMessageEncapsulation command and must be unencapsulated
def zwaveEvent(hubitat.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
	log.trace(cmd)
	def encapsulatedCommand = cmd.encapsulatedCommand([0x20: 1, 0x26: 3, 0x32: 3, 0x25: 1, 0x98: 1, 0x70: 1, 0x85: 2, 0x9B: 1, 0x90: 1, 0x73: 1, 0x30: 1, 0x28: 1, 0x72: 1]) // can specify command class versions here like in zwave.parse
	if (encapsulatedCommand) {
		return zwaveEvent(encapsulatedCommand)
	} else {
		log.warn "Unable to extract encapsulated cmd from $cmd"
		createEvent(descriptionText: cmd.toString())
	}
}

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

def zwaveEvent(hubitat.zwave.commands.basicv1.BasicSet cmd) {
	log.trace(cmd)
	dimmerEvents(cmd)
}
def zwaveEvent(hubitat.zwave.commands.switchmultilevelv3.SwitchMultilevelReport cmd) {
	log.trace(cmd)
	dimmerEvents(cmd)
}

def zwaveEvent(hubitat.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd)
{
	log.trace(cmd)
	dimmerEvents(cmd)
}

def dimmerEvents(hubitat.zwave.Command cmd) {
	log.trace(cmd)
	def result = []
	def value = (cmd.value ? "on" : "off")
	def switchEvent = createEvent(name: "switch", value: value, descriptionText: "$device.displayName was turned $value")
	result << switchEvent
	if (cmd.value) {
		result << createEvent(name: "level", value: cmd.value, unit: "%")
	}
	if (switchEvent.isStateChange) {
		result << response(["delay 3000", zwave.meterV2.meterGet(scale: 2).format()])
	}
	return result
}

def zwaveEvent(hubitat.zwave.commands.meterv3.MeterReport cmd) {
	log.trace(cmd)
	if (cmd.meterType == 1) {
		if (cmd.scale == 0) {
			return createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kWh")
		} else if (cmd.scale == 1) {
			return createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kVAh")
		} else if (cmd.scale == 2) {
			return createEvent(name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W")
		} else {
			return createEvent(name: "electric", value: cmd.scaledMeterValue, unit: ["pulses", "V", "A", "R/Z", ""][cmd.scale - 3])
		}
	}
}

def zwaveEvent(hubitat.zwave.commands.configurationv1.ConfigurationReport cmd) {
    //Handles Configuration Reports and sets syncPending to False
    log.trace("zwaveEvent(): Configuration Report received: ${cmd}")
	sendEvent(name: "syncPending", value: false, isStateChange: true)
}

def zwaveEvent(hubitat.zwave.commands.sensormultilevelv4.SensorMultilevelReport cmd) {
    log.trace("zwaveEvent(): SensorMultilevelReport received: ${cmd}")
}

def zwaveEvent(hubitat.zwave.Command cmd) {
	log.trace(cmd)
	log.debug "No handler for $cmd"
	// Handles all Z-Wave commands we aren't interested in
	createEvent(descriptionText: cmd.toString(), isStateChange: false)
}

def on() {
	log.trace("on")
	secureSequence([
			zwave.basicV1.basicSet(value: 0xFF),
            zwave.switchMultilevelV1.switchMultilevelGet()
	])
}

def off() {
	log.trace("off")
	secureSequence([
			zwave.basicV1.basicSet(value: 0x00),
            zwave.switchMultilevelV1.switchMultilevelGet()
	])
}

def poll() {
	log.trace("poll")
	secureSequence([
		zwave.meterV2.meterGet(scale: 0),
		zwave.meterV2.meterGet(scale: 2)
	])
}

def refresh() {
	log.trace("trace")
	secureSequence([
		zwave.meterV2.meterGet(scale: 0),
		zwave.meterV2.meterGet(scale: 2)
	])
}

def reset() {
	log.trace("reset")
	return secureSequence([
    	zwave.switchMultilevelV1.switchMultilevelGet(),
		zwave.meterV2.meterReset(),
		zwave.meterV2.meterGet(scale: 0),
        zwave.meterV2.meterGet(scale: 2)
	])
}

def setLevel(level) {
	log.trace("setlevel")
	if(level > 99) level = 99
	secureSequence([
		zwave.basicV1.basicSet(value: level),
		zwave.switchMultilevelV1.switchMultilevelGet()
	], 5000)
}

def changeSingleParam(paramNum, paramSize, paramValue) {
	log.debug "changeSingleParam(paramNum: $paramNum, paramSize: $paramSize, paramValue: $paramValue)"
    def cmds = secureSequence([
    	zwave.configurationV1.configurationSet(parameterNumber: paramNum, size: paramSize, scaledConfigurationValue: paramValue)
        ])
    cmds
}

def updated() {
     log.debug "configureAfterSecure()"
     sendEvent(name: "syncPending", value: true, isStateChange: true)
        def cmds = secureSequence([
            zwave.configurationV1.configurationSet(parameterNumber: 1, size: 1, scaledConfigurationValue: param1.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 2, size: 1, scaledConfigurationValue: param2.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 3, size: 1, scaledConfigurationValue: param3.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 4, size: 2, scaledConfigurationValue: param4.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 5, size: 1, scaledConfigurationValue: param5.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 6, size: 2, scaledConfigurationValue: param6.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 7, size: 1, scaledConfigurationValue: param7.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 8, size: 2, scaledConfigurationValue: param8.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 9, size: 1, scaledConfigurationValue: param9.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 10, size: 2, scaledConfigurationValue: param10.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 11, size: 2, scaledConfigurationValue: param11.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 13, size: 1, scaledConfigurationValue: param13.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 15, size: 1, scaledConfigurationValue: param15.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 16, size: 2, scaledConfigurationValue: param16.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 19, size: 1, scaledConfigurationValue: param19.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 20, size: 1, scaledConfigurationValue: param20.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 21, size: 1, scaledConfigurationValue: param21.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 22, size: 1, scaledConfigurationValue: param22.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 23, size: 1, scaledConfigurationValue: param23.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 24, size: 1, scaledConfigurationValue: param24.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 25, size: 1, scaledConfigurationValue: param25.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 26, size: 1, scaledConfigurationValue: param26.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 27, size: 1, scaledConfigurationValue: param27.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 28, size: 1, scaledConfigurationValue: param28.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 29, size: 1, scaledConfigurationValue: param29.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 30, size: 1, scaledConfigurationValue: param30.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 32, size: 1, scaledConfigurationValue: param32.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 34, size: 1, scaledConfigurationValue: param34.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 35, size: 1, scaledConfigurationValue: param35.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 37, size: 1, scaledConfigurationValue: param37.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 39, size: 2, scaledConfigurationValue: param39.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 40, size: 1, scaledConfigurationValue: param40.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 41, size: 1, scaledConfigurationValue: param41.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 42, size: 1, scaledConfigurationValue: param42.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 43, size: 1, scaledConfigurationValue: param43.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 44, size: 2, scaledConfigurationValue: param44.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 45, size: 1, scaledConfigurationValue: param45.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 46, size: 1, scaledConfigurationValue: param46.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 47, size: 1, scaledConfigurationValue: param47.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 48, size: 1, scaledConfigurationValue: param48.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 49, size: 1, scaledConfigurationValue: param49.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 50, size: 1, scaledConfigurationValue: param50.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 52, size: 2, scaledConfigurationValue: param52.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 53, size: 2, scaledConfigurationValue: param53.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 54, size: 1, scaledConfigurationValue: param54.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 58, size: 1, scaledConfigurationValue: param58.toInteger()),
            zwave.configurationV1.configurationSet(parameterNumber: 59, size: 2, scaledConfigurationValue: param59.toInteger())
        ])

        // Register for Group 1
        if(paramAssociationGroup1) {
        	cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:1, nodeId: [zwaveHubNodeId]))
        }
        else {
        	cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:1, nodeId: [zwaveHubNodeId]))
        }
        // Register for Group 2
        if(paramAssociationGroup2) {
        	cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:2, nodeId: [zwaveHubNodeId]))
        }
        else {
        	cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:2, nodeId: [zwaveHubNodeId]))
        }
        // Register for Group 3
        if(paramAssociationGroup3) {
        	cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:3, nodeId: [zwaveHubNodeId]))
        }
        else {
        	cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:3, nodeId: [zwaveHubNodeId]))
        }
        // Register for Group 4
        if(paramAssociationGroup4) {
        	cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:4, nodeId: [zwaveHubNodeId]))
        }
        else {
        	cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:4, nodeId: [zwaveHubNodeId]))
        }
        // Register for Group 5
        if(paramAssociationGroups5) {
        	cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:5, nodeId: [zwaveHubNodeId]))
        }
        else {
        	cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:5, nodeId: [zwaveHubNodeId]))
        }
	cmds 
}

private secure(hubitat.zwave.Command cmd) {
	log.trace(cmd)
	zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
}

private secureSequence(commands, delay=200) {
	log.debug "$commands"
	delayBetween(commands.collect{ secure(it) }, delay)
}

Thanks Again.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.