Input Type Behavior Not Matching Documentation

I’ve noticed that some of the input types for smartApp preferences don’t match the documentation. For example the password type is not masked/obscured as stated in the documentation. Is this a known issue or is a fix planned in the near future?

http://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html (the table listing the types is towards the end of the page)

Hi Kyle,

I didn’t double check with any code, but this seems to be a previously noted issue here:

Perhaps @Jim (documentation guy) will put this on this todo list as at least a “documentation footnote”, until a bugfix gets into the queue.

…CP / Terry.

@Jim, please check the documentation about “inputs”.
http://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html#input

In particular, boolean type input stores values as strings "true" and "false".

From my observation, bool stores values as actual true and false.

Thanks

1 Like

Perhaps it’s the lack of coffee this morning, or the long holiday weekend… but I don’t see a reference in that page to bool’s being stored as strings…

We can certainly update that input elem type to be more clear about the value being returned as a boolean, just don’t want to miss your original point…

@Jim, let me give you two examples.

This example is according to the docs and preference is set to “OFF” in a SmartApp.

input "pref1", "boolean", title: "abc"

Then the following lines

log.debug "is pref1 false? -> ${settings.pref1 == false}"
log.debug "is pref1 "false"? -> ${settings.pref1 == 'false'}"

produce

is pref1 false? -> false
is pref1 "false"? -> true


If I use “bool” rather than “boolean” as a preference type:

input "pref2", "bool", title: "abc"

Then the following lines

log.debug "is pref2 false? -> ${settings.pref2 == false}"
log.debug "is pref2 "false"? -> ${settings.pref2 == 'false'}"

produce

is pref2 false? -> true
is pref2 "false"? -> false


Input type boolean stores values as strings true and false, which contradicts the documentation.

1 Like

Ah… I see what you’re saying now. You are correct, and the bool type wasn’t doc’d before.

Check out the input element docs now - you should see bool there, along with clarifications about boolean.

Long story short - use bool - it gives you a boolean value back (which is generally preferred), and works consistently in the simulator and mobile clients.

Apologies for the confusion, thanks for pointing it out.

1 Like

Perfect, thank you! :thumbsup:

Glad to find this thread. Very disturbing!! I wasted hours today on this issue!!!
And, that doc page does NOT help as searching for “boolean” all day long will NOT find that!
try it - search for boolean and try to see if that pops up glaringly to help…
Any idea why this change?

1 Like