Unfortunately I cannot seem to find anything that does the opposite. I already tried to find the proper commands through Wireshark but it seems rather complicated to me.
06.07.2016, 22:33 (This post was last modified: 06.07.2016, 22:34 by Erwin van der Zwart.)
Hi David,
I think you are looking for 'BecomeGroupCoordinator' but you probably need to pass extra fields like InstanceID, OtherMembers etcetera and you might need to add some extra's to the
upnpcmd function as it is currenty written for the basic operations and some extended functions but not all that are available.
You should use Device Spy from DeveloperToolsForUPnPTechnologies to browse your sonos and see the needed fields.
Be aware it's time consuming as i know now, i just finished the Sonos app, its working 100% and now i'm running test now to debug and improve the scripting.
Here is already a teaser screenshot for what is comming in the next period (;
To group players you need set the uri of each player to the master player. note as you add each player to the group, this takes time to do, which is why there is an sleep added after each player is placed into the group. Once you have groups the players, set their volume then you can set what to play on the master.
One BIG note to point out when you work with SONOS implementation you will need to make sure that ALL sonos players are be configured with a static IP. The only way to do this is use DHCP reservation which is configured for each player in the router.
-- try connecting to upnp endpoint
res, err = client:connect(host, port)
if not res then
return nil, err
end
-- guess service name based on command
if cmd =='SetGroupVolume' or cmd == 'SetGroupMute' or cmd == 'SnapshotGroupVolume' then
service = 'GroupRenderingControl'
elseif cmd == 'SetVolume' or cmd == 'GetVolume' or cmd == 'SetMute' or cmd == 'GetMute' then
service = 'RenderingControl'
else
service = 'AVTransport'
end
Hello Roger, apparently I forgot to reply to your post. My apologies for that!
Just wanted to thank you because what you suggested works like a charm :-)
Static IP is not an option on the basic router I have, but with the code I got from Erwin van der Zwart I can periodically search for the IP address that matches a specific zone name. So no problem there.
Erwin has successfully finished and debugged SONOS app for LogicMachine which we have placed in the app store. Please fee free to test and post your comments/suggestions.
Cheers Erwin van der Zwart!
Hello, still having a minor problem with grouping and ungrouping players.
I use KNX pushbuttons to control my SONOS players and use following command to stop the player if it's playing (1 toggle button to switch between ON and OFF)
Code:
-- Pause if status is playing, play otherwise
if (status_beneden == "PLAYING") then
upnpavcmd(IP_Beneden, 1400, 'BecomeCoordinatorOfStandaloneGroup')
upnpavcmd(IP_Beneden, 1400, 'Pause')
This works flawlessly if the player is indeed part of a group: the player is removed from the group and paused, as one would expect
When the player is not part of a group however the first command causes some sort of stop command and the current playlist is not paused but stopped.
To illustrate this see the attached screenshots:
screenshot 1 and 2 when the player was part of a group and was successfully ungrouped
screenshot 3 and 4 when the player was not part of a group and thus stopped instead of paused
Seems like I would need a code to first check whether the player is part of the group so I could avoid the first command line with an IF conditional check.
23.02.2019, 07:38 (This post was last modified: 23.02.2019, 08:05 by lenze90.)
(07.07.2016, 13:34)rocfusion Wrote: Hi,
To group players you need set the uri of each player to the master player. note as you add each player to the group, this takes time to do, which is why there is an sleep added after each player is placed into the group. Once you have groups the players, set their volume then you can set what to play on the master.
One BIG note to point out when you work with SONOS implementation you will need to make sure that ALL sonos players are be configured with a static IP. The only way to do this is use DHCP reservation which is configured for each player in the router.
-- try connecting to upnp endpoint
res, err = client:connect(host, port)
if not res then
return nil, err
end
-- guess service name based on command
if cmd =='SetGroupVolume' or cmd == 'SetGroupMute' or cmd == 'SnapshotGroupVolume' then
service = 'GroupRenderingControl'
elseif cmd == 'SetVolume' or cmd == 'GetVolume' or cmd == 'SetMute' or cmd == 'GetMute' then
service = 'RenderingControl'
else
service = 'AVTransport'
end
-- send http request
res, err = client:send(reqs)
if not res then
return nil, err
end
-- get reply and close connection
res, err = client:receive('*a')
client:close()
return res, err
end
thanks,
Roger
Hello everybody,
with me this does not work with the following script unfortunately.
My second Sonos is simply started, but not grouped with the master.
Can anyone help me? is it possible that you can't group Sonos One with Sonos Beam?