You need to replace the array constants with cluster constants and the array functions with cluster functions, but what's the point? This looks pretty good as it is.
By the way, you don't have a stop case. Make an event to send an exit command to the state machine.
___________________
Try to take over the world!