ol-iver / denonavr

Automation Library for Denon AVR receivers.
MIT License
174 stars 66 forks source link

Video Output Settings #207

Closed ChristopherJohnston closed 3 years ago

ChristopherJohnston commented 3 years ago

Hi,

I'm looking to get the "HDMI Video Output" setting - e.g. Monitor1, Monitor2, Auto(Dual). This seems to come from the AppCommand0300.xml interface using the "GetVideoInfo" command, similar to the Audyssey settings. I've been looking at the code in this repository trying to figure this out. So far, adapting from your test script:

def create_body():
    body = BytesIO()

    post_root = ET.Element("tx")
    item = ET.Element("cmd")
    item.set("id", "3")

    command_name = ET.Element("name")
    command_name.text = "GetVideoInfo"

    param_list = ET.Element("list")
    for param_name in ["videooutput", "hdmisigin", "hdmisigout"]:                
        prm = ET.Element("param")
        prm.set("name", param_name)    
        param_list.append(prm)

    item.append(command_name)
    item.append(param_list)
    post_root.append(item)

    post_tree = ET.ElementTree(post_root)
    post_tree.write(body, encoding="utf-8", xml_declaration=True)

    body_bytes = body.getvalue()
    body.close()
    return body_bytes

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--host', type=str,
                        default='192.168.0.250',
                        help='host of Denon AVR receiver')
    args = parser.parse_args()
    data = create_body()
    r = requests.post("http://{host}:{port}/{path}".format(host=args.host, port="8080", path="/goform/AppCommand0300.xml"), data=data)
    with open("./VideoInfo.xml", "wb") as file:
        file.write(r.content)

gives:

<?xml version="1.0" encoding="utf-8" ?>
<rx>
<cmd>
<name>GetVideoInfo</name>
<list>
<param name="videooutput" control="1">Monitor 1</param>
<param name="hdmisigin" control="1"> --- </param>
<param name="hdmisigout" control="1"> --- </param>
</list>
</cmd>
</rx>

Is it possible to get this information from the existing implementation or will it require an additional AppCommandCmd implementation similar to that in audyssey.py?

The video output information would be useful to me in home assistant so that I can trigger certain actions based on its current status and when it changes (e.g. sending IR commands to control a projector and screen when it changes to Monitor2)

NB I am currently able to change the video output settings in the "app direct" interface using the telnet commands VSMONI1, VSMONI2, VSMONIAUTO. e.g. calling "/goform/formiPhoneAppDirect.xml?VSMONI1" from a home assistant button action

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ChristopherJohnston commented 3 years ago

:(