I am trying to allow the user to customize the text on the tile In my device type handler. I have under metadata
:
preferences {
input ("friendlyName", "string", title: "Switch Description",
description: "User-Readable Description for Switch.", defaultValue: "Generic Switch",
required: false)
}
and
tiles (scale:2) {
standardTile("switch", "device.switch", decoration: "flat", width: 3, height: 3) {
state "on", label: "${friendlyName} On", action: "off1", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
state "off", label: "${friendlyName} Off", action: "on1", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
state "turningOn", label: "${friendlyName} Turning On", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
state "turningOff", label: "${friendlyName} Turning Off", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
}
}
However, using either the âfriendlyNameâ variable or the full âsettings.friendlyNameâ variable results in NULL. I presume this is because at the time of setting up the tiles the preferences closure has not been bound yet.
Is there any way to dynamically define the text on a standardTile? I am trying to avoid using a valueTile as the documentation warns against binding actions to valueTiles but I suppose I can if I must.