Help with device type .. tile state not changing

can someone help me figure out why my icon state is not changing… I have the following:

metadata {
definition (name: “Aeon Dimming Metering Smart Switch 6”, namespace: “smartthings”, author: “lg kahn”) {
capability "Switch"
capability "Polling"
capability "Power Meter"
capability "Energy Meter"
capability "Refresh"
capability "Switch Level"
capability "Sensor"
capability “Actuator”

   command "followMode"
   command "briefMode"
   command "nightLightMode"
   
	fingerprint inClusters: "0x26,0x32"
}

… later

   standardTile("deviceMode", "state.currentMode", inactiveLabel: false, canChangeIcon: true) {
        state "0", label:'Follow', action:"briefMode", icon: "st.switches.switch.on", backgroundColor: '#ffffff', defaultState : true
        state "1", label:'Brief', action:"nightLightMode", icon: "st.switches.switch.off", backgroundColor: '#0011cc'
        state "2", label:'NightLight', action:"followMode", icon: "st.switches.switch.on", backgroundColor: '#cc00cc'
    
    }

main(["switch","power","energy"] )
details(["switch", "power", "energy", "levelSliderControl", "deviceMode","refresh", "reset"])

then finally these fx…
the fx are getting called… but the icon tile is not changing…

def nightLightMode() {
log.debug "in set nightlight mode"
setDeviceMode(2)
}

def followMode() {
log.debug “in set follow mode”

setDeviceMode(0)

}

def briefMode() {

log.debug “in brief mode”

setDeviceMode(1)

}

def setDeviceMode(mode) {

log.debug “in set device mode”

state.currentMode = mode
log.debug “set current mode to ‘$mode’”

zwave.configurationV1.configurationSet(parameterNumber: 0x51, size: 1, scaledConfigurationValue: mode).format()

sendEvent(name: “deviceMode”, value: mode)

}

I also initialize the current state in the on method
as follows:

state.currentMode = 0

thanks in advance…

larry

Tile States must use an Attribute and can only be updated with a sendEvent() or equivalent method call.

state.* and other variables are not the same as Attributes, and Attributes cannot be updated with simple assignment expressions.

no I got them working without attributes the key was the same of the command/f has to be exactly the same name as the state… A sendevent then will change the state.

Not sure I understand your English here…

Indeed, the key is that sendEvent() (or createEvent() inside parse()) is required.

I believe it is recommended that all the values you set with sendEvent() (including all the stuff you dynamically display on Tiles), should be declared as Attributes in your metadata() as a matter of good SmartThings programming form.

It may work without, but it doesn’t hurt.

I may also be misunderstanding your posts.