Pandora / Pianobar help

New user here, getting HA setup and really liking how much I can do with it. We use Pandora around the house for background music so I decided to use that component but am running into a hiccup.

I have pianobar setup can run it via command line (without ha) and it auto logs in. Music plays everything is great.

However, when trying to use it from HA it cannot run it and I am getting a log-in error in log.

16-09-16 09:22:44 homeassistant.components.media_player.pandora: The pianobar client is not configured to log in. Please create a config file for it as described at https://home-assistant.io/components/media_player.pandora/

Did you follow the instructions on the config page as the message suggested?

yes, I have a working config file. If I run via command line piano bar runs, and will auto login. To me this says that the config file is in place and working and should be working with HA too. Not sure where I am going wrong.

I would guess that you are running hass under a different user than the one you are running the command line from - that might explain why hass canā€™t find it since it expects the config in the users home directory.

1 Like

That fixed the login issue, now I have another issue, but that is for another day.

Thanks for the help

When installing extras like pianobar or the rf switch component should I be logged in as my general pi user, hass or the virtual environment under hass?

Im guessing this may be the source of a lot of my problems.

On a raspberry pi 2, rasbian jessie, and HA 0.28.2

If you installed HA in a Virtual environment you will need to have the environment activated if you do any kind of python installation. The user does not matter for that.

In the piano scenario the user did matter because of the way piano expects to find configuration files.

If I followed https://home-assistant.io/getting-started/installation-raspberry-pi-all-in-one/

Which would be appropriate?

The AIO installed does create a virtual environment so you will need to switch to it for any Python installs that you want Home Assistant to use.

Can someone tell me the location that the pianobar files need to go on windows? If i add them to root of the ā€œdepsā€ folder it appears to load in home assistant but pressing play or really doing anything does not work.

Can someone please share what the proper location for the exe and cfg file are?

thanks,
Josh

Iā€™m sure you have this working now @silvrr but for anyone else searchingā€¦

With the AIO - install pianobar using putty as pi user.

Create the .config directory and config file in the hass directory

home/hass/.config/pianobar/config

If you try to install as hass user (like I did) you will need a password for any sudo commands and hass has no password.

Iā€™m also having trouble with Pianobar - not sure whether itā€™s better to follow up this discussion or start a a new one. Iā€™m running HA on Fedora 25. I built pianobar from scratch, using the latest source from git://github.com/PromyLOPh/pianobar.git

Iā€™m running HA as the ā€œhomeassistantā€ user, and when I login as ā€œhomeassistantā€ I can run pianobar from the command line just fine. (Iā€™m able to hear music, change tracks, change stations, etc.) However, when I start the ā€œPandoraā€ media player from the web interface, it never goes active. Looking at the log file, it looks like it starts pianobar, connects, and starts parsing the list of stations, but then times out. It seems like it might be looking for something in the output that itā€™s never finding. Is it possible that my pianobar (it reports version 2016.06.02-dev) is too recent and thus incompatible in some way? Is there a way to debug the handshake with the command line client?

You need to put in the config file default station ID to play. Otherwise, you will need to select which station to play from ha interface. Google default station ID for pianobar you should get the how to. It involves two steps: figure out the station ID (not the index number) then put that value into /home/homeassistant/.config/pianobar/config.

Example from mineā€¦

autostart_station = 453090965190439054

Thanks for the quck response. . Unfortunately, that doesnā€™t seem to help in my situation. WIth or without the autostart= in the config file, it never gets far enough along for me to see any stations. When I click the ā€œpowerā€ icon on the Pandora entry, I can see that pianbar is started (by looking at ā€œpsā€ and the log entries about parsing stations), but it never leaves the ā€œoffā€ state - so no way to get a station list.

I ran it under strace, and it looks like the problem is at this block in pandora.pyā€¦

235      def _query_for_playing_status(self):
236          """Query system for info about current track."""
237          import pexpect
238          self._clear_buffer()
239          self._pianobar.send('i')
240          try:
241              match_idx = self._pianobar.expect([br'(\d\d):(\d\d)/(\d\d):(\d\d)',
242                                                 'No song playing',
243                                                 'Select station',
244                                                 'Receiving new playlist'])

HA is sending it the ā€˜iā€™ command, but what it gets back is not one of the expected responses:

17202 read(0, "i", 1)                   = 1
17202 write(1, "\33[2K|>  Station \"Bonnie Tyler Ra"..., 59) = 59
17202 write(1, "\33[2K|>  \"Take Me Back\" by \"Bonni"..., 77) = 77
17202 select(1, [0], NULL, NULL, {tv_sec=1, tv_usec=0} 

And then it just eventually times out

Which version you are on? Iā€™m still on .38.3 and it plays my station when I hit the Power icon. Perhaps itā€™s a bug on yours? If you launch pianobar as homeassistant user in terminal, does it play? That should also indicate if itā€™s HA or pianobar issue.

Getting closerā€¦ Iā€™m not sure if Iā€™ve worked out all the issues to make it completely reproducible. But one problem seems to be that pianobar does not work when launched from inside HA because it canā€™t connect to DBUS. I changed /usr/local/bin/pianobar to a shell script that first sets $DISPLAY to the console where user homeassistant is logged in, and then launches the real pianobar.

And it works!! Pandora starts up playing my default station, and I can switch to any of my other stations by selecting from the list!

There are still a few rough edges to work out. Iā€™m only able to make it work if I first login on the console as ā€œhomeassistantā€ and (maybe?) configure pulseaudio to connect to the proper output using the GUI. And I have to stay logged in on the console for it to keep working. It would be nice if I could get those steps more automatic, but I think Iā€™m heading down the right path!

Did you ever get this resolved? I did a fresh install of HA. I havenā€™t used it in over a year. I had pandora working in the past. This time, I couldnā€™t follow the HA instructions since things have changed but I got it installed.

I can run it from CLI but nothing happens when I use it in the GUI.

Does anyone still use this integration and, if so is it still working? Also, I am a bit confused about how it works. For this to work does my HA instance have to be on the same Pi as is running Pianobar? I have Home Assistant running on HA Blue. If I install pianobar and log-in to Pandora on a separate Pi on my network and add the pi command to my config file can HA ā€œfindā€ the integration on my network?

If not, is there anyway similar to install pianobar on the HA Blue?

If not, does anyone have any other suggestions for Pandora integration with Home Assistant?