ssss25
(Chad)
1
Is this correct?
if("off" == dimmers.currentSwitch) {
dimdown = 0
dimmers.setLevel(5)
dimmers.on()
}
It doesnt’ seem to be going in the if statement, the switch is off!
What am I doing wrong?
What if dimmers has multiple switches?
I also saw some use thie notation:
state.currentLevel = dimmers[0].currentValue(“level”)
why not just use:
state.currentLevel = dimmers[0].SwitchLevel
?
Thanks 
Jim
(Jim Anderson)
2
If dimmers
was defined with multiple: true
in the input
, then getting an attribute value will return a list.
See this for more information: http://docs.smartthings.com/en/latest/smartapp-developers-guide/devices.html#interacting-with-multiple-devices
There are a few different ways to get the value of an attribute:
device.currentValue('level')` // => current value of level attribute
device.currentLevel // => current value of level attribute
More information here.
Also reference docs of interest below:
currentValue docs
currentAttributeName docs
ssss25
(Chad)
3
Thanks for the info. I got things to work… had few other issues.