Sonos API

  • 19 May 2021
  • 6 replies
  • 438 views

Badge +1

Hi,

Is there a Sonos API that caters for the selection of the HDMI or analogue audio input from a 3rd party control system?

With thanks

Keith


This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

6 replies

Not sure I understand the question, but you can find most data about the API on the Sonos partners page.

If you’re looking for something different, perhaps more information would be helpful. 

Badge +1

Thank you Bruce, 

I will go through the information in the link provided. 

I am controlling Sonos products using Crestron. Although I have all modules and can control the main functionality, I seem to be missing a direct way of selecting the HDMI (or analogue audio) input on products such as the Amp and Beam.

Not sure whether the API includes a command that caters for such.

With thanks

Keith

Userlevel 7
Badge +23

Are you asking to select TV input on a device? Sure, you can use the usual UPnP API (SetAVTransportUri) to do that. You’ll need to pass suitable args, easily determined with a quick network trace of using the official app.

You will not find any of this on the link Bruce provided, Sonos don’t document the UPnP API, and the public API is too limited to support useful features such as selecting TV input.

Badge +1

Thank you for your feedback, 

Is there any documentation or link with such commands in order to avoid having to st up a trace to determine such commands?

Also, once TV input is selected, is there a way to stop listening to this source without switching over to streamed music services and stopping them thereafter?

Thank you

 

Userlevel 7
Badge +20

You might want to take a look at SoCo (Sonos Controller Python library) or SoCo-CLI (Sonos command line controller). Both provide the ability to control Line-In inputs and playback state, but will not switch to ‘TV’ inputs (at least not in the SoCo-CLI case).

https://github.com/SoCo/SoCo

https://github.com/avantrec/soco-cli 

Userlevel 7
Badge +23

Also, once TV input is selected, is there a way to stop listening to this source without switching over to streamed music services and stopping them thereafter?

That’s easy: AVTransport:1.Pause(0)

or Stop, same difference for TV source.