I think you are on the right path here (except for the Harmony remote instead of an MX-700 ).

The Yammie should have the answer for the commands you will need to send to differentiate the analog vs. digital.