Hi all,
I’ve spent quite a bit of time trying looking into the settings page of a device handler I’ve been working on, mainly trying to work out if I can get the settings to update based on configuration parameter values received from events.
I first noticed that, when editing the settings on the classic app, the settings did not update in the new app and I was trying to fix this. I now see that the new app is not actually making the setting change at all, even if set directly on the settings page.
So, two issues really.
- Mismatched settings between apps
- New app not sending correct parameter value
This is the code for one of the settings.
//Settings Page
preferences {
//parameter 1
input “LCDinvert”, “enum”, title: “Invert LCD”, options: [“No”, “Yes”], required: false, displayDuringSetup: true
//configure method
def configure() {
zwave.configurationV1.configurationSet(configurationValue: LCDinvert == “Yes” ? [0x01] : [0x00], parameterNumber:1, size:1, scaledConfigurationValue: LCDinvert == “Yes” ? 0x01 : 0x00)
}
//This is what the classic app sends when “Yes” is selected
14:54:21: debug [ConfigurationSet(parameterNumber: 1, scaledConfigurationValue: 1, reserved11: 0, defaultValue: false, size: 1, configurationValue: [1])
//This is what the new app sends
14:54:21: debug [ConfigurationSet(parameterNumber: 1, scaledConfigurationValue: 0, reserved11: 0, defaultValue: false, size: 1, configurationValue: [0])
If I debug the setting when setting from the classic app I see this
//debug classic
log.debug “$LCDinvert”
16:02:06: debug Yes
//debug from new app
log.debug “$LCDinvert”
16:05:50: debug 1
So I can see the parameter value is different depended on which app it was set in.
At this point I’m at a loss. Could this be the way that the parameter options are being handled? Do I need to use maps, i.e.
//suggested code?
def LCDinvertOptions = [:]
LCDinvertOptions << [“0” : “No”] // 0x00
LCDinvertOptions << [“1” : “Yes”] // 0x01
preferences {
//parameter 1
input “LCDinvert”, “enum”, title: “Invert LCD”, options: LCDinvertOptions, required: false, displayDuringSetup: true
I was trying to get this working
setting[LCDinvert] = “Yes”
as I’ve read in several posts that this should change the UI, unless I’ve misunderstood.
Any help, greatly appreciated.