LG Fernseher einbinden

Hallo Community,

ich besitze einen LG-Fernseher 42LM671S mit LAN und WLAN. Leider habe ich keine Ahnung, ob und wie ich das gute Stück mit IPS "bearbeiten kann. Eine App habe ich, damit kann man zumindest Einschalten und Programme wählen. Kennt zufällig jemand eine Möglichkeit, das gute Stück in IPS einzubinden (bei Google nix gefunden).

Viele Grüße
Jürgen

Abend,

ich hab da auch mal vor ein paar Wochen recht lang gesucht und das einzige was ich gefunden hab was annähernd in die Richtung geht ist das hier:

hoohead

Hab leider selbst noch keine Zeit gehabt mich da rein zu arbeiten.

VG
Michael

Vielen Dank, das sieht schon ganz interessant aus. Werde nächste Woche mal ein bischen spielen…

Hallo,
nach langem suchen im Internet, habe ich bisschen was zusammengesucht und in IPS eingebunden.
Durch ein WLan Paketmitschnitt habe ich erfahren das die „Auid“ von Spotify bei mir die „000000000001d49b“. Leider weiß ich nicht ob es bei jedem anders ist oder bei allen gleich. Weiterhin habe ich es noch nicht hinbekommen die anderen APP IDs auszulesen.(nur durch den Paketmitschnitt)

Folgende Quellen habe ich verwendet
https://github.com/SteveWinfield/PHP-LG-SmartTV
https://github.com/openhab/openhab/pull/925/files?short_path=0082691
http://developer.lgappstv.com/TV_HELP/index.jsp?topic=%2Flge.tvsdk.references.book%2Fhtml%2FUDAP%2FUDAP%2FLaunch+Application+Controller+Host.htm


<?php
global $paringkey;

$lgip = "192.168.0.1"; // LG Netzwerk IP
$paringkey == "123456"; // LG TV Paring Key


if (isset($_POST["paring"]) and $_POST["paring"] == "")
{
	auth("<auth><type>AuthKeyReq</type></auth>",$lgip); //paring

	}
if (isset($_POST["paring"]) and $_POST["paring"] != "")
{
	auth("<auth><type>AuthReq</type><value>".$paringkey."</value></auth>",$lgip);
		setcookie("paring", $_POST["paring"]);

	}
if (isset($_POST["cmd"]) )
{
	lgcommand("<command><name>HandleKeyInput</name><value>".$_POST["cmd"]."</value></command>",$lgip);

	}



function auth($data,$lgip)
{
$sock = fsockopen($lgip, 8080);
fputs($sock, "POST /roap/api/auth HTTP/1.1
");

fputs($sock, "Host: ".$lgip."
");
fputs($sock, "Content-type: application/atom+xml
");
fputs($sock, "Content-length: ". strlen($data) ."
");
fputs($sock, "Connection: close

");
fputs($sock, $data);

while(!feof($sock))
$temp = fgets($sock, 4096);
fclose($sock);

preg_match('/(<session>)(.*?)(<\/session>)/i',  $temp , $match);
if (strlen($match[2]) > 4)
{ //echo "Paring OK";
}
}

function lgcommand($data,$lgip)

{
$sock = fsockopen($lgip, 8080);
fputs($sock, "POST /roap/api/command HTTP/1.1
");
fputs($sock, "Host: ".$lgip."
");
fputs($sock, "Content-type: application/atom+xml
");
fputs($sock, "Content-length: ". strlen($data) ."
");
fputs($sock, "Connection: close

");
fputs($sock, $data);
return $data;

while(!feof($sock))
$temp = fgets($sock, 4096);
fclose($sock);

}

@auth("<auth><type>AuthKeyReq</type></auth>",$lgip);
@auth("<auth><type>AuthReq</type><value>123456</value></auth>",$lgip);


sleep(1);
lgcommand("<command><name>AppExecute</name><auid>000000000001d49b</auid></command>",$lgip); //auid aus mitschnitt


?>

Einfache Befehle der Fernbedienung kann man z.b. mit


lgcommand("<command><name>HandleKeyInput</name><value>14</value></command>",$lgip);  //Fernbedinung links

lgcommand("<command><name>HandleKeyInput</name><value>13</value></command>",$lgip); //Fernbedinung unten

lgcommand("<command><name>HandleKeyInput</name><value>20</value></command>",$lgip); //Fernbedinung OK

Die werte kann man auf der LG Seite entnehmen
http://developer.lgappstv.com/TV_HELP/index.jsp?topic=%2Flge.tvsdk.references.book%2Fhtml%2FUDAP%2FUDAP%2FLaunch+Application+Controller+Host.htm

Was ich noch hinbekommen habe ist das aktuelle TV Bild in Screenshots in IPS einzubinden über den Image Graber


file_put_contents('screen.jpeg', $tv->queryData(TV_INFO_SCREEN));

Ich denke das lässt sich noch eleganter lösen.

Über Unterstützung wäre ich dankbar.

Gruß

Xackery