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

Just posted my workaround/hack and some thoughts on a fresh post (given there is a potential solution)

Good luck all, I hope it helps.

Walt

2 Likes

I have Sonos, with Hubitat that I would like to make a button to play a playlist from Pandora.

I went into Hubitat and pulled the uri and created a rule. Then I created a button to trigger that rule. But it’s not working.

I verified the uri is correct by pasting it in the Hubitat button for PlayTrack and it works great. I just can’t get it to work with Sharp Tools.

It says “executing rule” and nothing happens

I tried to upload two photos, but I keep getting the error on the forum

Welcome to the community and thanks for posting! What are you seeing in the SharpTools Rule Logs (for that rule) and in the Hubitat logs when you run the rule?

Edit: I’m also wondering if the encoding could be part of the problem. The %3a after x-sonosapi-radio:ST is equal to :

Sharp tools has a rule log?

Here’s what Hubitat says for the time I clicked the rule button

So strange it says “Kitchen Sonos is stopped”

Yes, you can find details here: Rule Execution Logs

I don’t have a Sonos device with me over the holidays to test with, so I would need more detail to be able to help troubleshoot.

Are there volume control actions in your rule? Otherwise I don’t understand why the logs are showing volume control responses.

I’m not seeing the action coming across from SharpTools being logged, so you would want to flip the Enable Logging switch on in the SharpTools ‘app’ in Hubitat so you can see the commands come across: image

Similarly, can you enable further debugging details for the device? It doesn’t seem like it’s showing attempted commands, just the resulting state change.

Just wanted to reiterate that this part seems odd to me. If you try the unencoded value, does it work in the Hubitat device details screen (for PlayTrack) and in your rule?

x-sonosapi-radio:ST:4255090724220561921?sid=236&flags=8300&sn=8

I got frustrated, uninstalled sonos integration in hubitat, and reconnected hubitat to sharp things. And bam it’s working. I didn’t change the rule machine or anything.

1 Like

I’ve recently integrated the juke box idea, but was trying to modify the rule to start playback at a certain point during the media. I am linked to my plex server through sonos, and have added the song that I want and can play the song successfully. However I am trying to get it to start about a minute into the song as the opening has a build up that I am trying to skip. Any ideas on way to achieve this?

@James I’ve had this running for some time flawlessly. I went back and looked at the methodology after a comment from @josh in the SmartThings community. As of right now, the Sonos preset is identified from the Current States data in the IDE. Any idea how to identify the preset after the IDE deprecates? You can probably wing it by trying different numbers but wondering if there will be a better way.

Does that information show up under your SharpTools User Page > Location > Thing?

It might be stale since it probably won’t have an event subscription, but you can reauthorize your devices to sync it over fresh.

1 Like

It sure does. Didn’t realize it would be there. Perfect!

1 Like

Hi

I have a playlist with songs from various sources added in the Sonos application, can I play such a playlist using sharptools? I was able to start radio stations with PlayPresent, how do I start a playlist?

The playlist might show up under the presets in ST if you can add it as a favorite in Sonos.

Hi James,

2 questions. Hope you can help answer.

  1. Will the rules that I created a while back work when Smartthings completely move away from Groovy? Will play preset numbers stay after Smartthings migration? If yes, how are we going to find out the preset number if IDE web site is gone? If not, is there any solution?

  2. Can we create rules to interact with Home Assistant Media Browser? As you know that all Sonos favorites are stored in Home Assistant Media Browser. I wonder if we can create similar rule to activate a Sonos favorites or playlists in Home Assistant Media. If the answer is “No”, will you and Josh have plans to implement this feature?

Thanks

Hi James or Josh,

Can you please help answer the below 2 questions?

Hi James,

2 questions. Hope you can help answer.

  1. Will the rules that I created a while back work when Smartthings completely move away from Groovy? Will play preset numbers stay after Smartthings migration? If not, is there any solution?

  2. Can we create rules to interact with Home Assistant Media Containers in browser? As you know that all Sonos favorites are stored in Home Assistant Media containers. I wonder if we can create similar rule to activate a Sonos favorites or playlists in Home Assistant Media. If the answer is “No”, will you guys have plans to implement this feature?

Thanks

It depends on how SmartThings handles the transition of the Sonos device DTH to Driver. If they maintain the same set of capabilities and commands, like they have for many devices, then yes.

Yes, you can control media players from Home Assistant in SharpTools Rules. I hadn’t personally tried to mimic this ‘jukebox’ playlist control, but from a quick test I was able to add Sonos or Spotify items to ‘My Sonos’, then when I was playing that item I could review the Home Assistant ‘Developer Tools’ → ‘States’ where I could see the media_playlist attribute.

Then if I took that attribute value and used it in a playPreset() command, it would start that ‘My Sonos’ favorite playing…

1 Like

Oh, thanks so much! I really appreciated that you showed me exactly how to tie the preset in Home Assistant to SharpTools. Thanks so much. Now, I can forget about smartthings migration away from Groovy. Now, I am so so relieved.

1 Like

Where do i go to get the “Get the preset number from the device page in SmartThings IDE site” for the Sonos playlist?
I want to add a few statations.
Thanks

With SmartThings in the process of shutting down the IDE, I would just complete a fresh sync of your devices by going through the authorization flow again from your SharpTools User Page → Manage Connections.

Once that’s done, you can view the device’s details by tapping the ... next to your location on your SharpTools User Page, then scroll down and tap on your device, then scroll down to view the presets attribute.

1 Like

Thank you. That’s very good info to know as IDE page will be decommissioned.