Loxone and Sonos

2,397 views
Skip to first unread message

Nikopol

unread,
May 5, 2017, 8:31:03 AM5/5/17
to Loxone English
Good morning gentlemen's

I am new in the Loxone community and would like to improve the integration of my Sonos system into Loxone
I integrated the already made "Sonos" basic command with succes.
I would like to be able to play preffered radio station or favorite playlist from my Sonos.

I already dig up in the SOAPACTION config file but I am lost :(
Anyone you could advice the code of these functions ?

Regards,

Nikopol.

David

unread,
May 6, 2017, 4:29:06 AM5/6/17
to Loxone English
Hi Nikopol,
welcome to the Loxone forum, how long have you been using Loxone?

It is relative easy to tell Sonos to do simple things from Loxone, and although possible to get more sophisticated it rapidly becomes complex. 
One big benefit of Sonos is grouping speakers together, and playing the same on multiple speakers, where you have more than one Sonos speaker. 

What I do is use another small computer (Raspberry Pi) that runs all the time next to Loxone. Loxone then sends a web request to the Raspberry Pi, and it then sends a sequence of commands to the Sonos units. Any small computer that you leave on would work.  The benefit of this approach is you can have logic to look at the state of Sonos and set it to what you want, you can provide multiple choices, you can do announcements / doorbell, etc. It is all done in Python code, using a great Sonos utility (that I help support on GitHub) called SoCo.

So if you want to keep it simple I can help with the commands you need directly in Loxone. If you want to get sophisticated, and are prepared to do a bit of programming in Python I can help also. 
Let me know which direction you prefer
Cheers David

David

unread,
May 6, 2017, 5:15:37 AM5/6/17
to Loxone English
Hi Again,
example of how to make Loxone to play a radio station on Sonos (in this example Magic Radio):
Using a Virtual Output for the player you want set the following paramters:

Command for ON: /MediaRenderer/AVTransport/Control

HTTP extensions for On:  SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"

HTTP Post command for ON: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><CurrentURI>x-sonosapi-stream:s8213?sid=254&amp;flags=32</CurrentURI><CurrentURIMetaData>&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;R:0/0/3&quot; parentID=&quot;R:0/0&quot; restricted=&quot;true&quot;&gt;&lt;dc:title&gt;Magic 105.4&lt;/dc:title&gt;&lt;upnp:class&gt;object.item.audioItem.audioBroadcast&lt;/upnp:class&gt;&lt;desc id=&quot;cdudn&quot; nameSpace=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot;&gt;SA_RINCON65031_&lt;/desc&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData></u:SetAVTransportURI></s:Body></s:Envelope>

HPPT method for ON: POST

This will set up the radio station in a paused mode - you then need to issue a play command - use the Loxone examples (or press play on the Sonos controller!)

To play a Sonos Playlist has more steps as you need to choose the playlist, then add to the queue, then play. All can be done.

It would be good if Loxone added some simpler functionality to these commands for Sonos, and or the ability to chain commands. Also the ability to see any errors that occur in sending commands.

Cheers Daivd





On Friday, 5 May 2017 13:31:03 UTC+1, Nikopol wrote:

Nikopol

unread,
May 8, 2017, 8:07:12 AM5/8/17
to Loxone English
Hi David,

Thanks for the information.
I am using Loxone since few weeks after struggling with the unstability of much more expensive Lifedomus.
I will look into Soco on Raspberry py

Regards,

Nikopol

Nikopol

unread,
May 9, 2017, 5:22:10 AM5/9/17
to Loxone English
Hello,

After spending hours to tweek the use of Sonos with a basic Loxone configuration, I found the link below very useful

http://forum.universal-devices.com/topic/14920-how-to-control-sonos-streaming-radio-stations/

Frederick Eyland

unread,
May 10, 2017, 4:13:34 AM5/10/17
to Loxone English
Hi,

For those who are interested:
Loxberry with SONOS plugin
or install yourself on a NAS webserver : PHPsonos

Rgds

Op vrijdag 5 mei 2017 14:31:03 UTC+2 schreef Nikopol:

Frederick Eyland

unread,
May 10, 2017, 4:15:03 AM5/10/17
to Loxone English
http://www.loxwiki.eu/display/LOXBERRY/Sonos4Loxone


Op woensdag 10 mei 2017 10:13:34 UTC+2 schreef Frederick Eyland:
Reply all
Reply to author
Forward
0 new messages