How to: Build a LMS based whole house audio system

Excellent, thanks for the suggestion. Here’s what I’ve come up with and it’s working great:

  - alias: 'Clear media player playlists if inactive'
    trigger:
      platform: state
      entity_id: 
        - media_player.media_player_1
        - media_player.media_player_2
        - etc.....
      from: 'playing'
      for:
        minutes: 2   
    action:
      - service: media_player.clear_playlist
        data: {}
        target:
          entity_id: "{{ trigger.entity_id }}"
2 Likes

Looks amazing!
Thanks for the detailed explanation.

I’ve gone down the research rabbit hole on HASS + LMS + Raspberry Pi + squeezelite + etc etc for a very similar project I’m going to undertake in the coming months. But I’m confused about something that I don’t think I’ve seen people discuss, and I was wondering if someone could help fill in the gaps for me.

My family and I and most friends tend to prefer the Spotify desktop or mobile app as our primary audio interface - i.e. search, see your recommendations, playlists, ‘start radio’, library, etc, and it’s usually our preferred way to listen to and/or stream music.

Within Spotify, it’s easy for me to choose the audio playback device. For example, on the lower right corner of the desktop app:

image

It’s a really great user experience for us to choose which of those devices we want, hit play, and enjoy. So:

Is it possible somehow to have each HASS/LMS smart speaker ‘group’ available as their own ‘device’ choice within Spotify?

For example, if I have a Master Bedroom ‘group’ with two speakers (one left, one right, both in the ceiling), and another Master Bathroom ‘group’ (two speakers in the ceiling), and a third ‘Master Suite’ group that aggregates all 4 speakers, I’d like to choose ‘Master Bedroom’ within Spotify and only hear it in the bedroom, ‘Master Bathroom’ and only hear it in the bathroom, or ‘Master Suite’ and hear in both locations simultaneously.

If this is not possible, how do people use Spotify’s features (search, playlists, random radio, etc) and translate that to group/room selection playback as simply as possible? What user interface do they use?

Thanks!

I do not know if what you desire is possible. The LMS browse option gives access to apps, which include spotify, if configured.

When you select the spotify app you’re presented multiple ways to access your music. The interface isn’t the best but its functional. If you create playlists via the spotify app you can access from the LMS spotify app.

At the top of the interface, you can select the LMS output groups and individual media player you’d like to send music to.

My output music devices are a combination of squeezelite players and chromcast device.

That’s very helpful, thanks, I appreciate it. Kind of a bummer for me however.

I’ll have to dig deep into Spotify device connection support documentation when I get the chance to see if something like that can be enabled in code.

I’ll also want to see if I can eventually get voice commands working. For example, one of my favorite things to do when I’m not at my computer is to use Google Assistant with a bluetooth-connected speaker:

“Hey Google, play <song-name> by <artist> on Spotify”.

Bam, instant music.

And when that song is done, the Spotify ‘radio’ functionality automatically kicks in and starts playing genre/style-similar music in succession. Or you can just speak again and choose a new song. It’s especially great when in the shower or when cooking since you don’t have to touch any control surfaces.

A Hass local-only alternative to this would be the holy grail for me. I’ll definitely see what I can tinker with after I get the base LMS whole-home audio setup working.

Yes that works. Lms players are selectable in the Spotify app.

I did a cursory search with Spotify Connect documentation and the LMS Spotty plugin and did find some encouraging pointers, but I couldn’t get too deep into it before I had to address another obligation.

Thanks so much for confirming! This is fantastic news🎉

Like Brian, the Add-On wasn’t an ideal (though very slick, IMO) option for my environment due to network isolation, performance and settings that are needed for my Rio / Dell Receivers to function as SliMP3 emulators.

What I did do to address the SSL / iFrame issues was this…

I have Nginx Proxy Manager Add-on providing SSL for my HA instance internally and externally using a DuckDNS domain. I have another domain that is configured with a different SSL proxy (with authentication) for my LMS instance. That second proxy addresses the SSL / iFrame issue in the HA interface (when using SSL for HA access).

To resolve the HA name internally, I run split DNS using the Dnsmasq Add-on as my primary DNS server. Dnsmasq forwards my internal domain to another DNS server I have running. Probably not as efficient as some other configs would be but I had most of those services already configured.

Maybe a stupid question… but can I use Alexa to play music? Can I choose music providers like YouTube Music?