In case @Snurre's solution won't work, try with UI InteractionI want to do a macro that, when bluetooth is on The audio balance goes from 0% left to 100% right to 50% right and 50% left.
This setting on my device is in:
Setting/additional settings/accessibility/hearing
In case anyone else or OP is still looking for a solution, this worked for me together with the macro droid helper apk. I'm sure it's possible to get this into a single program, but this was the easiest way for me. There is of course the issue of this only working with a single Bluetooth headset, but I don't care about that right now.