Pandora integration with openHAB

I’m trying to integrate Pandora into openHAB.

I installed a whole-house audio system, with speakers and volume controls in all the common rooms in our house. These speakers are hooked up to an amplifier, which in turn is hooked up to the my Raspberry Pi 3 (the same one hosting openHAB) via a USB audio card.

This setup works nicely, as it allows openHAB audio feedback throughout the house. I also use shairport-sync on the same Pi, which allows it to be used as an AirPlay receiver.

However, for a seamless integration, I’d love to have openHAB control our Pandora experience. Our whole family uses it, and it tends to be clunky to try to AirPlay it from different devices. I plan to control it from the BasicUI, the iOS app, and from habPanel

I’ve already brainstormed and spent some time trying some different solutions. I’m looking for input from people smarter than me, especially if anyone has something like this working.

Must haves

  • Switch or String items able to play, pause, skip forward, and select stations

Would be nice

  • Ability to upvote and downvote songs
  • Ability to see current track, artist, etc. via Strings

These are the solutions I’ve considered / attempted:

This is a lightweight, command line interface for Pandora. It supports FIFO commands via the command line, so it seems like it would be perfect. I don’t see a good way to keep it running as a service, though. If anyone has thoughts on how to keep it running in the background, I’d consider this my best solution.

Similar to Pianobar, but designed to run as a service. This should be a good option, but I’m having trouble getting it to compile. The instructions are fairly thin for a relative linux newbie like me. I haven’t given up completely, but I wanted to solicit input before I sink too many more hours on this approach.

I haven’t investigated this too much, but I thought about either trying to run KODI on the same Pi or running it on a second Pi. My cursory investigation of the KODI binding leads me to think there isn’t an easy way for me to change Pandora playlists from openHAB. It also seems overkill for my needs.

I tried installing Squeezebox on the same Pi as openHAB a few months ago. I don’t remember exactly what went wrong, but I ended up having to restore my setup from a backup image without any success in getting Pandora connected. I wish I could remember what went wrong, but if others have had success with Pandora -> Squeezebox -> openHAB, then I might give it another go.

This is what I do. I have the LMS (Squeeze Server) running on the same box as OH2. Then I have two Pi’s running piCorePlayer (Squeeze Players) that stream music (including Pandora) into my Russound CAA66, which distributes to multiple zones in the house. I control it all using Basic UI and HABpanel.

The latest LMS nightly is available here.

The latest piCorePlayer is available here

@mhilbush, thanks for the links.

I actually spent some time with Squeezebox last night after making this post. I had a nearly successful setup with openHAB, LMS server, and the Squeezebox all on the same Raspberry Pi 3. I ran into problems running Squeezebox as a service. Otherwise, it ran well with no latency in playback.

I used this tutorial:

I looked into using PiCorePlayer. My only hesitation is that it looks like it will require a second Pi, as it only comes on a preinstalled image. Do you run it on any 1st generation Pis? I have some lying around but wouldn’t be sure they are powerful enough to run without latency.

One more question- do you know of any way to upvote or downvote songs in Pandora?


@Dome Glad you got it working.

I run it on 2nd generation with the HiFiBerry DAC. BTW, piCorePlayer now can run the LMS server, in addition to the squeezelite player.

Not from the openHAB UIs. I thought about adding that functionality to the squeezebox binding, but I haven’t found the time to do it.

@mhilbush, thanks for the suggestion.

I did end up splitting up and using two Pis. I had everything working okay on one, but was running into some reliability issues where the system would completely crash under high load. Rather than putz and try to solve it, I decided it would be a better solution to split up the computing tasks to two Pis.

I went a slightly different route than you, though. I looked into PiCorePlayer, and while it looks great, it doesn’t look as customizable as a standard Raspbian image. I wanted to run my MQTT server on my second Pi, mostly so my devices don’t freak out when I restart my openHAB Pi. I installed LMS and Squeezelite on the second Pi using the tutorial I mentioned above. I didn’t encounter any problems with that approach and it allowed me to install Mosquitto as well.

Okay, thanks. I was messing around with the IRCode channel hoping there’d be a workaround, but I’ve been leaving a LMS window open to do upvotes and downvotes.

Glad you got it all working. The beauty of this stuff is having the flexibility to set it up the way it works best for you.

I took a quick look at the LMS CLI doc. There’s a command line for doing the ratings for services like Pandora, Slacker, etc. So, I think it would be possible to define a channel on the player thing for setting the thumbs up/down rating. I’ll look more closely when I get a chance. :wink:

1 Like

I forgot to mention that, unless I’m mistaken, this LMS/Squeezelite approach requires a paid subscription to Pandora. I encountered an error in LMS that disappeared when I began a trial of Plus. You also get to repeat songs and don’t need to sit through ads so I have no problem paying for the service.