This is not possible - there is no public API available to control “Listen to this Device” feature. The feature can only be controlled by the user in the Sound control panel.