Help me understand driver input fields and preference settings

My driver has 3 input fields: ip address, port and credentials. In my updated method, I trim spaces before I validate further by first pinging and then connecting in order to validate the credentials. So I do this:
deviceIP = deviceIP.trim()
And everything works fine. If I don't do that, my validation will fail if the user accidentally leaves a space at the end. Problem is, the trimmed value is not what gets saved, which triggers errors in all of my other commands because they don't trim the values values before using them (now they do). I tried using this in my update method but this got flagged as "method not supported by device".
I'm so confused about how these input settings work and how and when they get saved. Thanks...

Try this

device.updateSetting("deviceIP", [value:"${deviceIP.trim()}", type:"string"])

Thanks, that works. I wish the doc had more examples. I'm all new to HE and groovy and just now beginning to understand the structures of these methods. The more examples I see, the more I learn. Thanks again for jumping in so quick.

1 Like