Add state change callback to StateMachine