One Button Press, cycle through 3 Yeelight Colours

High level solution logic explanation:
Hold current state in node red as index in array of all possible states.
On input add 1 to index but check If new index is equal with array length set index to 0.
Store index as current index
Send new state got from array from that index.

Edit:
Made correction in order of steps. Asking array elements by index should always stay in boundaries.

1 Like