I’m currently developing a custom component for my Denon reciever. The current one (denon) has limited support for Denon AVR’s. This component doesn’t use the telnet interface, it uses the XML endpoints from the web UI.
Feautures supported:
Input & Input select
play/pause/next/prev
album art (where possible)
on/off
volume set/up/down/mute
Volume has a hard coded limit of 50 ( 50 - 80 = -30 dB) because the full 100% percent is loud. I mean, loud to pop your ears out. I would like to hear your thoughts on this limit.
Hi, in the past I’ve done some work on creating a component of my own. Unfortunately due to some unforeseen changes in my personal life I haven’t gotten to fixing/upgrading it to the latest standards.
I’m using a Marantz AVR (SR6008) myself, but seeing as how that’s a Denon subsidiary your component might work as well. I’ll give it a go and update you on any findings.
I’ve installed component without any problems. For now I have tested changing volume, which happens to work much better then on current Denon component included in HASS. I had some trouble with source changes though, I can normally change source to anything but “Media Player” and “Blu-ray”, every other source is working, but I have zero success when selecting one of those two.
I will enable debug log and check if anything gets in there, for now I have error log only and there is nothing in it.
Yeah, I’m a lousy Developer who forgets about logging completely.
My first thought is that the source is set to the new one, an update is executed, but the new source isn’t set yet on the Denon. I’ll take a look at it tomorrow. (It’s 22:30 here)
& include some logging.
Just installed your component, and at first glance it seems to be working. Will test some more in the next few days and get back with any findings.
As for the volume limit: on one hand it’s nice that you put it in, but maybe you can make the min and max volume (optional) configuration parameters? Then you can convert the given min/max scale to the home-assistant scale so all sliders would work as expected.
Looking at the code, apart from the logging mentioned earlier I would put some effort into making the code PEP8 compliant, that will save you some headaches when submit a PR to get the component into Home Assistant.
I’ve created a fork of your Gist (maybe you could create a repo instead so people can submit Pull Requests on your code?), and fixed all the PEP8 style errors, have a look here
Logging! The module now uses logging. If you run into troubles, please enable logging for it in your configuration.yaml
The input select should work & doens’t flap back to the previous one (I’ve tested this, but not visual. I’m not home right now, but the input stays set in the returned xml)
To enable debug logging, add this to your configuration.yaml
logger:
default: info
logs:
denonavr.denon: debug
Please note: because there is a newer version of the denonavr module, you’ll need to manually remove de module from the deps folder of home assistant. You can do it by executing rm -r [your-hass-config-folder]/deps/denonavr*
I have installed new version, problem with input select remains for me, when I choose “Media Player”, source in Homeassistant now stays on Media Player, but source on receiver does not change. I turned on debug log, this is what is logged on input change:
16-11-09 18:01:27 denonavr.denon: Sending GET with data: {'cmd1': 'aspMainZone_WebUpdateStatus/', 'cmd0': 'PutZone_InputFunction/Media Player'}
16-11-09 18:01:28 denonavr.denon: status: 200 response:
, url: http://192.168.0.187/MainZone/index.put.asp?cmd1=aspMainZone_WebUpdateStatus%2F&cmd0=PutZone_InputFunction%2FMedia+Player
16-11-09 18:01:28 denonavr.denon: GET http://192.168.0.187/goform/formMainZone_MainZoneXml.xml?ZoneName=MAIN+ZONE
16-11-09 18:01:28 denonavr.denon: FriendlyName = Denon AVR-X2200W
16-11-09 18:01:28 denonavr.denon: Power = ON
16-11-09 18:01:28 denonavr.denon: ZonePower = ON
16-11-09 18:01:28 denonavr.denon: RenameZone = MAIN ZONE
Additional observation: might be something in connection with source having space or - in it’s name, / does not seem to be problem, not working sources: “Blu-Ray”, “TV Audio”, “Media Player” and “Online Music”
I’ve found the problem.
These inputs need a short name for commands.
For example: Blu-Ray = BD, TV Audio = TV, Media Player = MPLAYER and Online Music = NETHOME. I think I’ve got 'm all, but not sure if the AUX1&AUX2 are returned in the /goform/formMainZone_MainZoneXmlStatus.xml request to a AVR-X2xxx. Could you please pm me the output of the xml file? You can do this in the browser or using cli: curl http://[YOUR-DENON-IP]/goform/formMainZone_MainZoneXmlStatus.xml
Thank you for your help with this! I love this community!
PS:If you’re wondering why I don’t hardcode the inputs, it’s because you can disable some inputs from your Denon AVR. Those that are disabled won’t shopw up in your input select. For example, on my Denon, I’ve disabled the “Tuner” input. Don’t need it because I use the online radio. (And don’t have an antenna connected).
Great job! Its working now, I can confirm that Blu-Ray, TV Audio and Media Player are working, the online one not working for me is Online Music. AUX1 and AUX2 were working already. I will send you the output of /goform/formMainZone_MainZoneXmlStatus.xml in a minute.
I just stumbled on this as I was researching how to control my Denon volume using Alexa. Is there a way to raise and lower the volume by increments? For example if the volume is at 30 and it would step up by 5? Would I have to create a template switch and automation?
I have an AVR-X2000 and willing to help in any way possible. The primary functions work great so far, and displaying the custom input labels is a nice touch. Any chance of having separate volume, input and power selectors for Zone 2? If I’m understanding the class correctly, it looks like it’s hardcoded for Zone 1 at the moment.
I just started testing this component with my AVR-X1100W, and so far its working pretty well. I did have to make one modification because I was getting this error on the Bluetooth input:
Traceback (most recent call last):
File "C:\Python34\lib\asyncio\tasks.py", line 239, in _step
result = coro.send(None)
File "C:\Python34\lib\site-packages\homeassistant\helpers\entity_component.py", line 335, in _async_process_entity
new_entity, self, update_before_add=update_before_add
File "C:\Python34\lib\site-packages\homeassistant\helpers\entity_component.py", line 204, in async_add_entity
yield from entity.async_update_ha_state()
File "C:\Python34\lib\site-packages\homeassistant\helpers\entity.py", line 224, in async_update_ha_state
attr = self.state_attributes or {}
File "C:\Python34\lib\site-packages\homeassistant\components\media_player\__init__.py", line 681, in state_attributes
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "C:\Python34\lib\site-packages\homeassistant\components\media_player\__init__.py", line 681, in <dictcomp>
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "C:\Users\brg46_000\AppData\Roaming\.homeassistant\custom_components\media_player\denonavr.py", line 135, in media_title
return self.denon.nowPlaying["ARTIST"] + ": " + self.denon.nowPlaying["SONG"]
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
I just installed your component. I’m trying it on a Denon AVR-2113, connected via LAN cable.
Turning on/off works as well as switching most sources, except for FM (Tuner), CBL/SAT, NETWORK, AUX. Also, setting the volume doesn’t work. I’ll investigate further.
Would be great if we could add our own source config like we add the name and host. So that only if nothing is added the pre configured source list shows up, else our list.
It looks like you only use the name and host from config