I recommend to use Thread::sleep instead of creating timers…
Item HueVakna received command ON
then
sendCommand(hue3bright,5)
sendCommand(hue3colortemp,100)
sendCommand(hue3bright,10)
Thread::sleep(4000)
sendCommand(hue3bright,20)
Thread::sleep(4000)
sendCommand(hue3bright,30)
...
...
...
end
I think your main problem in regards to this is that you are creating a whole lot of timers, but you only have one variable to keep the handle to the timer:
With the current setup, you will only keep a handle to the last timer you created, consequently this is the only timer that you can cancel. All the other timers will still be running in your system until they expire.
There are lots of ways to implement this. I would probably do the following:
NOTE: To properly format code in posting use code fences:
```
code goes here
```
var boolean canceled = false
rule "Hue Vakna"
when
Item HueVanka received command ON
then
hue3bright.sendCommand(5)
hue3colortemp.sendCommand(100)
var int bright = 10
while(bright < 100 && !canceled){
hue3bright.sendCommand(bright))
bright = bright + 10
Thread::sleep(4000)
}
canceled = false
end
rule "Hue Vakna Cancel ON"
when
Item HueVakna received command OFF
then
canceled = true
end