This is a device type handler for the Hue Dimmer Switch using its ZHA based endpoint
List item
Update Jan 18 2017
Remove unneeded configure button (was for testing)
Added numberOfButtons event to make this device work correctly in CoRE (I think this will only work for newly added devices)
Update Nov 13 2016 - Fixed pairing with SmartThings, will no longer pair as Thing/Unknown (I am an idiot and had the fingerprint backwards) ST Now shows the correct ZHA fingerprint for the device.
The Good
Supports Press and Held States on all 4 buttons.
Actually reports 4 states, PRESS, HOLDING, RELEASE, RELEASE AFTER HELD, only the last 2 are mapped to events at the moment. (I dont think the other 2 have smartthings analogues)
The device even reports how long the button was held though there doesn’t seem to be a good way to expose this in smart things.
Uses Zigbee Home Automation Clusters instead of Light Link (no pretending to be a bulb)
Reads Battery Status (un-calibrated)
The Bad
So far unknown if it solves the dropping off the network issue
Code is really really greasy (I am working on it heavily still, I have just struggled with these switches for so long I wanted to end the suffering… hopefully)
Credit to @Sticks18 for getting us started with his ZLL base Device Type
Okay, I connected the hue dimmer in the morning, when I came home from work in the evening, clicking on a button shows the red light instead of green and smartthings no longer sees the button presses.
Now that I have a replacement hub and am back online, I have had the time to incorporate this change into my git repo. Newly added devices with the latest handler now work properly with CoRE. I also removed the useless configure button.
I’ve got button 1 and button 4 working for on and off, but haven’t yet found the right action combination to get button 2 and 3 working to dim/raise.
Watching this thread with great interest. How far off general release do you think it is? I’m trying to avoid installing anything beta or alpha, because of the way my wife looks at me when things go wrong. Lol
I’ve installed this with a spare Hue Dimmer I had, to test control of a Fibaro Dimmer. Is it possible to program (via CoRE) an action based on a double click?
if ( buttonState == 1 ) {
result = createEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button has been held for " + buttonHoldTime + "ms", isStateChange: true)
sendEvent(name: "lastAction", value: button + " held")
}
and now it’s creating the event while the button is being held, and not when a held button has been released.
I realise that as a button that’s not ideal, but as a dimmer, it is perfect for me. Perhaps a cleaner way would be to allow configuration in the device settings to say that holding button x acts is a dimmer or as a button.
Also, if it were possible to configure actions within the DH, it would certainly speed up the button transactions, instead of having to rely on CoRE.