Help with modified device type, dimmer and VALUE_CONTROL


#1

I am working on a modified device type for a GE in wall dimmer. I have added a row of buttons with up and down arrows and a display tile as well as a row of preset levels. I would like to condense this even further and possibly use the multi-tile attribute VALUE_CONTROL however, the buttons only seem to send a boolean value.

https://github.com/awelch02/MySmartThings/blob/master/device-types/dimmer-condensed.groovy


(Scott G) #2

In my testing the buttons increment/decrement their attribute by one and sends that value to the action command. In your code, it should be triggering your setLevel command with the currentValue +/- 1. Are you using Android or iOS? I know these arrows didn’t work on Android. Not sure if it was fixed.

If you want to use the Value Control arrows with your levelUp and levelDown commands, you’ll want to add a new command and attribute to use with them like:

attribute “arrowLevel”, "number"
command “arrowControl”

def arrowControl(value) {
sendEvent(name: “arrowLevel”, value: 0, displayed: false)
(value > 0) ? levelUp() : levelDown()
}


#3

Sticks, thank you for your replay and in pointing me to the right direction. I have added the desired functionality, and will be updating the github today once I figure out how groovy likes to deal with integer arrays for the presets. Also, it would be nice if we could set a defined scale for button size with the VALUE_CONTROL, but that is obviously out of our control.


(Scott G) #4

I expect - or at least hope - that enhancement is coming, similar to the custom range for slider controls. It might even exist and just isn’t documented yet.


(Michael Stroh) #5

Great Device Handler!

The only thing missing is the Indicator Status for the led. In the stock Dimmer Switch handler you can toggle the LED from off, on when on, on when off. The Condensed Dimmer w/ preset has the tile but it is not functional. The Condensed Dimmer device handler in the IDE also does not show the “indicatorStatus:” so I believe that capability might have been left out? Can you add that in?