SmartApp with user selected Icon

I’m creating a simple SmartApp that allows me to select a Hello Home Phrase, Icon, and Name. I have everything working such that I can execute the Phrase and I have the tile displaying the name defined by my SmartApp when installing it. I can’t figure out how to have the tile’s icon be displayed as the user selected icon set in the configuration of the app.

Any help on customizing the Tile’s icon would be appreciated!

/**
 *  Phrase Button
 *
 *  Author: Rob Farmer
 */

definition(
    name: "Phrase Button",
    namespace: "smartthings",
    author: "Rob Farmer",
    description: "Execute your Phrase on when the SmartApp is tapped or activated.",
    category: "Convenience",
    //iconUrl: "https://graph.api.smartthings.com/api/devices/icons/$icon",
    //iconX2Url: "https://graph.api.smartthings.com/api/devices/icons/$icon"
)

preferences {
	page(name: "firstPage")
}

def firstPage() {
    dynamicPage(name: "firstPage", title: "First, select your Phrase",uninstall: true, install: true) {
    	
        def phrases = location.helloHome?.getPhrases()*.label
        if (phrases) {
            section("Phrase") {
                input "onPhrase", "enum", title: "Phrase", required: false, options: phrases
            }
            section("UI") {
            	icon(title: "Icon", required: true)
                label(name: "label",
                      title: "Name",
                      required: true,
                      multiple: false)
            }
        }
    }
}

def installed()
{
	subscribe(app, appTouch)
}

def updated()
{
	unsubscribe()
	subscribe(app, appTouch)
}

def appTouch(evt) {
	log.debug "appTouch: $evt"
	location.helloHome.execute(onPhrase)
}

Hi @robfarmer,
I’ve been using the smartthings example template smart apps to learn from, and the two lines you have commented out for iconUrl and iconX2Url are the ones that I’ve been using to change the smart app’s icon. I wanted to know all the various possible icons that ST seems to have hosted on amazon so I wrote a quick PERL script to download them. If you want to see those and the PERL script (uses “curl” so make sure that’s installed) you can look here:

This will show all the icons (at least as of 1/24/15) that are visible from https://s3.amazonaws.com/smartapp-icons/

You can look at the .txt file for the URL’s to use, after you look for the icon you want in the stIcons folder.

I’m assuming (haven’t tried it yet) you could point the smart app to any URL you want to host your own custom icons But if you want to use icons in the actual device type, then I think you can only use the ones listed here:

http://scripts.3dgo.net/smartthings/icons/

1 Like