Help with controlTile()

Need some help from the dev community here… I am having trouble getting a control tile in a deviceHandler to work. When I create a virtual device using this deviceHandler, the device shows in my “Things” list correctly, but when I click on it for the device detail page, the detail page is completely blank except for a small question mark in the middle. My full deviceHandler code is below.

For reference, my deviceHandler uses the “Alarm” capability in the docs here: https://smartthings.developer.samsung.com/develop/api-ref/capabilities.html#Alarm

The controlTile() documentation I’m following is in the docs here: http://docs.smartthings.com/en/latest/ref-docs/device-handler-ref.html#controltile

Can anybody spot what I am doing wrong here?

metadata {
	definition (name: "AlarmDeviceHandler", namespace: "RustyKroboth", author: "Rusty Kroboth") {
		capability "Alarm"
	}

	simulator {
	}

    tiles(scale: 2){
        standardTile("displayer", "device.alarm", width: 6, height: 6) {
            state "off", label: "off", icon: "st.switches.switch.on", backgroundColor: "#ffffff"
            state "both", label: "both", icon: "st.switches.switch.off", backgroundColor: "#00a0dc"
            state "siren", label: "siren", icon: "st.switches.switch.on", backgroundColor: "#00a0dc"
            state "strobe", label: "strobe", icon: "st.switches.switch.on", backgroundColor: "#00a0dc"
        }

        controlTile("controller", "device.alarm", "control", width: 6, height: 6) {
            state "off", action: "Alarm System.off", label: "off", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
            state "both", action: "Alarm System.both", label: "both", icon: "st.switches.switch.on", backgroundColor: "#00a0dc"
            state "siren", action: "Alarm System.siren", label: "siren", icon: "st.switches.switch.on", backgroundColor: "#00a0dc"
            state "strobe", action: "Alarm System.strobe", label: "strobe", icon: "st.switches.switch.on", backgroundColor: "#00a0dc"
        }

        main('displayer')
        details(['controller'])
    }
}

// parse events into attributes
def parse(String description) {
	log.debug "Parsing '${description}'"
	// TODO: handle 'alarm' attribute

}

// handle commands
def off() {
	log.debug "Executing 'off'"
	// TODO: handle 'off' command
}
def both() {
	log.debug "Executing 'both'"
	// TODO: handle 'both' command
}
def siren() {
	log.debug "Executing 'siren'"
	// TODO: handle 'siren' command
}
def strobe() {
	log.debug "Executing 'strobe'"
	// TODO: handle 'strobe' command
}

I think I’ve found the problem to be that the documention for the controlTile() function is completely out of date: http://docs.smartthings.com/en/latest/ref-docs/device-handler-ref.html#controltile

So don’t use that documentation, or your controlTime() function call won’t work.

I wish I knew where more current documentation was, or how to get old documentation like this removed from the ST websites… in my few weeks here, I’ve definitely found the docs to be spotty on their accuracy.

1 Like

@ncrusty Hey thanks for catching this. Can you post the code snippet which made it work? That would help me fix the docs faster.

Hey there… I was never able to get it to work, as it appears contrary to these docs, “control” is not an allowed controlType param passed to controlTile(). That’s contrary to the documentation at that link, which says this:

String controlType - the type of control. Either "slider" or "control"

In fact not only does “control” not work, the docs don’t list “color” which IS an allowed value of the controlType param. Also, there might be other allowed values beyond “slider” and “color”? That’s as far as I got with it, when I realized it wouldn’t accept “control”, I move on to doing this a different way without controlTile()…

Thanks for updating it!

1 Like

That is helpful. Thanks, and I will look into it.

Is there a place where documentation updates could be suggested… or is this BB the best place?

These docs are open on GitHub and normally folks do pull requests with their suggested fixes and changes. See this: http://docs.smartthings.com/en/latest/contributing/index.html

If you rather not do that, you can tag me here with the issue. When you do that, it goes into the list of to-dos that I will look at, with all the vagaries of delays and not-able-to-find-resolution-yet’s and what not.

ah ha, very useful, thanks!

1 Like