Hallo zusammen,
ich bin mir nicht sicher, ob es eine "offizielle" Funktion zum Gruppieren über dieses Addon gibt. Falls nicht würde ich gerne meine Lösung mit euch teilen.
Einfach in dem Addon-Verzeichnis "/usr/local/etc/config/addons/www/sonos2" eine Datei "groupandplay.html" anlegen und dort folgenden Inhalt einfügen. Falls man mehr oder weniger Player hat muss man natürlich untenstehenden Code anpassen.
Anschließend werden in meinem Beispiel bei Aufruf von
http://homematic.fritz.box/addons/sonos ... dplay.html die 3 Player gruppiert und Radio Bob abgespielt.
Ich nutze das, um per Siri Kurzbefehl überall Musik abzuspielen und funktioniert sehr gut.
Code: Alles auswählen
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<script type="text/javascript">
var addonUrl = "http://homematic.fritz.box/addons/sonos2/sonos2.cgi"
var mainZone = "wohnzimmer"
var addMemberOne = "pool"
var addMemberTwo = "bad"
var playRadio = "s231558"
var xmlHttpGroupOne = new XMLHttpRequest();
xmlHttpGroupOne.onreadystatechange = function() {
if (xmlHttpGroupOne.readyState == 4 && xmlHttpGroupOne.status == 200) {
var xmlHttpGroupTwo = new XMLHttpRequest();
xmlHttpGroupTwo.onreadystatechange = function() {
if (xmlHttpGroupTwo.readyState == 4 && xmlHttpGroupTwo.status == 200) {
var xmlHttpPlay = new XMLHttpRequest();
xmlHttpPlay.onreadystatechange = function() {
//Nun sollte Musik abgespielt werden ;-)
}//xmlHttpPlay.onreadystatechange
xmlHttpPlay.open("GET", addonUrl+"?zone="+mainZone+"&action=radio&radio="+playRadio, true);
xmlHttpPlay.send(null);
}//xmlHttpGroupTwo.readyState == 4
}//xmlHttpGroupTwo.onreadystatechange
xmlHttpGroupTwo.open("GET", addonUrl+"?zonen="+mainZone+"&action=addmember&member="+addMemberTwo, true);
xmlHttpGroupTwo.send(null);
}//xmlHttpGroupOne.readyState == 4
}//xmlHttpGroupOne.onreadystatechange
xmlHttpGroupOne.open("GET", addonUrl+"?zonen="+mainZone+"&action=addmember&member="+addMemberOne, true);
xmlHttpGroupOne.send(null);
</script>
<title>Group and play</title>
</head>
<body>
</body>
</html>