Device Type Preferences

(Jeremy Stevenson) #1


I’m trying to make it so the user can enter text in preferences that will be shown on the device tile. I can’t seem to get any preference entry working for a device. This is what I’m doing:

preferences {
	input name: "display", type: "text", title: "Display", description: "What do display on the button"

And then for the tile definition

tiles {
	standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "off", label: '${display}', action: "momentary.push", backgroundColor: "#ffffff", nextState: "on"
		state "on", label: '${display}', action: "momentary.push", backgroundColor: "#53a7c0"
	main "switch"
	details "switch"

When I click on the preferences for hte device, no input is available.

Can anyone point me in the direction of preferences for a device?


(Tony - SmartThings Unpublished Contributor ) #2

Two good examples of how Device Type preferences can work are (1) the device type for the Next thermostat and (2) Mike Maxwell’s Device Type for the aeonDimmer.

While I’m no device type guru, I believe you need to update / capture the “display” so that the “switch” tile realizes its there – MM’s aeonDimmer code is cool because it auto-re-configures itself when the user enters parameters in the preferences.

One way you could do it is by using a “Configure” standardTile with an action that runs a sendEvent command to update your device.