[OBSOLETE] Ikea Tradfri Wireless Dimmer Device Handler draft

Hello all,

I recently got the Ikea Tradfri dimming kit, as below:
Ikea Tradfri Dimming Kit

The bulbs works fine with the ZLL Dimmer Bulb handler but there was nothing for the dimming wheel so I had a go at writing my first device handler. It is now in a working state so I want to share with you all to help improve it.

I paired both the bulb and the dimmer directly with ST using the instructions in another thread, I could then use the dimmer can control the bulb (or anything else for that matter) by the use of a SmartApp like “Synchronised Dimming”

I am releasing as a draft for your feedback. I need to do some more testing but don’t have much time now.

Currently I have made the fast turn trigger an increase or decrease in level, but it could be mapped instead to turn the switch on and off without having to reduce the level to 0.

Turning the wheel slowly adjusts as below:

  • Clockwise - Increase level gradually
  • Anti-clockwise - Reduce level gradually

Turning the wheel fast triggers an increase or decrease of 50%

When the level reaches 0 the switch is turned off. Anything above 0 the switch is on.

I borrowed the tiles configuration from a dimming bulb.

Techy Notes:
I am not very familiar with Zigbee (or ST) so I have just used string matching for the “catchall:” events, I’m open to suggestions on how to do it better.
The Wireless Dimmer doesn’t hold any state e.g. level, on/off, so I have stored this state in the variables in ST.
The amount of turn is measured by the duration of the turn, I can’t find any other output that indicates the degrees.
I had some issues with the linked bulb flashing after I issue the off and 0 level commands. Probably the off happens first then the level adjustment turns it back on.
When I have more time I will develop more and adjust the fast turn actions to on/off instead of ±50%

Please feel free to try it out and let me know how you get on.

/**
 *  Tradfri Dimmer v0.1
 *
 *  Copyright 2017 Kristian Andrews
 *
 *  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.
 *
 *  In this handler the following actions are recognised
 *    turning clockwise slowly increased the level, the amount is determined by the time turning
 *    turning clockwise fast increased the level by 50
 *    turning anticlockwise slowly decreases the level, the amount is determined by the time turning
 *    turning anticlockwise fast decreases the level by 50
 *
 *  There are several reported actions that I can't decipher
 *    
 *  When the level reaches 0 the switch is turned off, any level above 0 the switch is on
 *  
 *  Can be used to control lights by the use of a SmartApp such as Synchronised Dimming
 *
 *  To do:
 *  1) Debug why the light flashes when I turn off, maybe I don't need to report events for the ones that are set or the commands should be reversed?
 *  e.g. when Off is set from the app GUI do I need to send an Off event as well?
 *  2) Update so that a fast turn clockwise/anticlockwise can turn the lights on and off but maintain the set level
 */
metadata {
	definition (name: "Tradfri Dimmer v0.1", namespace: "andrews.k", author: "Kristian Andrews") {
		capability "Sensor"
		capability "Switch"
		capability "Switch Level"

		fingerprint endpointId: "01", profileId: "0104", deviceId: "0810", deviceVersion: "02", inClusters: "0000, 0001, 0003, 0009, 0B05, 1000", outClusters: "0003, 0004, 0006, 0008, 0019, 1000"
	}


	simulator {
		// TODO: define status and reply messages here
	}
    
    // UI tile definitions
    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"
            }
        }

        standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
        }

        main(["switch"])
        details(["switch", "refresh"])
    }
    
}

// parse events into attributes
def parse(String description) {
	// log.debug "Parsing '${description}'"
	// TODO: handle 'switch' attribute
	// TODO: handle 'level' attribute
	def name = null
    def value = null
    def name2 = null
    def value2 = null
    
    // Check if the stored variables are initialised
    if (state.level == null) {
    	state.level = 100
    }
    
    if (state.OnOff == null) {
    	state.OnOff = 1
    }
    
    if (state.start == null) {
    	state.start = now()
    }
    
    if (state.clockwise == null) {
    	state.clockwise = 0
    }
    
    if (description?.startsWith("catchall:")) {
    	//def descMap = zigbee.parseDescriptionAsMap(description)
        
        //log.debug "Catch all: $description"
        //log.debug zigbee.parseDescriptionAsMap(description)
        
        // Responds to Zigbee events sent by the dimmer
        // Probably not the most elegant solution
        if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 05 00 00C3") {
        	// Start Turn clockwise
            log.debug "cw"
            
            // Store when the turning started and the direction
            state.start = now()
            state.clockwise = 1
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 01 00 01C3") {
        	// Start turn anticlockwise
            log.debug "acw"
            
            // Store when the turning started and the direction
            state.start = now()
            state.clockwise = -1
        } else if (description == "catchall: 0104 0008 01 01 0140 00 D035 01 00 0000 07 00 ") {
        	// Stop turning
            log.debug "Stop"
            
            // Calculate duration of turn
            def turnTime = now() - state.start
            //log.debug "Turn ms: $turnTime"
            
            // If the turn is too long ignore it, it probably came from a missed event
            if (turnTime > 2500) {
            	turnTime = 0
            }
            
            // How much change to the level
            // 2000 ms = full up or down
            int change = turnTime / 20
            
            //log.debug change
            
            if (state.clockwise == 1) {
            	// If clockwise, increase the level and turn on
            	
                // Update the stored state
                state.level = state.level + change
                
                // If above 100 reset to 100
                if (state.level > 100){
                	state.level = 100
                }
                
                // Create the ST event details
                name = "level"
                value = state.level
                
                // Turn on switch if off
                if (state.OnOff == 0){
                	// Create the ST event details
                	name2 = "switch"
                	value2 = "on"
                    
                    // Update the stored state
                    state.OnOff = 1
                }
                
                // Set state to not turning
                state.clockwise = 0
            } else if (state.clockwise == -1){
            	// If anticlockwise, decrease the level
                
                // Reduce the stored level
                state.level = state.level - change
                
                // If below 0 reset to 0
                if (state.level < 0){
                	// Make sure it doesn't go below 0
                	state.level = 0
                }
                
                // Create the ST event details
                name = "level"
                value = state.level
                
                // If level = 0 then turn off switch
                if (state.level == 0) {
                	// Update stored state
                	state.OnOff = 0
                    
                    // Create ST event details
                    name2 = "switch"
                    value2 = "off"
                }
                
                // Set state to not turning
                state.clockwise = 0
            }
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 000100") {
        	// Fast turn anti-clockwise
            log.debug "fast acw"
            
            // turn down level by 50
            state.level = state.level - 50
            
            // If below 0 reset to 0
            if (state.level < 0){
            	state.level = 0
            }
            
            // Create ST event details
            name = "level"
            value = state.level
            
            // if reached 0 turn off switch
            if (state.level == 0) {
            	if (state.OnOff == 1) {
	            	state.OnOff = 0
    	            name2 = "switch"
        	        value2 = "off"
                }
            }
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 FF0100") {
        	// Fast turn clockwise
            log.debug "fast cw"
            
            // turn up level by 50
            state.level = state.level + 50
            
            // make sure it doesn't go above 100
            if (state.level > 100) {
            	state.level = 100
            }
            
            name = "level"
            value = state.level
            
            if (state.OnOff == 0) {
            	state.OnOff = 1
            	name2 = "switch"
            	value2 = "on"
            }
            
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 07 00 ") {
        	// Unknown reply - appears after most turns
            //log.debug "Unknown catchall 1"
        } else {
            // log.debug "Other Catch all: '$description'"
            // The output I have seen so far from the dimmer
            // catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 000100 - fast turn anti-clockwise
            // catchall: 0104 0008 01 01 0140 00 D035 01 00 0000 04 00 000100 - different type of fast turn anti-clockwise?
            // catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 FF0100 - fast turn clockwise
            // catchall: 0104 0008 01 01 0140 00 D035 01 00 0000 04 00 FF0100 - different type of fast turn clockwise?
            
            //def descMap = zigbee.parseDescriptionAsMap(description)
        	//log.debug zigbee.parseDescriptionAsMap(description)
        }
    } else {
    	// log.debug "Not catch all: $description"
    }
    
    // createEvent returns a Map that defines an Event
    def result = createEvent(name: name, value: value)
    def result2 = createEvent(name: name2, value: value2)
    
    // If there is any result log it
    if (name != null) {
		log.debug "Result 1: ${result?.descriptionText}"
    }
    if (name2 != null) {
    	log.debug "Result 2: ${result2?.descriptionText}"
	}
    
    // returning the Event definition map creates an Event
    // in the SmartThings platform, and propagates it to
    // SmartApps subscribed to the device events.
    return [result, result2]
}

// handle commands
def on() {
	log.debug "Executing 'on'"
	// Handles 'on' commands from the SmartThings app or others
    
    // if switched off, turn on and set level to 50
    state.level = 50
    state.OnOff = 1
    
    // Send switch on and level events
    sendEvent(name: "switch", value: "on")
    sendEvent(name: "level", value: 50)
}

def off() {
	log.debug "Executing 'off'"
	// Handles 'off' commands from the SmartThings app or others
    
    // Update the stored state
    state.level = 0 // Set level to 0
    state.OnOff = 0 // Set to off
    
    // Send events to report set level and switch off
    sendEvent(name: "switch", value: "off")
    sendEvent(name: "level", value: 0)
}

def setLevel(int lev) {
	log.debug "Executing 'setLevel' $lev"
	// Handles 'setLevel' commands from the SmartThings app or others
    
    // If the level has changed
    if (lev != state.level) {
        if (lev == 0) {
        	// If 0 switch off
        	
            // Update the stored state
            state.level = lev
            state.OnOff = 0
            
            // Send events for the updates
            sendEvent(name: "switch", value: "off")
            sendEvent(name: "level", value: 0)
        } else {
        	// Set the stored level
            state.level = lev
            
            // If above 100 set to 100
            if (state.level > 100) {
            	state.level = 100
            }
            
            // If the switch is off turn it on
            if (state.OnOff == 0) {
            	state.OnOff = 1 // Update stored state to on
                sendEvent(name: "switch", value: "on")
            }
            
            // Send event to set the level (needed?)
            sendEvent(name: "level", value: state.level)
        }
    }
}
8 Likes

Very cool I may have to get one to try out.

Hey, this looks awesome! I would if I could tweak the code to use this as a scene controller


Hello,
If you can find a sample of how a scene controller sends messages back to the hub I’m pretty sure you could do it.
For example, in the handlers for the fast turn events you could trigger a message to change scenes rather than increase/decrease the brightness by a fixed %.
I keep meaning to come back and update this code, but no time to do it right now. Now the brightness of the linked lights only changes after you stop turning the dimmer, it would be good to find a way to change brightness at the same time.
Let me know if you get anywhere with it!
Kris.

Hi,
I have paired Ikea wireless dimmer to my ST, added your provided device handler, but unfortunately my dimmer do not do anything when I turning it :frowning: I tried to uncomment all logs in your code, but it doesn’t print anything when I turning dimmer wheel to left and right.
Only when I try to unpair device from my ST via Smart Things app I get this output in the log:
14e32e4d-2086-4616-9c8a-0d35777556c7 10:20:36 PM: debug [raw:0000 8034 00 00 0040 00 8B3C 00 00 0000 00 00 2A00, profileId:0000, clusterId:8034, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:8B3C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[2A, 00], clusterInt:32820, commandInt:0]
14e32e4d-2086-4616-9c8a-0d35777556c7 10:20:36 PM: debug Other Catch all: 'catchall: 0000 8034 00 00 0040 00 8B3C 00 00 0000 00 00 2A00’
14e32e4d-2086-4616-9c8a-0d35777556c7 10:20:36 PM: debug [raw:0000 8034 00 00 0040 00 8B3C 00 00 0000 00 00 2A00, profileId:0000, clusterId:8034, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:8B3C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[2A, 00], clusterInt:32820, commandInt:0]
14e32e4d-2086-4616-9c8a-0d35777556c7 10:20:36 PM: debug Catch all: catchall: 0000 8034 00 00 0040 00 8B3C 00 00 0000 00 00 2A00
14e32e4d-2086-4616-9c8a-0d35777556c7 10:20:36 PM: debug Parsing ‘catchall: 0000 8034 00 00 0040 00 8B3C 00 00 0000 00 00 2A00’

Did you know what I am doing wrong?

Hello,
The device seems to have a different fingerprint to mine and the event number is different. It may be a stupid question but are you sure you applied the handler to the right device?
You could watch the Events list for the hub while you add the dimmer to see if the fingerprint is really different, if it is then the handler may need to be updated.

It could be that there is a new hardware/software version of the dimmer, I know Ikea have updated their bulbs to work with Hue. If you could add the dimmer again, assign the handler then send me the output of the event log as you turn the dimmer clockwise/anticlockwise I could try to update the handler to recognise it.
Cheers, Kris

Hi Kris,

Yes I am sure that I have assigned handler to the right device.

Please check this log of hub when I pair device:

zbjoin: {“dni”:“0EED”,“d”:“000B57FFFE24C433”,“capabilities”:“80”,“endpoints”:[{“simple”:“01 0104 0810 02 06 0000 0001 0003 0009 0B05 1000 06 0003 0004 0006 0008 0019 1000”,“application”:“11”,“manufacturer”:“IKEA of Sweden”,“model”:“TRADFRI wireless dimmer”}],“parent”:“FFFF”,“joinType”:255}

archivable true
date 2017-08-23 11:26:33.324 PM EEST (2017-08-23T20:26:33.324Z)
description zbjoin: {“dni”:“0EED”,“d”:“000B57FFFE24C433”,“capabilities”:“80”,“endpoints”:[{“simple”:“01 0104 0810 02 06 0000 0001 0003 0009 0B05 1000 06 0003 0004 0006 0008 0019 1000”,“application”:“11”,“manufacturer”:“IKEA of Sweden”,“model”:“TRADFRI wireless dimmer”}],“parent”:“FFFF”,“joinType”:255}
displayed false
eventSource HUB
hubId 625c8100-6a57-4a99-8d84-b95b80ef1660
id 5aa712c0-8841-11e7-a4ab-121553a04b24
isStateChange false
isVirtualHub false
linkText Home Hub
locationId 31fe5181-3df6-439d-9a96-679cb01c23e1
name zbjoin: {“dni”:“0EED”,“d”:“000B57FFFE24C433”,“capabilities”:“80”,“endpoints”:[{“simple”:"01 0104 081
rawDescription zbjoin: {“dni”:“0EED”,“d”:“000B57FFFE24C433”,“capabilities”:“80”,“endpoints”:[{“simple”:“01 0104 0810 02 06 0000 0001 0003 0009 0B05 1000 06 0003 0004 0006 0008 0019 1000”,“application”:“11”,“manufacturer”:“IKEA of Sweden”,“model”:“TRADFRI wireless dimmer”}],“parent”:“FFFF”,“joinType”:255}
translatable false
unixTime 1503519993324
value zbjoin: {“dni”:“0EED”,“d”:“000B57FFFE24C433”,“capabilities”:“80”,“endpoints”:[{“simple”:“01 0104 0810 02 06 0000 0001 0003 0009 0B05 1000 06 0003 0004 0006 0008 0019 1000”,“application”:“11”,“manufacturer”:“IKEA of Sweden”,“model”:“TRADFRI wireless dimmer”}],“parent”:“FFFF”,“joinType”:255}
viewed false

When I turn the dimmer clockwise/anticlockwise I don’t see any changes in log.

Hi Kristian,

Did you checked my log? Maybe you need more info?

Hello!

I have the exact same problem as Edvardas.

In the DH the fingerprint is
fingerprint endpointId: “01”, profileId: “0104”, deviceId: “0810”, deviceVersion: “02”, inClusters: “0000, 0001, 0003, 0009, 0B05, 1000”, outClusters: “0003, 0004, 0006, 0008, 0019, 1000”

But our devices also have a 06 in the fingerprint. Can this be an issue?

SmartThings identifies the dimmer as Tradfri Dimmer v0.1 automatically.

Hello,
Sorry I’m not really sure how to solve this
 the 06 in the fingerprint just identifies the start of the clusters, mine looks like this as well and works fine:

01 0104 0810 02 06 0000 0001 0003 0009 0B05 1000 06 0003 0004 0006 0008 0019 1000

It looks the same to me. I can only guess that Ikea have updated something in their software so the responses from the dimmer are different.

You could uncomment the logging line shown below in the DH and see what events are reported by checking the “Live Logging” from your hub:

// parse events into attributes
def parse(String description) {
	log.debug "Parsing '${description}'"

If you can spot any patterns to the events you can either send me the details and I’ll try to put them into the event handler, or have a go updating yourself and post here.

I got this handler working by trial and error, my dimmer reports the following events:

  • Start turning slowly clockwise
  • Start turning slowly anticlockwise
  • Stop turning
  • Fast turn clockwise
  • Fast turn anticlockwise

If you can identify the events for these we can update easily.
Cheers!

The problem is that the live logging reports nothing at all from the device. It shows up as a new device and then nothing more happens. I have uncommented every log line in your DH.

I have tried to re add the device 20+ times now, but no difference.

Some screenshots of the device:

Device info after added:

From the event log:

There are no events at all from the created device:

I can provide more info if you tell me what to look for. :slight_smile:

Sometimes when I try to add the dimmer in the app, I get this message “An error occurred while searching for devices.” This happens when I press and hold the button on the dimmer close to the hub.

Update:
These events shows up after the device is added when I rotate the dimmer. Seems like it’s not fully included?

Update 2:
Finally got something in the log when pressing the pairing button on the dimmer.

Tried some more this morning, but nothing new. Do you have any idea @kristian.andrews ?
It seems like the dimmer doesn’t get fully included in the pairing process. How did you pair it? :slight_smile:

Today I bought another dimmer, just to try if there was difference, but no go. Exactly the same issue.
I personally have no clue how to proceed. :slightly_frowning_face:

Hello,
I paired the bulb and dimmer by resetting first then pairing one at a time. It sounds like you have paired the bulb OK, all I did for the dimmer was to reset it by pressing the pairing button 4 times in 5 seconds as these instructions:
http://www.ikea.com/gb/en/customer-service/smart-lighting-support/troubleshooting/

Then put it on top of the ST Hub, started to search for new Things and pressed the pairing button. After this it was detected as a new Thing and I could assign the device handler.
I remember I had to make sure not to try pairing the bulb and the dimmer at the same time, I think they can only pair with one other device so if the dimmer paired with the bulb then it would disconnect from the Hub.
Is your dimmer changing the bulb brightness but not showing in ST?
Sorry I can’t be more help
 I’m not exactly an expert on ST, just tried my hand at writing a device handler. It has had a few likes so I can only assume it is working for at least a few people except me!

Thank you for your reply!

Since I even tried with a new separate dimmer puck it’s most definitly not paired to any bulb. I use the same method reseting and pairing the dimmer to the ST hub. The hub finds it as a thing and adds it, but after applying the DH nothing more happens. No updates at all in the app or ST log when turning the dimmer.

Hello, I think I will have to go buy a new dimmer and try it out


I followed the info in the page below on creating a device handler:
http://docs.smartthings.com/en/latest/device-type-developers-guide/parse.html

According to this the only way to receive an event from the device is through the Parse() method, so my DH should capture everything. They suggest to log all the output to help understand what events to handle, this is what you already tried, but if your device isn’t reporting anything then I’m a bit stuck.

Maybe Ikea have updated their firmware so it works in some other way now. It is possible it might need to register with the device to receive updates as shown here:
http://docs.smartthings.com/en/latest/device-type-developers-guide/building-zigbee-device-handlers.html

Next time I go to Ikea I will pick up a new set and see if I can get it to work.

Are you planning to use the dimmer for lights or some other use?

By the way, you can see my device info looks little different, it had picked up the level and state from the DH. If you click “Check Now” on the Firmware does it come up with anything?

Just in case there is some typo in the code I have included in my first post I have just exported the code from ST and pasted here:

/**
 *  Tradfri Dimmer v0.1
 *
 *  Copyright 2017 Kristian Andrews
 *
 *  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.
 *
 *  In this handler the following actions are recognised
 *    turning clockwise slowly increased the level, the amount is determined by the time turning
 *    turning clockwise fast increased the level by 50
 *    turning anticlockwise slowly decreases the level, the amount is determined by the time turning
 *    turning anticlockwise fast decreases the level by 50
 *
 *  There are several reported actions that I can't decipher
 *    
 *  When the level reaches 0 the switch is turned off, any level above 0 the switch is on
 *  
 *  Can be used to control lights by the use of a SmartApp such as Synchronised Dimming
 *
 *  To do:
 *  1) Debug why the light flashes when I turn off, maybe I don't need to report events for the ones that are set or the commands should be reversed?
 *  e.g. when Off is set from the app GUI do I need to send an Off event as well?
 *  2) Update so that a fast turn clockwise/anticlockwise can turn the lights on and off but maintain the set level
 */
metadata {
	definition (name: "Tradfri Dimmer v0.1", namespace: "andrews.k", author: "Kristian Andrews") {
		capability "Sensor"
		capability "Switch"
		capability "Switch Level"

		fingerprint endpointId: "01", profileId: "0104", deviceId: "0810", deviceVersion: "02", inClusters: "0000, 0001, 0003, 0009, 0B05, 1000", outClusters: "0003, 0004, 0006, 0008, 0019, 1000"
	}


	simulator {
		// TODO: define status and reply messages here
	}
    
    // UI tile definitions
    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"
            }
        }

        standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
        }

        main(["switch"])
        details(["switch", "refresh"])
    }
    
}

// parse events into attributes
def parse(String description) {
	log.debug "Parsing '${description}'"
	// TODO: handle 'switch' attribute
	// TODO: handle 'level' attribute
	def name = null
    def value = null
    def name2 = null
    def value2 = null
    
    // Check if the stored variables are initialised
    if (state.level == null) {
    	state.level = 100
    }
    
    if (state.OnOff == null) {
    	state.OnOff = 1
    }
    
    if (state.start == null) {
    	state.start = now()
    }
    
    if (state.clockwise == null) {
    	state.clockwise = 0
    }
    
    if (description?.startsWith("catchall:")) {
    	//def descMap = zigbee.parseDescriptionAsMap(description)
        
        //log.debug "Catch all: $description"
        //log.debug zigbee.parseDescriptionAsMap(description)
        
        // Responds to Zigbee events sent by the dimmer
        // Probably not the most elegant solution
        if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 05 00 00C3") {
        	// Start Turn clockwise
            log.debug "cw"
            
            // Store when the turning started and the direction
            state.start = now()
            state.clockwise = 1
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 01 00 01C3") {
        	// Start turn anticlockwise
            log.debug "acw"
            
            // Store when the turning started and the direction
            state.start = now()
            state.clockwise = -1
        } else if (description == "catchall: 0104 0008 01 01 0140 00 D035 01 00 0000 07 00 ") {
        	// Stop turning
            log.debug "Stop"
            
            // Calculate duration of turn
            def turnTime = now() - state.start
            //log.debug "Turn ms: $turnTime"
            
            // If the turn is too long ignore it, it probably came from a missed event
            if (turnTime > 2500) {
            	turnTime = 0
            }
            
            // How much change to the level
            // 2000 ms = full up or down
            int change = turnTime / 20
            
            //log.debug change
            
            if (state.clockwise == 1) {
            	// If clockwise, increase the level and turn on
            	
                // Update the stored state
                state.level = state.level + change
                
                // If above 100 reset to 100
                if (state.level > 100){
                	state.level = 100
                }
                
                // Create the ST event details
                name = "level"
                value = state.level
                
                // Turn on switch if off
                if (state.OnOff == 0){
                	// Create the ST event details
                	name2 = "switch"
                	value2 = "on"
                    
                    // Update the stored state
                    state.OnOff = 1
                }
                
                // Set state to not turning
                state.clockwise = 0
            } else if (state.clockwise == -1){
            	// If anticlockwise, decrease the level
                
                // Reduce the stored level
                state.level = state.level - change
                
                // If below 0 reset to 0
                if (state.level < 0){
                	// Make sure it doesn't go below 0
                	state.level = 0
                }
                
                // Create the ST event details
                name = "level"
                value = state.level
                
                // If level = 0 then turn off switch
                if (state.level == 0) {
                	// Update stored state
                	state.OnOff = 0
                    
                    // Create ST event details
                    name2 = "switch"
                    value2 = "off"
                }
                
                // Set state to not turning
                state.clockwise = 0
            }
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 000100") {
        	// Fast turn anti-clockwise
            log.debug "fast acw"
            
            // turn down level by 50
            state.level = state.level - 50
            
            // If below 0 reset to 0
            if (state.level < 0){
            	state.level = 0
            }
            
            // Create ST event details
            name = "level"
            value = state.level
            
            // if reached 0 turn off switch
            if (state.level == 0) {
            	if (state.OnOff == 1) {
	            	state.OnOff = 0
    	            name2 = "switch"
        	        value2 = "off"
                }
            }
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 FF0100") {
        	// Fast turn clockwise
            log.debug "fast cw"
            
            // turn up level by 50
            state.level = state.level + 50
            
            // make sure it doesn't go above 100
            if (state.level > 100) {
            	state.level = 100
            }
            
            name = "level"
            value = state.level
            
            if (state.OnOff == 0) {
            	state.OnOff = 1
            	name2 = "switch"
            	value2 = "on"
            }
            
        } else if (description == "catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 07 00 ") {
        	// Unknown reply - appears after most turns
            //log.debug "Unknown catchall 1"
        } else {
            // log.debug "Other Catch all: '$description'"
            // The output I have seen so far from the dimmer
            // catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 000100 - fast turn anti-clockwise
            // catchall: 0104 0008 01 01 0140 00 D035 01 00 0000 04 00 000100 - different type of fast turn anti-clockwise?
            // catchall: 0104 0008 01 01 0100 00 D035 01 00 0000 04 00 FF0100 - fast turn clockwise
            // catchall: 0104 0008 01 01 0140 00 D035 01 00 0000 04 00 FF0100 - different type of fast turn clockwise?
            
            //def descMap = zigbee.parseDescriptionAsMap(description)
        	//log.debug zigbee.parseDescriptionAsMap(description)
        }
    } else {
    	// log.debug "Not catch all: $description"
    }
    
    // createEvent returns a Map that defines an Event
    def result = createEvent(name: name, value: value)
    def result2 = createEvent(name: name2, value: value2)
    
    // If there is any result log it
    if (name != null) {
		log.debug "Result 1: ${result?.descriptionText}"
    }
    if (name2 != null) {
    	log.debug "Result 2: ${result2?.descriptionText}"
	}
    
    // returning the Event definition map creates an Event
    // in the SmartThings platform, and propagates it to
    // SmartApps subscribed to the device events.
    return [result, result2]
}

// handle commands
def on() {
	log.debug "Executing 'on'"
	// Handles 'on' commands from the SmartThings app or others
    
    // if switched off, turn on and set level to 50
    state.level = 50
    state.OnOff = 1
    
    // Send switch on and level events
    sendEvent(name: "switch", value: "on")
    sendEvent(name: "level", value: 50)
}

def off() {
	log.debug "Executing 'off'"
	// Handles 'off' commands from the SmartThings app or others
    
    // Update the stored state
    state.level = 0 // Set level to 0
    state.OnOff = 0 // Set to off
    
    // Send events to report set level and switch off
    sendEvent(name: "switch", value: "off")
    sendEvent(name: "level", value: 0)
}

def setLevel(int lev) {
	log.debug "Executing 'setLevel' $lev"
	// Handles 'setLevel' commands from the SmartThings app or others
    
    // If the level has changed
    if (lev != state.level) {
        if (lev == 0) {
        	// If 0 switch off
        	
            // Update the stored state
            state.level = lev
            state.OnOff = 0
            
            // Send events for the updates
            sendEvent(name: "switch", value: "off")
            sendEvent(name: "level", value: 0)
        } else {
        	// Set the stored level
            state.level = lev
            
            // If above 100 set to 100
            if (state.level > 100) {
            	state.level = 100
            }
            
            // If the switch is off turn it on
            if (state.OnOff == 0) {
            	state.OnOff = 1 // Update stored state to on
                sendEvent(name: "switch", value: "on")
            }
            
            // Send event to set the level (needed?)
            sendEvent(name: "level", value: state.level)
        }
    }
}

Not sure it it will help but please give it a try!

Hi!

I plan on using it (them) with lights.

I have the same firmware on my dimmers. Still no go for me. They pair really easy, but no state updates when I turn the wheel.

Just to be sure, everyone who is posting in this thread that they have problems has either a UK hub or the V2 version of the US hub? No V1 US hubs?