Denon.py error when retrieving sources

I’m trying to set up my Denon AVR 3312 in Home Assistant.

Tried with denonavr.py component but I was guided to the denon.py one, which should be more suitable for my device ?

Anyway, when I set it up, I end with this error :
> File "/usr/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/denon.py", line 88, in _setup_sources source, configured_name = line[len('SSFUN'):].split(" ", 1) ValueError: not enough values to unpack (expected 2, got 1)

I tracked the session and the sources returned by the amplifier are at some point not what expected.
Most are of the form : ‘SSFUNCD CD \r’
But some are only : ‘SSFUNGAME \r’

The former gets split in : (‘CD’, ‘CD’)
While the second raises the error…

Does it means that the 3312 doesn’t comply with this component ? Or that there’s a correction to make to handle this type of source ? If so, I may try to change it, but I’m no dev, and I don’t have any idea how to submit a change !

If your receiver has WWW interface You can try to talk with Oliver to add your model to denonavr component. Otherwise report issue in the Home Assistant Github page.

Ok, thanks.

I’ve registered on github to share my progress on the denon.py component. Next, I’ll test what differences the denonavr.py component has. Yes, the 3312 has both the telnet and web interfaces. I was going for the web interface (less limitation, eg several connections at the same time) but was pointed to the telnet component.

So far, here are the modifications :

  • I’ve added a try/catch where the failure was, considering that if the “pretty name” isn’t there, then the original source name gets duplicated.
    Line 88 goes from :
source, configured_name = line[len('SSFUN'):].split(" ", 1)
self._source_list[configured_name] = source

To :

        try:
            source, configured_name = line[len('SSFUN'):].split(" ", 1)
            self._source_list[configured_name] = source
        except ValueError:
            self._source_list[source] = source
  • I also noted that the “name” value that you set in the configuration is overwritten by the network name of the device (took me a while to understand why the media_player still wasn’t showing), so I changed this, the network name gets only set as name if no name was given in the configuration.
    Line 82 goes from :
    if nsfrn:
        self._name = nsfrn

To:

    if not(self._name):
        if nsfrn:
            self._name = nsfrn

I’ll post all that in a github ticket.

And then give another try to the denonavr component :wink:

1 Like

I’ve played a lot today…
I’ve made several changes to the denon component to better fit my needs.
Mostly, I wanted to be able to use the interface to navigate the net/usb menus. The denonavr component allows this, but it often fails here.
In telnet, the codes are different between ‘next track’ and ‘down arrow’, so if I wanted to use the standard media_player interface, I had to find a way. Added an internal boolean ‘playing’ in the component and depending on it, send the ‘next track’ code (if playing) or the ‘down arrow’ code (if not). Same for up arrow/previous.
It goes like :

   def media_previous_track(self):
        """Send the previous track command."""
        if self._playing:
            self.telnet_command('NS9E')
        else:
            """Send the UP command if select track"""
            self.telnet_command('NS90')

The idea was to do the same with stop/left and pause/ok but I fail on a strange problem : the play/pause/stop button isn’t showing ?! How do I do that ? Is there a way to force it or does it rely on the media_player generic component to decide ?

Once I have a solution for that, I’ll also have to find a way to better display the return of the screen, right now it’s packed on one line.