MIDI decoder sketch

Hello Nick,
I am in the process of building a digital organ using the amazing hauptwerk software. Typically an organ has stops that the organist pulls out or pushes in to alter the sound of the instrument. Most of this stops are made from a push-pull solenoid or they might just be the type that illuminates when engaged like what I am building.

Currently I have all the stops connected to keyers from a old casio keyboard and I use the keyboard to send out messages to haupwerk. SO if the organist wants the trumpet 8 sound all you do is push the stop, the light comes on at the console for trumpet 8 and the sound comes out when you play. And vise versa, when you push the stop back in, the light goes off and the trumpet no longer sounds. However hauptwerk also needs to be able to send some messages back to the organ so only certain stops stay engaged when the Organist uses preset pistons(a preset piston is a combinations of stops, you simple press on button to pull the sound of 10 instruments at once).My casio send the message properly to hauptwerk and those presets sound, however the stops that are sounding are not illuminated on the console.

This is where I need a MIDI decoder to interprete the mesages from hauptwerk regarding the stops to be engaged/disengaged and illuminate or de-illuminate those stops on my organ. In the case of my build some stops will be illuminated while others will be off.

Please any help will be high appreciated.