What is the SONOS "MediaURI" for the TV source?

Hi there!

I am currently trying to write a piston where when someone rings my Ring doorbell, my SONOS will play a short .mp3 file and then resume the current source. The current source is almost always the “TV” source.

For example:
SONOS source: “TV”
ring doorbell
SONOS source: (mp3 file)
plays
SONOS source: “TV” (resumes)

I’ve tried using “Play track and restore” and “Play track and resume” but none seem to work.

  1. What is the difference between “restore” and “resume”?
  2. What is the proper coding for having the SONOS switch source back to the TV?

Thanks!

1 Like

I figured it out!

In webCoRE, you tell SONOS to “Play Track” and the Track URL is:
x-sonos-htastream:RINCON_000E58BE9AA301400:spdif

This is for the optical audio (TV) source.

This doesn’t seem to be working for me. Is this Track URL always the same for every Sonos system, or is there a specific/unique URI for the TV source on my own Sonos that I need to find? And if so, how did you do it?

@MJRoark, what Sonos integration are you using? This topic is 2 years old.
I guess as you are a new user, you must be using a v3 Hub and added your Sonos recently. It should use now the Sonos LAN Websocket DH, what might not have the option as it was stated above, as it was using a different DH.

Yea I’m using a v3 hub and just added Sonos as you mentioned. Any idea how I would go about finding the URI now with Sonos LAN Websocket DH? I found my playerid from the device page in IDE but no idea where to go from there.

@MJRoark, I have looked at my Sonos, you can get the

playerId: RINCON_XXXXXXXXXXXXXXX

from the IDE, what is the part of the uri.
Regarding the spdif part, you need to verify that by yourself. I haven’t got a device with any input options.
But, probably, if you change the input on the device, then it would be reflected in the IDE under the mediaSource or maybe in the trackData, but this is my guess only.

But you can give a try using the referenced link above as,

x-sonos-htastream:RINCON_XXXXXXXXXXXXXX:spdif

where the RINCON part would be your playerID, regarding the WebCore playTrack, I am not sure, I believe that was for the old integration with the musicPlayer capability.

@joshua_lyon or @kewashi might can help you what you need to call, they implemented the new Sonos LAN Websocket integration to Sharptools.io and House Panel. I am not aware that the Minions at WebCore implemented it as well.

Thanks Gabor,

Yea it seems to be for the old integration. When I put my playerID in the URI and run the piston, it just pauses the music playing. Looking over the data on my device page in IDE doesn’t seem to give any clues, at least for me.

Can you set that source as MySonos Favourite? I know that Sharptools.io’s rule engine allows to control the Presets. It should be part of the Presets if it is saved in the MySonos in the Sonos app, then you will see it in the IDE and the New App’s Preset list.

1 Like

I did have that thought the other day, but unfortunately no. The source can’t be saved as a favorite, only stations and songs.

My previous/current solution is through the app Yonomi which does allow the creation of routines that include selecting TV as source in Sonos. So it’s definitely possible - just would rather find the solution in webcore rather than continuing to need Yonomi just for that function.

Ok, that is bummer. I need to call in the big guns, @BarryA.

Is there any way to change the input source on a Sonos with the new Sonos LAN Websocket integration, by using any of the current capabilities? If yes, than what is the trick?

1 Like

Unfortunately the current Sonos WebSocket integration does not support input source control at this time.

However we do have a MediaInputSource capability just for this very thing :sunglasses:: https://smartthings.developer.samsung.com/docs/api-ref/capabilities.html#Media-Input-Source

Having input source control for Sonos players with line-in and home theater inputs (optical/HDMI) would be quite valuable. I will look into getting input source support for Sonos on our roadmap.

Barry

3 Likes

Cheers @BarryA, appreciate the insight! Yes, that functionality would definitely be valuable to have. As mentioned above, the Yonomi platform has officially implemented this ability which is how I currently control it, although Yonomi just isn’t very reliable when integrating it with Google Assistant. So I’d love to hand over that control to SmartThings asap.

In the meantime, is there any guidance you could give a noob like myself on using the MediaInputSource capability you listed to effectively accomplish the same result either in SmartThings or webcore (or am I misunderstanding how it’s used?)?

2 Likes