Customizing existing component - Pioneer Receivers

I hope this is the right spot for this, if not please let me know and I’ll repost it. I have a Pioneer SC-25 receiver I have been trying to get working with HASSio. Unfortunately because of its age I can’t use the Pioneer component as is. First off, my receiver does not IP control. I was able to get around that using a raspberry pi with a USB to serial adapter and by running a script to go from IP to serial. Unfortunately, I’ve run into another roadblock. The Pioneer component queries the receiver to build a dictionary of source names and numbers using the command ?RGB. My receiver doesn’t support this command. I’m hoping there is a way I can modify the component and hard code in my source names.

Here is the relevant section of the pioneer,py file (I think):

    # Build the source name dictionaries if necessary
    if not self._source_name_to_number:
        for i in range(MAX_SOURCE_NUMBERS):
            result = self.telnet_request(telnet,
                                         "?RGB" + str(i).zfill(2),
                                         "RGB")

            if not result:
                continue

            source_name = result[6:]
            source_number = str(i).zfill(2)

            self._source_name_to_number[source_name] = source_number
            self._source_number_to_name[source_number] = source_name    

I decided to try my hand and manually add the source name and number to the code. Here’s what I changed it to:

    # Build the source name dictionaries if necessary
    """if not self._source_name_to_number:
	    for i in range(MAX_SOURCE_NUMBERS):
            result = self.telnet_request(telnet,
                                         "?RGB" + str(i).zfill(2),
                                         "RGB")

            if not result:
                continue"""
    result = 'RGB020Chromecast'
    source_name = result[6:]
    source_number = '20'.zfill(2)

    self._source_name_to_number[source_name] = source_number
    self._source_number_to_name[source_number] = source_name

    result = 'RGB021Steam'
    source_name = result[6:]
    source_number = '21'.zfill(2)

    self._source_name_to_number[source_name] = source_number
    self._source_number_to_name[source_number] = source_name

As you can see I just commented out the section that scans, and tried manually defining the source number and name. I saved this as “Pioneer2,py” in /config/custom_components/media_player. I then added this section to my configuration.yaml:

media_player:
     - platform: pioneer2
       host: raspberrypi
       port: 8102 

This seems to be partially working. My receiver now appears on my main page and I can see if it is powered on. If it is on and I’m one of the two inputs I have manually defined, it also shows the input name. If I send a general media_play turn off service call my receiver turns off. I set up a test automation and I can change the input on the receiver. Unfortunately though, I am not seeing any controls on the main page. I don’t see any source selection or power buttons, volume control, etc. Any ideas? I’m in way over my head with python here, I’ve basically been trying different things until they work and have made it this far. I’m wondering if something that is normally included when using the official component is left out when I made it a custom component. If I use the normal pioneer component I can control my receiver from the main page. I get a working power button and volume control. It also has drop down for the source but it does not work as it cannot build the dictionary. Also I feel it’s worth mentioning the pioneer,py file I’m using was one I saved 5 or 6 months ago. Since then I redid my HASS installation and went with HASSio. I was not able to find the pioneer,py file.

Hi,
My Pioneer is a VSX-528 so I can use the IP connection as is. But the VSX-528 do not support the RGB command. I used the official pioneer.py and made some changes:

  • Volume set do not work on the VSX-528 so I use VOLUME_STEP instead.
  • The python dictionaries for the source names I just hardcoded and took the scanning part away.
  • The VSX-528 reports PWR2 when off not PWR1 as in the official component

You can have a look at https://github.com/pernordlund/hass/blob/master/custom_components/media_player/pioneer_vsx528.py

@pernordlund
Hi, I am looking at buying one used unit on ebay. Before buying want to make sure I can control from HASS.

Is it possible to
volume up
volume down
change sources
on/off

with your component?

Rgb command on AVR???

@anon35356645

Hi, After using the component for some time I must admit it do not function 100%. It seems like the Pioneer quite often refuses to answer. If it do not answer when you start Hass up then you will not even get the entity. So if 100% control from Hass is a must I would not recommend the vsx-528. Maybe someone else has made another mod that improves the stability??

But when it works the commands you list do work. You must hardcode the sources, see my example. To find out the codes you must use telnet and the ?F command

And on your question about RGB, that is a command that is available on some other Pioneer models to get the sources automatically.

I’ve gotten Pioneer receivers to work flawlessly using a different language (powershell, from a Windows host), and what I can pass on, is that it’s crucial to cleanly close your sessions. With every command, or set of commands, you must have a working ‘close’ function - or the port is tied up, preventing future use.

I bought a Marantz NR1604, and I think have the same issues. Working perfectly, and all of a sudden not anymore.

How to troubleshoot, where is the Denon (same as marantz) component?

@pernordlund
Hi, your VSX-528 component works fine for my Pioneer VSX-528, thanks for that! There is one issues I’m facing with it, and that is related to AirPlay. When I configure your component, I can control my receiver and it works fine. Also the Pioneer ControlApp keeps working. But when I try to play Spotify by AirPlay on it, it’s either unavailable in the Spotify app or when I try to play a song it keeps stuttering or it doesn’t work at all. Spotify killed support for Spotify Connect on our receiver unfortunately, so I’m depending on AirPlay.

Are you experiencing these issues too?

Thanks!

@TheAutomator Hi, I am an Android guy and I believe Airplay is an Apple thing (no matter what, I have never used it). So I can’t comment on that. But I used to use the Spotify Connect thing on the Pioneer, but stopped doing so since it only worked 1 out of 4 times :frowning:

So I agree I am not very happy about that. I nowadays always use my TV and cast Spotify to it and the TV sound is forwarded to the Pioneer.

1 Like

Hi there! Yes that’s true, it’s an Apple thing. :slight_smile: Hmm, that’s also a way indeed. Thanks for your reply!

This is unfortunatly a Spotify thing. If you have jb iPhone and install an older version of Spotify it might work.

Hi, are you still using this? I don’t know how to add this custom device (your modded code) to my installation…?

@Lars_Varming Hi Lars. Sorry, no I am not using this any more. Quite some time ago it started to warn me about deprecated things when starting up. I realized it is not a big priority for me so I stopped updating it more than a year ago. I do not remember which hass version, but as I said, a long time ago…