You will need to ID what DI2 you are working with, as the spec's changed between the early Dura Ace 7970 and current series. are you mixing and matching, or what do you have?
If you want to run a flat bar, why not just get a flat bar shifter there are several options from Shimano, like the SW-S705, R600 satellite or M9050?