Hi everyone, I very much appreciate the support given to me.
I have just set up a Xiaomi Cube which works fine for the test actions I have put into the rule so far. The question here could relate to any switch not specifically the cube.
From the below rule you can see that when the cube is rotated left or right the mood lamps change to a specific color. Is it possible to somehow create in a rule the ability for the action, in this case, rotate left to cycle through a list of different responses? By that I mean, If I repeat the rotate left trigger action say 3 times, I get a different colour for each rotate left action. I would like to have perhaps 8 coulors available which cycle through for the repeated rotate left.
I think that explains it.
Here is the current cube rule:
rule "Aqara Cube Controller"
when
Channel 'mihome:sensor_cube:04cf8c9783a3:158d00029bc4f8:action' triggered
then
var actionName = receivedEvent.getEvent()
switch(actionName) {
case "MOVE": {
All_Living.sendCommand(OFF)
Mood_Lamps.sendCommand(ON)
TV_Light_Color.sendCommand("300,50,50")
L3_Color.sendCommand("300,50,50")
L4_Color.sendCommand("300,50,50")
}
case "ROTATE_RIGHT": {
TV_Light_Color.sendCommand("27,46,33")
L3_Color.sendCommand("27,46,33")
L4_Color.sendCommand("27,46,33")
}
case "ROTATE_LEFT": {
TV_Light_Color.sendCommand("218,94,77")
L3_Color.sendCommand("218,94,77")
L4_Color.sendCommand("218,94,77")
}
case "FLIP90": {
SW3_02_3.sendCommand(ON)
}
case "FLIP180": {
SW3_02_3.sendCommand(OFF)
SW3_02_1.sendCommand(ON)
}
case "TAP_TWICE": {
SW3_02_3.sendCommand(OFF)
SW3_02_1.sendCommand(OFF)
}
case "SHAKE_AIR": {
SW3_02_3.sendCommand(OFF)
SW3_02_1.sendCommand(ON)
}
case "FREE_FALL": {
SW3_02_3.sendCommand(OFF)
SW3_02_1.sendCommand(ON)
}
// case "ALERT": {
// <ACTION>
// }
}
end
As allways, any help much appreciated.
J