I am working on a device handler for a Leviton DZ6HD dimmer, with a configure() method, because the default handler doesn’t have most of the configurable preferences in it, and when it turns on the dimmer, it always turns it ALL the way on, instead of to the last dimmer setting.
I got my handler started, and installed and it is working at a basic level. However, none of my own configuration settings worked, but then I noticed ONE other setting, done in a different method that was invoked before my configure() method DID work. So I changed one of mine to use the same structure, and that now works. The question is WHY.
Basically, I found that calls to zwave.configurationV1.configurationSet() did nothing UNLESS I encapsulated it in a sendHubCommand.
Specifically, this did NOT work:
zwave.configurationV1.configurationSet(configurationValue: [(fadeOnTime != null) ? fadeOnTime : 2], parameterNumber: 1, size: 1).format()
My logs showed that this line was being invoked, but it didn’t DO anything (and the delayBetween([…],delayvalue) didn’t delay, either.
But the following DOES work - I had spotted this usage in the dimmer code from SmartThings that I downloaded, and copied the concept into my code.
configurationValue: [(fadeOnTime != null) ? fadeOnTime : 2], parameterNumber: 1, size: 1).format()))
The API documentation is sufficiently obtuse that it is not at all obvious WHY - and the zWave examples don’t use sendHubCommand.
So, what is going on?
(PS: the ?: stuff does need to be translated into the “Elvis” operator - I know. I have been programming in “C” since about 1976. Frankly, it is too bad it has to be there at all - too bad the defaultValue in the preferences doesn’t seem to actually used anywhere or accessible - hence the hardcoded default value. ).