Where does spotsDimmVal
come from? Maybe you lost some details of your rule. I guess, it should be something like
rule "Spots dunkler"
when
Item Wandtaster_Button1_Left_Long changed to ON
then
var Number spotsDimmVal = (Light_Spots.state as DecimalType).intValue
while(Wandtaster_Button1_Left_Long.state == ON) {
if((spotsDimmVal - 10) < 0) {
spotsDimmVal = 0
}
else {
spotsDimmVal -= 10
}
sendCommand(Light_Spots, spotsDimmVal)
Thread::sleep(100)
}
end
Please consider to use the method in favor of the action. The action sendCommand(string, string) needs a String as input, where the method item.sendCommand(value) does not, so, if using primitives, the action maybe will fail, where the method does not, see sendCommand() Documentation - #9 by rlkoshak for a very detailed explanation (thank you @rlkoshak)