Example code does not work for Routines - Issue with enum?


(Cheth) #1

Hi. I am having a problem trying to use the Routines example code at http://docs.smartthings.com/en/latest/smartapp-developers-guide/routines.html .

I get a valid list of Routines or phrases:
def actions = location.helloHome?.getPhrases()*.label

But there appears to be something wrong with:
input “onAction”, “enum”, title: “Action to execute when turned on”, options: actions, required: true
input “offAction”, “enum”, title: “Action to execute when turned off”, options: actions, required: true

I can see from:
log.debug "Installed with settings: ${settings}"
that if the first phrase in the list is selected for onAction or offAction, then the value is set correctly, but if any other value is selected, then instead of getting the phrase name, I get the possition number

So if I have a list of phrase thus:
Aaaa
Bbbb
Cccc
and I select Aaaa, I get Aaaaa
but if I select Bbbb I get 1
and if I select Cccc I get 2

Is this a bug in the code, in enum, in the Simulator, or am I doing something stupid?

Any help appreciated. I’m a total newby to this. Only programming experience is Bourne Shell, oh and some LISP about 25 years ago!.

Thanks for reading,

Cheth.


(Micheal ) #2

The simulator can be hit and miss…I no longer even use it for my development.


(Cheth) #3

Thanks. I tried it for real, and it works. So it appears to be the Simulator.

Any ideas on how to get someone at SmartThings to acknowlege the problem and hopefully fix?

Cheth.


(Micheal ) #4

@slagle is always your best bet for developer/ST relations.


(Tim Slagle) #5

TBH at the moment the simulator is not a priority. We recommend using the mobile app when the simulator doesn’t work for now until we can provide a better tool.