[OBSOLETE] OSRAM Lightify Smart Dimmer Switch (button controller device handler and smart app)

I just embarked in a similar project, but changed the device type into a dimmer switch that responds to on, off and level commards directly without having a smartapp. You do need to use a smart app to actually have the switch control something. I’m using with Dim with Me to control three smartbulbs in a hanging light fixture.
I was trying, without success, to have a similar process where holding the button would continually increase/decrease the level until you let go. I tried using runIn, which didn’t have any delay in device type. With further testing, I don’t believe my process would have worked as I was using a state variable to determine if the button was released, but I don’t think the state variable will ever get the value change in the current event from a subsequent event. (either that or my code sucked).

Also, I opted for increasing/decreasing by 20, as that seems to be a sufficient difference in level without have a lot of button presses. Also, because the device is a dimmer switch, you can set the level via the smartthings app or smarttiles.

The device type is here: