Bug in default device handler "Fibaro Dimmer 2 ZW5"

I recently discovered that Alexa cannot dim my Fibaro Dimmer 2- it can only turn it on and off. I tried the community created device handler and it stopped working entirely, so I went back to the one that was selected by default for me and after enabling logging, I discovered this when I attempt to set the level with Alexa:

groovy.lang.MissingMethodException: No signature of method: script_dth_e32b16c64331aa2024a7c50f91a0b7a54f6e02ac09dd8eaa2a15c267600d840c.setLevel() is applicable for argument types: (java.lang.Float) values: [50.0]
Possible solutions: setLevel(java.lang.Integer), setLevel(java.lang.Integer, java.lang.Integer), setDevice(java.lang.Object), setLog(java.lang.Object), setLogger(java.lang.Object), setTiles(java.util.Map) @line 2028 (setPercentageCommand)

The Alexa integration is sending in a floating point value and there is no setValue() defined for Floats. Is there somewhere I can find the groovy source for the “Fibaro Dimmer 2 ZW5” version of the device handler? (the other better one made by the community was not working for me) I’d just like to patch it to see if I can get dimming working with Alexa.

I’m happy to say I found the github repo with the device handler, cloned it and pulled it into the IDE and added a setLevel(Float) and it seems to solve the compatibility issue with Amazon Echo/Alexa. It now properly dims by voice command. (I’m new to SmartThings, but not to software development)

I’d submit my modification back as a pull request, but I now notice a warning in the log:

postEventToEndpoint: Error while trying to post event back to Amazon groovyx.net.http.ResponseParseException: Accepted

I presume this is related to the Float vs Integer value for the dimming level. It still appears to work, but I don’t know the implications of that webhook failing and its not in the device handler code.


For those interested, the modification to the Fibaro Dimmer 2 ZW5 device handler in the official github is to just remove the types (Integer) from the setLevel() function parameters. Without them, it will take any type, including Float. The other handlers do this and it seems to be the expected standard. I searched through the github repo and none of the other device handlers set a type on the arguments to the function. Generally, its good to specify the type of your arguments, unless you handle multiple types (like Floating point and Integer). So the authors of the Fibaro handler were following best practice and it probably worked in most cases.