Airplay Empfänger über Tuneblade via IPS steuern

Hallo Zusammen,

ich möchte meine Airplay Lautsprecher über Tuneblade (Windows) schalten. Hierzu gibt ein API von Tuneblade, mit dem ich auch über Browser http Befehle alles steuern kann. Leider bekomme ich es in IPS nicht hin:

Im Browser (Chrome) gebe ich den http request ein:
http://192.168.178.39:54128/v2

und bekomme als Antwort:
MASTER 0 100 Master
C869CD73D161 0 35 Apple TV WZ
38C9860A499F 0 15 Torstens iMac
88C2552C7A7F 0 25 Terrasse Nord
C869CD5D6D20 0 35 Apple TV Kino

Alles so, wie es sein soll. Die Daten möchte ich gerne in IPS haben und habe es so versucht:


$status = file_get_contents("http://192.168.178.39:54128/v2");  
echo $status;

Da kommt aber leider nur als Antwort:
Warning: file_get_contents(http://192.168.178.39:54128/v2): failed to open stream: HTTP request failed! HTTP/1 200 OK
in C:\IP-Symcon\scripts\53380.ips.php on line 5

Hat jemand eine Idee, wie ich das lösen kann?
Danke
TK

Im Anhang noch ein paar Infos zum Tuneblade API:
Please note the API isn’t finalized yet, and is likely to change a little in the final release, and it isn’t documented yet. To help you get started:

  • Service discovery is the same as previous i.e.either using Zeroconf / Bonjour, or manually find the IP and hard-code the port in TuneBlade settings.

  • The base url for the new API is http://<baseURL>/v2 . This request will return list of all receivers in plain text format (new line and space separated) in the content section of response. Sample output:

MASTER 0 100 Master
6BDF379163D2 0 35 TuneAero
FCF152F2C97B 0 86 Sony

  • The first row is for the master volume if it is enabled in TuneBlade settings, else it will not be there.
  • The first column is the ID of the receiver which should be used to query individual receivers.
  • The second column is the status of the receiver. 0 : Disconnected, 100 : Connected .
  • The third column is the volume at a scale of 100.
  • The fourth column is the friendly name of the receiver.
  • For querying status of individual receiver, use the ID received from the first request, column 1. For example for TuneAero in first example:

http://<baseURL>/v2/6BDF379163D2

Some other examples:

Get status:
http://<baseURL>/v2/6BDF379163D2/Status

Trigger connect:
http://<baseURL>/v2/6BDF379163D2/Status/Connect

Trigger disconnect:
http://<baseURL>/v2/6BDF379163D2/Status/Disconnect

Get volume:
http://<baseURL>/v2/6BDF379163D2/Volume

Set volume to 20:
http://<baseURL>/v2/6BDF379163D2/Volume/20

For master volume and status, use „master“ as the ID in the URL.

Nochmal hallo,

ich habe es jetzt selbst gelöst. Allerdings klappt das nur mit curl Befehlen in php. Hier mal mein script, um den Zustand aller Geräte abzufragen. Schalten geht natürlich auch, mache dann die nachten Tage. Die notwendigen Variablen habe ich alle „von Hand“ angelegt".

<?
$url = "192.168.178.39:54128/v2";	//TKServer3
$port = 54128;				//Tuneblade Einstellungen

$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,$url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1');
$query = curl_exec($curl_handle);
curl_close($curl_handle);

echo $query;
// echo gettype($query);

$array = explode("
", $query);
// echo $array[0]."
".$array[1]."
".$array[2]."
".$array[3];
$array21 = explode(" ", $array[1]); //Device1
$array22 = explode(" ", $array[2]); //Device2
$array23 = explode(" ", $array[3]); //...
$array24 = explode(" ", $array[4]);
$array25 = explode(" ", $array[5]);
// echo $array20[0]."
".$array20[1]."
".$array20[2]."
";
$AirplayID = 15005 /*[Musik\Airplay]*/;
$Device0 = "Master";
$Device1 = "TorstensiMac";
$Device2 = "YamahaWX10_1";
$Device3 = "ATVKino";
$Device4 = "ATVWZ";
$Device5 = "ReceiverKino";
$DeviceID0 = @IPS_GetObjectIDByName($Device0, $AirplayID);
$DeviceID1 = IPS_GetObjectIDByName($Device1, $AirplayID);
$DeviceID2 = @IPS_GetObjectIDByName($Device2, $AirplayID);
$DeviceID3 = @IPS_GetObjectIDByName($Device3, $AirplayID);
$DeviceID4 = @IPS_GetObjectIDByName($Device4, $AirplayID);
$DeviceID5 = @IPS_GetObjectIDByName($Device5, $AirplayID);
echo $DeviceID0."
".$DeviceID1."
".$DeviceID2."
".$DeviceID3."
".$DeviceID4."
".$DeviceID5;

SetValue(IPS_GetVariableIDByName("ID", $DeviceID1), $array21[0]);
SetValue(IPS_GetVariableIDByName("Status", $DeviceID1), $array21[1]);
SetValue(IPS_GetVariableIDByName("Volume", $DeviceID1), $array21[2]);
SetValueString(IPS_GetVariableIDByName("Name", $DeviceID1), $array21[3]." ".$array21[4]." ".$array21[5]);
SetValue(IPS_GetVariableIDByName("ID", $DeviceID2), $array22[0]);
SetValue(IPS_GetVariableIDByName("Status", $DeviceID2), $array22[1]);
SetValue(IPS_GetVariableIDByName("Volume", $DeviceID2), $array22[2]);
SetValueString(IPS_GetVariableIDByName("Name", $DeviceID2), $array22[3]." ".$array22[4]." ".$array22[5]);
SetValue(IPS_GetVariableIDByName("ID", $DeviceID3), $array23[0]);
SetValue(IPS_GetVariableIDByName("Status", $DeviceID3), $array23[1]);
SetValue(IPS_GetVariableIDByName("Volume", $DeviceID3), $array23[2]);
SetValueString(IPS_GetVariableIDByName("Name", $DeviceID3), $array23[3]." ".$array23[4]." ".$array23[5]);
SetValue(IPS_GetVariableIDByName("ID", $DeviceID4), $array24[0]);
SetValue(IPS_GetVariableIDByName("Status", $DeviceID4), $array24[1]);
SetValue(IPS_GetVariableIDByName("Volume", $DeviceID4), $array24[2]);
SetValueString(IPS_GetVariableIDByName("Name", $DeviceID4), $array24[3]." ".$array24[4]." ".$array24[5]);
SetValue(IPS_GetVariableIDByName("ID", $DeviceID5), $array25[0]);
SetValue(IPS_GetVariableIDByName("Status", $DeviceID5), $array25[1]);
SetValue(IPS_GetVariableIDByName("Volume", $DeviceID5), $array25[2]);
SetValueString(IPS_GetVariableIDByName("Name", $DeviceID5), $array25[3]." ".$array25[4]." ".$array25[5]);

?>