Skip to main content

Sonos API

  • May 19, 2021
  • 6 replies
  • 746 views

Forum|alt.badge.img+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

Airgetlam
  • May 19, 2021

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. 


Forum|alt.badge.img+1
  • Author
  • Avid Contributor I
  • May 19, 2021

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


controlav
Forum|alt.badge.img+24
  • Lead Maestro
  • May 19, 2021

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.


Forum|alt.badge.img+1
  • Author
  • Avid Contributor I
  • May 19, 2021

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

 


pwt
Forum|alt.badge.img+20
  • Virtuoso
  • May 19, 2021

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 


controlav
Forum|alt.badge.img+24
  • Lead Maestro
  • May 19, 2021

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.