What you have looks good. There's not much to optimize here, you're pretty much using the ideal components to make up your command.
Obviously this is asynchronous, in the sense that the game state and VoiceAttack's state are independent and can get out of sync, but without writing a custom plugin for ETS2/ATS(which requires C++) to try and get that data from the game(if that's even possible, having a quick look it seems to only communicate the current gear, not the mode as such) this is as good as it gets.