Denonavr request sound mode support (python code included)

I have an Marantz SR5008 that I can control with the denonavr platform.
I would love to see “Sound mode” support added as feature.
the http request to switch between sound modes are:

Sound Mode: Movie - http://IP_ADRESS/MainZone/index.put.asp?cmd0=PutSurroundMode%2FMOVIE
Sound Mode: Music - http://IP_ADRESS/MainZone/index.put.asp?cmd0=PutSurroundMode%2FMUSIC
Sound Mode: Game - http://IP_ADRESS/MainZone/index.put.asp?cmd0=PutSurroundMode%2FGAME
Sound Mode: Auto - http://IP_ADRESS/MainZone/index.put.asp?cmd0=PutSurroundMode%2FAUTO
Sound Mode: MCH stereo - http://IP_ADRESS/MainZone/index.put.asp?cmd0=PutSurroundMode%2FMCH+STEREO

This python code can be used to sent the switch command:
"
import urllib
urllib.urlopen(‘http://IP_ADRESS/MainZone/index.put.asp?cmd0=PutSurroundMode%2FMOVIE’)
"

This python code can be used to request the current sound mode:

"
import urllib
import re

dataMarantz = urllib.urlopen(‘http://IP_ADRESS/goform/formMainZone_MainZoneXml.xml’) .read()

resultvalue = re.search(’(.*)’, dataMarantz).group(1)
print(resultvalue)
"

I am waiting for the same upgrade, in the meantime my work around worked for me. I use my google home to control my receiver in a few ways. For this i did not use HA. I have my google home sending a command to Ifttt to telegram and a python program listening to telegram to call the url. If u need help, tell me.

http://192.168.1.152/MainZone/index.put.asp?cmd0=PutSurroundMode%2FMCH STEREO
http://192.168.1.152/MainZone/index.put.asp?cmd0=PutSurroundMode%2FDOLBY DIGITAL

@marcw I actually implemented the code in Home Assistant and made a pull request. I have been using the code for a few weeks and it works flawlessly. However the PR is still waiting to be merged because part of the code is preferably implemented in a sepreate library instead of HASS (see discussion in the PR). But I will make sure that it eventually gets merged. You can use the code as a custom compenent for now and use a def frontend.

The backend PR: https://github.com/home-assistant/home-assistant/pull/11764
The frontend PR: https://github.com/home-assistant/home-assistant-polymer/pull/815
The documentation PR: https://github.com/home-assistant/home-assistant.github.io/pull/4470

2 Likes

Thanks, I will play with the new code when it is merged, as you, my telethon method took 15 minutes to code and all is work well.