Squeezebox and Alexa setup?

I have Alexa working my media players in so much that they will switch on and off with the aid of the media player discovery in HA (also have emulated_hue in config). I am new to a lot of this although I have had a Max2play set up for some time, I would love to be able to ask alexa to play a song or playlist from Spotify and it would play on my squeezeboxes through my DAC and good speakers. Any guidance would be greatly appreciated.

Do you have Alexa working with emulated hue, or with the Alexa component? If you already have SSL set up and can access your HASS from outside the network, setting up Alexa is easy. I have several intents that work wtih my Squeeze Server. Since Squeeze understands Spotify URIs (via a plugin), it’s pretty easy. This one does some extra stuff (like runs a script that enables shuffle via the Squeeze API), but might be useful for ideas. I say “Alexa, ask Home Assistant to play…”

PlayMediaIntent:
  action:
    - service: shell_command.squeeze_shuffle_songs
    - service: media_player.play_media
      data: 
        entity_id: media_player.squeezeplay
        media_content_type: PLAYLIST
      data_template:
         media_content_id: >
          {% if MediaSource == 'random music' -%}
            {{ ["spotify:user:ih8gates:playlist:3C4vzY7mOqylGLmGRlPplf", "spotify:user:ih8gates:playlist:32kolpL0K7jto6GQZE2skl", "spotify:user:ih8gates:playlist:0TRYnIGISaQV3l2va1dPCp", "spotify:user:ih8gates:playlist:6PDDqtno9XiHU0YbmysQEp", "spotify:user:ih8gates:playlist:0MHHBF5wsI3zweHaYBp1t8","spotify:user:ih8gates:playlist:0RFECUW6B7mGZlQPwytJgd","spotify:user:ih8gates:playlist:7I3IZTkHbX5z5nyIbiQ84P","spotify:user:ih8gates:playlist:3aVhoe60krjCtm0owZGwu8","spotify:user:ih8gates:playlist:0EddcASHBaRuWQFnlw852q","spotify:user:ih8gates:playlist:3v4uykRhSasEaS8ApIM7Sp","spotify:user:ih8gates:playlist:7vPmKlFOMMdY1Uw1ZQNMIn","spotify:user:aroonk:playlist:0AobtqBqO5K8g4rYxe1kjY","spotify:user:aroonk:playlist:5yrUuAfnQsW9ulh2UvMhBe","spotify:user:aroonk:playlist:666eHSlGkeanMlsEn9F0am"] | random}}
          {%- elif MediaSource == "when I'm feeling the way I'm feeling" -%}spotify:user:ih8gates:playlist:3C4vzY7mOqylGLmGRlPplf
          {%- elif MediaSource == "discover weekly" -%}spotify:user:spotifydiscover:playlist:6SMEbA1EtrxeSdmwv8j4vu
          {%- elif MediaSource == "be chill kids" -%}spotify:user:ih8gates:playlist:3v4uykRhSasEaS8ApIM7Sp
          {%- elif MediaSource == "churn" -%}spotify:user:ih8gates:playlist:2zR9pjiI3EmrlvGKWo6MAV
          {%- elif MediaSource == "snoozy" -%}spotify:user:ih8gates:playlist:7I3IZTkHbX5z5nyIbiQ84P
          {%- endif %}
1 Like

Thanks for that, that would be great to be able to do that! I currently have Alexa working with emulated hue and I can ask “Alexa, turn on Red” when red is the name of my squeeze box kitchen radio and this works, Just can’t figure out how you made the next step, what is the plugin?

Sorry. Meant to link to it. It’s a component.

Also:

Do scripts show themselves to Alexa with emulated hue? If you want to just get a playlist happening quickly ih8gates has a great setup in the share my projects section here that you could adapt parts of to suit.

I use Ha-Bridge but I imagine it’s the same - I just say “Alexa, turn on scriptname.” and away it goes.

Here’s a simple script to send an internet stream to a media player, in this case Chromecast Audio. You can see the content type and data is the bit with the payload. As above,

media_content_type: PLAYLIST

media_content_id: playlist name

psbient_cca:
 alias: Psybient Radio
 sequence:
    - service: media_player.play_media
      entity_id: media_player.khonsu
      data:
        media_content_id: http://goo.gl/RKuUMG
        media_content_type: audio/mp3

Thanks for that Barry, I haven’t tried scripts with Alexa and emulated hue yet so I don’t know how it will perform. I will look into the links.

Just as a follow up, I go this working and it is performing well, below is an example (and a good soul playlist if I do say so myself):

soul :
alias: Soul
sequence:
- service: media_player.play_media
entity_id: media_player.max2play
data:
media_content_id: spotify:user:pap247:playlist:7M9t0U2eR4BDWCPFSocd9F
media_content_type: audio/mp3

2 Likes

Maybe slightly OT since it´s not including HASS.
But there is also this project:
http://www.hab-tunes.com/

1 Like

That looks interesting, thanks for the link :slight_smile:

Just so you know, there is now a certified Alexa LMS skill in the Amazon skills store for en-US and en-GB and it needs no developer account or beta access or such. Setup is actually quite easy using ngrok. Details are at https://mediaserver.smartskills.tech