Playing audio controlled by OpenHAB - Hardware/Software advice needed

Hi,
I’m looking for a way to play music, controlled by OpenHAB. I want to play Spotify playlists, and online radio (http://something.com/streaming.mp3).

My current set up are two speakers, a Stereo power amplifier (Pro-Ject Amp Box) and a Chromecast Audio to the Stereo amplifier. Using the ChromeCast binding, I am able to play online radio, and pause any music that is currently playing through the Chromecast. However, the Chromecast binding does not let me stream specified Spotify playlists. I also tried the Spotify binding and the python script to control Spotify through Chromecast. This does not seem to be possible. I’ve searched other forums as well, and it seems that Chromecast cannot be controlled through the standard Spotify Web API. So I’m looking for an alternative solution.

I’m considering to purchase a Raspberry Pi (my first), and a Hifiberry DAC+, and connect it using RCA cables. I’m not sure if there are better DACs available than Hifiberry.

That’s the hardware part. Now I need to find a way to control it via OpenHAB. I have no other requirements than:

  • Play/Pause specified Spotify tracks trough OpenHAB;
  • Play/Pause specified online radio trough OpenHAB;

What I’ve discovered so far:

  • Volumio seems to be a solution that allows playing webradio and Spotify. And it seems that a Volumio binding is being developed (although not yet part of the OH distribution). A channel “playRadioStream” seems to cover online radio. I’m not sure if anyone has experience initiating a specified Spotify playlist using this binding? There also seems to be an MPD binding, but it seems to be less mature than the Volumio binding (I might be wrong).
  • The “Pi MusicBox” seems to be able to play webradio and Spotify. But besides the MPD binding, I don’t see any integration options with OH.
  • Another solution is to install Raspotify on my Raspberry. This allows me to control audio on my Raspberry trough the Spotify Web API (using the Spotify binding or python script). Next to that, I could use a standard player (e.g. MOC) to play my online radio directly. But here I don’t understand how Raspotify and MOC would ‘work together”. What if both receive a command to play something? Will all music play simultaneously? Also, how can I trigger a command-line based player on my Raspberry to play music from OpenHAB (which is installed on a different machine)?

I prefer a stable, proven, out-of-the-box solution, instead of trying to build/program something myself.

Based on research I’ve done so-far, I’m inclined to go for Raspberry Pi with Hifiberry and Volumio. But I would like to know if other people can share some interesting experiences/insights in playing audio triggered by OpenHAB.

Thanks!

Dries

2 Likes

Use an old phone or get an Amazon echo or tun Spotify on an old pc somewhere,.
There are loads of cheap android tv type devices on eBay selling for next to nothing that can host Spotify.
Find one that suits your needs and use it as a “Spotify server”
Odds you you have something in a drawer at home, but if not, all your device needs is the ability to run Spotify natively and an Audio out.

1 Like

Hi Alan,

Thanks for your feedback!

Yes, pretty much any device can run Spotify. But I’m not sure about the DAC onboard. A phone’s DAC is not designed for the purpose I have in mind. That’s why Hifiberry is a solution to enhance the Raspberry.

Secondly, it would need to be able to play both Spotify and any radio station (web streaming), preferably integrated in one player, so e.g. Spotify stops playing when I select a radio station.

But thanks for your feedback. Honestly, I hadn’t really considered that option before.

Is there anyone out there who can share some relevant insights? Thanks. :slight_smile:

You may try searching the forum for logitech media server (aka squeezebox), there are a few threads (old and current, e.g., How to integrate a rasp pi multiroom (with hifiberry amp)?) with drawbacks and benefits. Not sure about the OH2 integration for spotify playlists, but the system (it is based on a server and separate player infrastructure) itself handles spotify pretty well, I just never tried to use OH2 for any more than basic player commands.