Custom tile icons

I want to use some of my own icons for a title in my device handler. I did some research at the community site and really could not find a straight answer… i took a gander at the documentation… it did say something about using an URL for an icon, but I tried it and it did not work (see code below). I am wondering if this is possible, am I doing something wrong?

standardTile("button", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "off", label: 'on', icon: "http://webhost.com/images/on_image.png", backgroundColor: "#ffffff", nextState: "on"
			state "on", label: 'off', icon: "http:/webhost.com/images/off_img.png", backgroundColor: "#00A0DC", nextState: "off"

I think John did something similar. Tagging him @johnconstantelo

Sure did, thanks for tagging me @Navat604.

Hi @psun03,

There are a couple ways you can do this. First, you can add “canChangeBackground: true”. This allows you to use your own background image for a tile. To add the image, go to the device’s Preferences in the mobile app and select an image from your gallery (or other picture sources).

The other way is what you’re trying, and that should work as long as you can see the image with the URL in any normal browser window. Here’s an example of one in my code:

    standardTile("iconTile", "iconTile", inactiveLabel: false, decoration: "flat", width: 1, height: 1) {
		state "default", icon:"https://raw.githubusercontent.com/constjs/jcdevhandlers/master/img/device-activity-tile@2x.png"
	}

That URL should show this:

2 Likes

are you using IOS or android to view? I hear there are many bugs with the android app and viewing custom icons is one of them… (i think its hard to tell)…

1 Like

I’m on Android, and yes there are ST mobile app issues with image/icon/text rendering. It’s worse in v2.3.1 than any other previous release - ever, and I’ve been with ST since the very beginning…

strange… working now… my device handler did not update… when I deleted the device hanlder and made a new one… the icon showed… thanks!