Create "Jukebox" Dashboard with Album Art for Echo or Sonos Devices

I have been using my dashboard to play music to my Echo speakers for sometime, and recently updated my “jukebox” dashboard after the Album Art tile release to give it a visual upgrade. So I am sharing my setup here for those who may be interested, and I am also including the steps for Sonos speaker too.:guitar:

Jukebox dashboard with album art, media player control and music tiles to change the playlist/station
jukebox_new_5

:warning: SmartThings no longer supports Echo Speaks since Sep 2020. See the SmartThings announcement for details.

Here are the instructions (tap each step to expand):

Add Sonos or Echo speakers to SmartThings/Hubitat hub and SharpTools

Sonos:

  • SmartThings: follow the steps here.
  • Hubitat: Install the “Sonos Integration” app in your Hubitat admin page, and follow the steps in the app to complete the setup.

Amazon Echo:

  • Echo Speaks (Hubitat): Since the Amazon Echo is not directly supported in Hubitat as a playback device, you can use Echo Speaks, which is a popular community smartapp/device driver for integrating echo devices.

:information_source: Echo Speaks originated in the SmartThings community, but was shutdown leading up to the shut down of Groovy on SmartThings.

Authorize to SharpTools
Once you’ve added your Sonos or Echo Speaks device to your hub, you can now sync the device to SharpTools in your SharpTools User Page → Manage Connections.

Add Music Player and Album Art tiles to the dashboard
  • Create or edit a dashboard and add the newly authorized Sonos/Echo device to the dashboard twice from the “Add Item” list.

    :bulb: We’ll leave one tile as the default music player control and change the other into an album art display

  • By default, both tiles are added as a ‘Music Player Tile’ layout. Change one of the tiles to the ‘Album Art Tile’ layout by tapping Change Layout from the tile’s edit menu.
    image
    image
    (You can of course change the dimension, colors, and other customization settings like other tiles in the way you prefer.)
Create rules to change the music/station/playlist

Echo Speaks:

  • Create a new rule. Leave the Trigger section empty and add an action in the Flow with Echo device selected.
  • Select “searchSpotify” command (or other streaming service you prefer)
  • Toggle the Advanced option at top right corner, input the music search term in the “String” field and delete the two “Number” fields, since we don’t need to change the play volume or restore volume. Save the action and save rule.

Sonos:

  • Create a new rule. Leave the Trigger section empty and add an action in the Flow with Sonos device selected.
  • SmartThings:
    • Select the playPreset command
    • Get the preset number from the device details:
      • Open your SharpTools User Page, tap the ... next to your desired location, scroll down and tap on the device in question.
      • Review the presets attribute and make note of the ‘id’ for each preset.
      ⚠️ The 'preset' information is not live data, so make sure to perform a fresh sync of the device details if you've changed your Sonos presets since the last time you synced devices to SharpTools. As a reminder, you can do this from your SharpTools User Page → Manage Connections

  • Hubitat
    • Since Hubitat’s Sonos integration doesn’t support the “playPreset” command, you will need to use the “playTrack” command with a specific uri of the song/playlist you want. The easiest way to find the uri is to play the desired song/playlist first and check the uri displayed in the Sonos device page at the Hubitat admin site (though even this can be hit-or-miss).

  • Save the action and rule
Add the newly created rule to dashboard (see the update below)
  • Edit the dashboard and add the newly created rules from the Rules section in the “Add Item” Iist
  • Adjust the position, dimensions or icon as you prefer.
    (Repeat the last couple steps to create multiple music rules and rule tiles for different ‘stations’)
  • Now you can tap on these rule tiles to change the music being played on your Echo or Sonos devices.

Your jukebox dashboard is ready to rock now! :metal:

– Update –
I updated my jukebox dashboard to take advantage of the recently released $.runRule("RuleID") syntax support in the Media Tile to show the artist profiles and to execute each individual rule created above when tapped. So if you prefer this artist image style over the icon, you can skip the step 4 above and do the following steps.

:information_source: With the release of Custom Icons, you could use that to upload custom images for use with your Rule Tiles for a more ‘integrated’ experience, but I still prefer using Media Tiles with an external image host so I can get the full bleed (edge-to-edge) look with the playlist tiles that I was going for. :slight_smile:

Create Media Tiles for artist profile images
  • Find the image you want to use or upload your preferred image to any image hosting site with public access, such as imgur.com, and get the URL address of the image.

  • Create a media tile using the URL address from previous step

  • Add this media tile to the jukebox dashboard and set this media tile’s tap action to “Open Hyperlink” and fill in $.runRule("RuleID") in the Hyperlink field. (“RuleID” is the last part of the URL when you edit the rule in the rule editor page, and please note the double quotes cannot be the slanted style double quotes, if you are editing this on an iOS device.)
    image

  • Adjust the position or dimension you prefer.
    (Repeat these steps to create multiple media tiles which can execute rule when tapped.)

  • Now you can tap on these media tiles to change the music being played on your Echo or Sonos devices.

9 Likes

Simply Smart 123 YouTube channel also had a video for this similar topic that you may be interested if you prefer video instructions. (Thanks Justin for the video.)

4 Likes

This is awesome, But… Is there a way to do this with Google Music?

On what type of device (eg. Sonos or Echo Speaks) and on which platform (eg. SmartThings or Hubitat)?

@Randy_Cooper, if you are using a Sonos speaker, you can create a Sonos playset and add songs from Google music into the playset, and then the rest steps are the same as mentioned in the post. But unfortunately Echo doesn’t Google music if you are using an Echo.

I have Sonos, plus Homes and Mini’s throughout the house and Hubitat.

1 Like

Thanks James, this is what I was hoping to hear. :slight_smile:

1 Like

Don’t forget to post your dashboard in the “show off dashboard” thread, so we can see your “jukebox” dashboard. I’ve learned people have so many creative setup with these and excited to see more. :sunglasses:

It’s going to have to wait, right now I’m not able to pull up any of my playlists.

So how do I get one tap on my dashboard to start playing on multiple Sonos devices in a group?

Unfortunately, neither Hubitat or SmartThings’ Sonos integration supports grouping natively.

If I remember correctly, you’re on Hubitat. Check out the posts in the following thread to see if they work for you. It sounds like some people are using the custom node-sonos-http-api, but this particular post about using a special setTrack() format in order to get existing players to join the group of another player (without other external code) seems particularly interesting:

2 Likes

Hi all, I am a new sharptools user. My amazon music setup is that I have 2 echo dots paired as left and right channels across the room from each other. I use voice commands to play music primarily from tune-in radio and amazon music. I came across a youtube video for “Creating a Smart Music Command Center | Sharptoold Dashboards” ( https://www.youtube.com/watch?v=Vz8bzMLz224&t=34s ). I liked the Idea of having presets to play my favorite music. After having difficulties getting it to work, I unpaired the speakers and I successfully setup the music center using 1 speaker.

I later found another video “Automate Multi-Room Music on Alexa Groups | SmartThings & SharpTools” ( https://www.youtube.com/watch?v=YcHr0L-UKwY&feature=youtu.be ). That gave me hope that I could at least use both speakers, even if not a stereo pair. This is not working out for me. I am hoping someone can help me solve this.

The difference in the rule is supposed to be as follows:

Single speaker rule

 (select Device = speaker1, select command = searchAmazonMusic, string = artist1)

Speaker Group rule

 (select Device = speaker1, select command = searchAmazonMusic, string = artist1 on group1)

Test1 = Orig working rule test1 says:

(select Device = speaker1, select command = searchAmazonMusic, string = artist1)

Results = sharptools reports exec rule / speaker lights up white / music plays

I then created speaker group using speaker1 and speaker2 called Group1

I Ran command vocally - play artist1 on Multigroup1

results = music plays on the group and alexa presents vol control for each speaker within the group.

Test2 = New rule test2 says:

 (select Device = speaker1, select command = searchAmazonMusic, string = artist1 on group1)

Results = sharptools reports exec rule / speaker does not respond.

Test3 = New rule test3 says:

  *  I added a trigger device  ( Virtual Switch 1 - switch changes to 'on') as presented in the 2nd video

 (select Device = speaker1, select command = searchAmazonMusic, string = artist1 on group1)

Results = sharptools reports exec rule / speaker does not respond.

Is anyone able to provide different results? Thx in advance.

Hi @johnm93359, welcome to the community and SharpTools family. Unfortunately, it appears Amazon Echo MRM (multi-room music) may have a weird out-of-sync issue when mixed using both group and individual echo music, even with the voice control. According to Anthony, the author of Echo Speaks, this MRM(multi-room music) can be observed in the native Alexa app as well.

That being said there is likely an issue with MRM itself, but I guess playing music using MGM, instead of mixing between single and MGM, may help better avoid the issue.

Thanks for the update. Now that you know, I think it might be a good idea to pin a note in the multiroom video. I spent over 8 hrs trying to understand and figure out why it worked in the video, but never for me. I had other concerns also. The volume buttons in the player seem to only be able to point to a single device. Also there would be global coding changes within the player needed to switch from one speaker group to another. My real desire wasnt really multiroom, it was for a speaker pair to give me stereo separation and additional volume. I still enjoyed the jukebox project and find it useful. I will default it to a single device (echo input) which I can then hardwire or bluetooth connect to my desired target speakers.

I’ve post the MRM issue note in my original MRM thread. I still think the MRM should work for you, and the out-of-sync issue should matter when Alexa was asked to play music on individual device and MRM after a few times. So I am curious why it doesn’t work for you at all.

Unfortunately, grouping is fundamentally not supported by SmartThings capability model. However, to adjust volume across to different devices, you may consider to use the Number variable, and a rule to set volumes on the desired devices using this Number variable, when this variable value changes. So the variable value can be adjusted in the dashboard, and populated to multiple devices’ volume level.

Hi James -

I’m trying to make this work. Hubitat hub user. The step about grabbing the uri: and referencing the “x-rincon-queue:RINCON…” string from the device view of the Sonos speaker I’m targeting and plugging that into the playTrack action doesn’t seem to have the desired result.

My desire is to have the rule execute a Spotify Playlist on that Sonos speaker. But, all I can get it to do is to simply continue playing an already chosen playlist on that speaker, and not even the one I want. If I use the native Sonos app and chose the Spotify playlist I want and begin playing it, then executing the rule will continue to play that playlist. But, if there is nothing playing in the queue on the speaker, executing the rule does nothing.

Any thoughts on how to program the rule to target a particular Spotify Playlist? Ideally the dashboard will have a few buttons that map to rules for playlist a, playlist b, playlist c, etc. and if I click the tile for playlist a, that playlist begins playing at the top of its list. Then if I click the tile for playlist b the playlist that was playing is blown away and replaced with playlist b.

Thanks for any thoughts.

There’s another trick you can use for playing Spotify playlists. Sonos supports a special format for playing Spotify content… let me see if I can find the notes from when I tested that…

Hi

I’m using the hyperlink + rule option to open a radio stream on my echo and it works really well.

Is there any way to have the tile function as a toggle? i.e.Tap to run rule and then tap to stop music?

Thanks

@Ronan_Ryan, there are a couple ways to do it. You can add a IF_Condition in the rule to check the current echo status. If the echo is not playing, then play the radio; otherwise, pause echo. (Please also note that you can just add the rule tile in the dashboard directly, instead of Hyperlink tile with the $runRule() syntax.)

The downside of this approach is you cannot tell the echo status by looking at the tile since rule or hyperlink tile doesn’t have “active/inactive” status.

The other approach is to create a True/False variable (or a virtual switch with a few more steps). Create a rule to play or pause echo based on the variable status, and another rule to sync echo’s status to the variable in case the echo is asked to play from somewhere else or via voice control. Then add this variable to the dashboard and change its tap action from toggle to hyperlink where you can do the $runRule() syntax like you did with the hyperlink tile, and customize the icon/color based on the variable value, so you can tell if echo is playing by looking the tile. See screenshots below for details:

Create a True/False variable.

Rule 1: Play or pause echo based on the variable status when this rule is executed from the dashboard

Rule 2: Sync variable status when echo status is changed

Add the variable to the dashboard and customize tap action, icon and color as desired.

1 Like

Hi Josh,
I’m not sure if I’m missing something here, but how do I connect to a spotify playlist I created to play on a specific sonos speaker? I can see how to do it with a song but not a playlist in spotify.
M