How to call a routine in a SmartApp?

Is it just a hello home action or is there different command?

It’s a bit more complicated than meets the eye. You have to use a dynamic page to first fetch the list of Routines that are available for the location, then offer those as an input selection. Then you can call the Routine from the app.

Here is a code snippet for the first part:

preferences {
	page(name: "selections")
}
	
def selections() {    
    dynamicPage(name: "selections", title: "First, select your phrases", uninstall: true) {
        def phrases = location.helloHome?.getPhrases()*.label
                  section("Select HelloHome Phrase") {
		input "phrase2", "enum", title: "Phrase", required: false, options: phrases
	}
    }
}

And here is the documentation on it:

http://docs.smartthings.com/en/latest/smartapp-developers-guide/routines.html?highlight=phrases

2 Likes