Improved Denon/Marantz AVR component

When coming over to Home Assistant one of the first things that I tried to set up was my Marantz receiver.
I had quite some trouble with the default denon component, as it would keep on ping-ponging the state from OFF to ON and vice versa.

I figured this might be due to the use of the telnet interface and that’s when my custom denon-avr component was born. It uses the receivers’ built-in HTTP/XML based API which provides me with stable results and allows for more (concurrent) requests.

The component will also automatically try to determine the available inputs even if you have renamed them on the receiver, so you can also use the media_player/select_source service.

If you want to give it a go, you can find it on my Github page:
https://github.com/Juggels/home-assistant-components/tree/master/denon_avr

Thanks for this, but I’m having an error when it tries to set up the device (Denon X1200W):

16-08-13 15:31:51 homeassistant.components.media_player: Error while setting up platform denon_avr
Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py”, line 98, in _setup_platform
discovery_info)
File “/home/pi/.homeassistant/custom_components/media_player/denon_avr.py”, line 37, in setup_platform
config.get(“host”)
File “/home/pi/.homeassistant/custom_components/media_player/denon_avr.py”, line 72, in init
self.update()
File “/home/pi/.homeassistant/custom_components/media_player/denon_avr.py”, line 166, in update
self.build_source_list()
File “/home/pi/.homeassistant/custom_components/media_player/denon_avr.py”, line 178, in build_source_list
video_select_lists[element.attrib[‘table’].upper().strip()] = element.attrib[‘index’]

The values of my video select list (spaces added in the tags to work around forum formatting):

< VideoSelectLists>
< value index=“ON”>On</ value>
< value index=“OFF”>Off</ value>
< value index=“SAT/CBL”>Wii</ value>
< value index=“DVD”>PS3</ value>
< value index=“BD”>Kodi</ value>
< value index=“GAME”>PS4</ value>
< value index=“AUX1”>AUX</ value>
< value index=“MPLAY”>Shield</ value>
< /VideoSelectLists>

Thanks for the feedback! I’ll dig into this tomorrow and see if I can find out where I made a mistake.

Got the same error here. Thanks for doing this. I’ve been looking for something that interfaces with my AVR. Now if I can only find something for my Samsung TV that works.

Apparently the XML output is not 100% consistent through all the AVR models. I’ve just committed a new version that should hopefully fix your problems, please let me know if it does :slight_smile:

Working well here so far. Thanks again and please see about getting this in upstream!

Been doing some more work on this component (mostly making the code better, not so much adding functionality).

I’m planning to make a PR to get this in upstream, but I’m doubt about one thing: should I modify the existing Denon component which only seems to focus on the network players which might break by my new component, or should I put it in as a new component which explicitly focuses on the Audio/Video Receivers?

Hi!

Just wondering if you will get around to finishing this for PR. I would be sad if HASS couldn’t come on par functionality wise with OpenHab in Denon receiver control :slight_smile:

/R

Wow! It’s been a month? How can I not have seen this thread about a month ago?

Anyway, I’ll give your custom component a try tomorrow.

And also, does your custom component gather the maximum volume for the receiver? The default denon.py component has a default of 60. Updating HASS after I modify the component to 80 sets the default max volume back to 60 in two functions; which means, components should not be modified inside the /usr directory in Linux. Other than renaming denon.py to marantz.py in the custom folder, I don’t know where to rename the component.

Anyway, I’m glad I’m not the only one with Marantz. I did create a thread in the Feature Request, but figured out that Marantz can work with Denon component, which Marantz is a subsidiary of Denon.

Hi there… as for where to put custom(ized) components, take a look at https://home-assistant.io/developers/component_loading/, it shows you where HA will look for its components.

As for my modified version: I don’t have the option to actually get the min/max value from the receiver, but I have allowed for a custom min/max volume in the component configuration, that way it’s not necessary to change the component code for that :slight_smile: I’ll do a quick update on the README to add those config parameters.

I’m still not sure if I should create a PR on the existing component or submit it as an entirely new one. I think I’ll try to submit it as a new DenonMarantzAVR component, so the main HA devs can decide if they want to keep the old one :slight_smile: I have some time this weekend so I’ll update this thread once the PR has been submitted.

Update: just found out that I kind of messed up my local git repo containing the final changes :frowning: That means I’ll have to rework some of that before the component is actually usable again. I’ll try to get some of that done this weekend, but don’t know if I have enough time to finish it all. Will keep you posted.

Yeah, I know where to put the custom component as I’ve been to the web page, so thanks, but it’s more of renaming the component, not just simply renaming denon.py to marantz.py. Once I put the marantz.py in the custom components folder and I tried to rename denon: to marantz:, I get a message saying “marantz” component does not exist.

I’m looking for a way to make 2 switches (which Alexa can trigger) that turns the volume up by x and the other to turn the volume down by x. Is there a way to read the current volume state then send a command to add, let’s say 5 to the volume? I’m just wondering if anyone else has ever tried to do something like this?

just tried this on a HASSBIAN image, and I am getting errors when I reboot.
The log is showing these?

16-11-26 09:40:59 root: No value found for item FriendlyName
16-11-26 09:41:02 root: No value found for item InputFuncList
16-11-26 09:41:02 root: No value found for item RenameSource/value
16-11-26 09:41:02 root: No value found for item SourceDelete
16-11-26 09:41:02 root: No value found for item VideoSelectLists
16-11-26 09:41:02 homeassistant.components.media_player: Error while setting up platform denon_avr
Traceback (most recent call last):


  File "/home/homeassistant/.homeassistant/custom_components/media_player/denon_avr.py", line 36, in setup_platform
    config.get("host")
  File "/home/homeassistant/.homeassistant/custom_components/media_player/denon_avr.py", line 71, in __init__
    self.update()
  File "/home/homeassistant/.homeassistant/custom_components/media_player/denon_avr.py", line 165, in update
    self.build_source_list()
  File "/home/homeassistant/.homeassistant/custom_components/media_player/denon_avr.py", line 176, in build_source_list
    for element in self._get_api_value('VideoSelectLists', return_as_string=False):
TypeError: 'bool' object is not iterable
16-11-26 09:41:07 homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'state'
16-11-26 09:41:33 homeassistant.core: Error doing job: Task exception was never retrieved

any ideas?

i have a problem, the component does not update the state of the avr, i mean if i turn on the receiver with the remote on hass the state does not change.

If i turn on the receiver with the hass web interface everything works as expected.

@Juggels
Is it possible to get the component? The github project is not accessible. I don’t mind a few bugs :slight_smile:

2 Likes

I’m in the same situtation. I can read status from the amp but can’t intereact with it.

I second this. I would love to access a more advanced code set for interacting with my Marantz NA7004.
Thanks

I really wish I could just see the code that was on GitHub so I could work to reverse engineer it.

1 Like

I too wish I could do on HA what I can already do on the Marantz app for iPhone.