When using "mode" input, all but the first option display numbers and return "null"

I’m new to SmartThings, groovy, and smart apps, and I’m trying to create an app that sets a user-defined mode under certain conditions. But I’m having some trouble with the input.

In the simulator it looks like I can select any of my four modes…

…and if I select the first option it looks great and I can use the value in the app.

But if I select any of my other modes…

…it displays numbers 1-3, and when I try to use my selection in the app I just get “null”.

I made a new smart app with the sole purpose of testing this out, and it still didn’t work. I’ve made it a required field, I’ve tried allowing multiple selections… still no luck. Anybody got any ideas?

Thanks!

I hadn’t tried that, and it looks like it works for real just not in the simulator. That’s good to know! Still though, it kinda limits my ability to quickly test edits to my apps.

Here’s the code I made to test it… I just changed the mode while initializing to simplify things and make sure I wasn’t messing up somewhere else. This works fine when actually installed, but still has the problem I described above in the simulator.

preferences {
	section("Title") {
		input "testMode", "mode", title: "Choose the mode"
	}
}
...
def initialize() {
    log.debug location.mode
    log.debug testMode
    location.setMode(testMode)
}

Join the club.

One rule that should be repeated everywhere on this Forum for developers: Never trust the simulator.

3 Likes

Our stance at the moment is to use your phone for testing. I want to strip sim out of the IDE for now since we don’t have the resources to fix it.

5 Likes