On/off/set level Modifying published DTH

Hello Samsung team and community,

I have a few questions in regards of Z-Wave DTH implementation. Lets assume I want to integrate a Z-wave device.

Device number 1 is ZDI5200 Z-Wave dimmer with meter.

As I see the situation the most straight forward way would be to use one of the published DTH.


The DTH mentioned above fits perfectly, Added the device fingerprint and isLogicGroupZDI5200() function in the same manner as Aeotec did.
Paired device with smartthings – everything is as expected = Device connected successfully the right version of DTH is used (The one which is self published).
Unfortunately it was noticed that dimmer value cannot be set properly. It is then discovered that on(),off(),setLevel() functions use basicSet command, and there is a bug in our ZDI5200 firmware and basice set (0-99) are not mapped as multilevel switch set command. (basically cannot set any value except 00 , FF with basic set command).
This will of course will be fixed in our next FW release. But there is a number of devices sold already and since you cannot make an OTA update through SmartThings Hub, it would be nice to make a small “fix” for these products. For instance if it is this product, send switchMultilevelSet instead of basicSet.
So the following modification was made.
def setLevel(level, rate = null) {

if(level > 99) level = 99

If isLogicGroupZDI5200()
{
encapSequence([

zwave. switchMultilevelV1.switchMultilevelSet(value: level),

zwave.switchMultilevelV1.switchMultilevelGet()

], 5000)

}
Else
{
encapSequence([

zwave.basicV1.basicSet(value: level),

zwave.switchMultilevelV1.switchMultilevelGet()

], 5000)

}
}

It is further noticed that these modification has no effect, still BASIC SET is being send.

To be sure that the latest DTH code is running I have placed some debug messages in different functions, for example log.debug “refresh()v5” inside the refresh() function. And I do see this being printed in the debug window.
But when it comes to on(),off(),setLevel() functions , any modification I do in these functions have no effect. As if these functions are never called, no debug messages printed when being called. Even if these functions are completely removed from DTH , it works as before.

So I would like to ask if I am doing something wrong? Or is there a problem where capabilities “defined” functions are not overridden ?

Similar situation occurs when I try to use https://github.com/SmartThingsCommunity/SmartThingsPublic/blob/master/devicetypes/smartthings/zwave-multi-button.src/zwave-multi-button.groovy
I want to add ZBA7140 Z-Wave device.
Adding fingerprint works fine fingerprint mfr: “0234”, prod: “0004”, model: “0129”, deviceJoinName: “Logic Group MATRIX ZBA7140”, mnmn: “SmartThings”, vid: “generic-4-button”

private isLogicGroup() {
zwaveInfo.mfr?.contains(“0234”)
}

private getEventsMap() {
def map =[
0: “pushed”,
1: “held”,
2: “down_hold”,
3: “double”,
4: “pushed_3x”
]
if (isLogicGroup()) map=[
0: “pushed”,
1: “held”,
2: “released”,
3: “double”,
4: “pushed_3x”
]
return map
}

private getSupportedButtonValues() {
def values = [“pushed”, “held”]
if (isFibaro()) values += [“double”, “down_hold”, “pushed_3x”]
if (isLogicGroup()) values += [“released”, “double”, “pushed_3x”]

return values

}

Adding isLogicGroup() function and slightly modifying getSupportedButtonValues, getEventsMap functions , has no effect. I never get the “released” event.

Would be great if you could help with these issues I am experiencing.

I don’t know if it is still necessary, but I’d be tempted to remove

, runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: true, genericHandler: "Z-Wave"

from the definition(). Once upon a time custom handlers couldn’t be created if they specified running locally but a change was made which meant they could, but what they were actually running locally on the hub was generic code. Or something like that. I’ll defer to someone who knows what they are talking about as it was always a bit of a head scratcher.

Hello orangebucket!
Thanks a lot !
Indeed, that actually helped. on/off/setlevel/ are overridden now!
(Have actually tried removing them before,but without any effect… maybe havent updated/published DTH properly…)

The question now is :
Assuming I want to publish/commit/release this “FIX” for end users i need to remove , runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: true, genericHandler: "Z-Wave" from the definition(). These leaves me in a situation where it influences the origininal implementation, thus i have to make 98% copy/paste of that DTH to a new one just for the device in question ? ?

Below are the only things i need to add:
fingerprint mfr:“0234”, prod:“0003”, model:“0123”, deviceJoinName: “Logic Group DIMMY ZDI5200”

def setLevel(level, rate = null) {
if(level > 99) level = 99
log.debug “setLevel() called”
if (isLogicGroupZDI5200())
{
encapSequence([
zwave.switchMultilevelV1.switchMultilevelSet(value: level),
zwave.switchMultilevelV1.switchMultilevelGet()
], 5000)
}
else
{
encapSequence([
zwave.basicV1.basicSet(value: level),
zwave.switchMultilevelV1.switchMultilevelGet()
], 5000)
}
}

private isLogicGroupZDI5200() {
zwaveInfo?.mfr?.equals(“0234”) && zwaveInfo?.model?.equals(“0123”)
}