Yes. You need to keep track of the last state in another Item or in a global variable and then cycle to the next one when the event occurs. When you get to the end cycle back to the beginning. Using a number and the %
is great for this.
This Rule could also benefit from Design Pattern: How to Structure a Rule. I’ll leave that for later.
var currState = 0
var leftColors = newArrayList("218,94,77", "<some other color>", "<some other color>")
rule "Aqara Cube Controller"
when
Channel 'mihome:sensor_cube:04cf8c9783a3:158d00029bc4f8:action' triggered
then
var actionName = receivedEvent.getEvent()
switch(actionName) {
...
case "ROTATE_LEFT": {
currState = currState + 1 % leftColors.size
color = leftColors.get(currState)
TV_Light_Color.sendCommand(color)
L3_Color.sendCommand(color)
L4_Color.sendCommand(color)
}
...
I just typed in the above, there may be errors.