Hallo,
ich habe das Skript aus diesem Beitrag https://www.symcon.de/forum/threads/29684-Alarmanlage-Lupusec-XT2-Plus-auslesen?p=273552#post273552 für meine Alarmanlage angepasst.
Vielleicht kann es ja einer brauchen. Hat jemand Interesse sich mit der Contact-ID Auswertung der XT1 zu befassen? Das möchte ich als nächstes machen.
MfG Tommy
<?
// Dieses Script liest die Sensoren und deren Daten aus einer Lupus XT1 aus und stellt die Stati in einer Tabelle im Webfront dar
// Version für Lupus XT2 aus IP-Symcon Forum angepasst für die XT1
// Variablen definieren
$username = "xxxxx";
$password = "*************";
$ip = "x.x.x.x";
$url = 'http://'.$ip.'/setting/index.htm';
$id_html = 19074 /*[Alarmanlage Lupusec XT1\Sensoren]*/; // String-Variable mit Profil "~HTML-Box" für die Anzeigen im Webfront
// -----------------------------------------------------------------------------
// ab hier ist nichts mehr anzupassen
// Login
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
//$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$result=curl_exec ($ch);
// Sensorliste lesen
//$sensorliste = "http://".$ip."/setting/sensorInfo.htm";
$sensorliste = "http://".$ip."/action/sensorListGet";
curl_setopt($ch, CURLOPT_URL,$sensorliste);
$result=curl_exec ($ch);
// gültiges Json Format herstellen
$result = str_replace("/*-secure-", "", $result);
$result = str_replace("*/", "", $result);
$result = str_replace("no :", '"no" :', $result);
$result = str_replace("type :", '"type" :', $result);
$result = str_replace("zone :", '"zone" :', $result);
$result = str_replace("name :", '"name" :', $result);
$result = str_replace("attr :", '"attr" :', $result);
$result = str_replace("cond :", '"cond" :', $result);
$result = str_replace("battery :", '"battery" :', $result);
$result = str_replace("tamp :", '"tamp" :', $result);
$result = str_replace("bypass :", '"bypass" :', $result);
$result = str_replace("senrows :", '"senrows" :', $result);
$result = str_replace("ü", "ue", $result);
$result = str_replace("ö", "oe", $result);
$result = str_replace("ä", "ae", $result);
$result = str_replace("Ü", "Ue", $result);
$result = str_replace("Ö", "Oe", $result);
$result = str_replace("Ä", "Ae", $result);
//echo $result;
curl_close ($ch);
// Umwandeln von JSON in ein Array
$json = json_decode($result, true);
//print_r($json);
// neues Array $sensoren erstellen
// bei der XT1 ist die Sensornummer gleich der Zonennummer
foreach ($json['senrows'] as $sensor)
{
$zone = $sensor['no'];
$sensoren[$zone] = $sensor;
}
//ksort($sensoren);
//print_r($sensoren);
// HTML-Ausgabe erstellen
$html = "<table width='90%' align='left'>"; // Farbe anpassen oder style entfernen
$html .= "<tr><td><b>Sensornummer</b></td><td><b>Typ</b></td><td><b>Zonennummer</b></td><td><b>Name</b></td><td><b>Eigenschaft</b></td><td><b>Zustand</b></td><td><b>Batterie</b></td><td><b>Sabotage</b></td><td><b>Bypass</b></td></tr>";
foreach ($sensoren as $sensor)
{
// Zeilen mit Daten befüllen
$html .= "<tr>";
$html .= "<td>" . $sensor['no'] . "</td>"; // Sensornummer
$html .= "<td>" . $sensor['type'] . "</td>"; // Typ
$html .= "<td>" . $sensor['zone'] . "</td>"; // Zonennummer
$html .= "<td>" . $sensor['name'] . "</td>"; // Name
$html .= "<td>" . $sensor['attr'] . "</td>"; // Eigenschaft
$html .= "<td>" . $sensor['cond'] . "</td>"; // Zustand
$html .= "<td>" . $sensor['battery'] . "</td>"; // Battery
$html .= "<td>" . $sensor['tamp'] . "</td>"; // Sabotage
$html .= "<td>" . $sensor['bypass'] . "</td>"; // Bypass
$html .= "</tr>";
}
$html .= "</table>";
SetValue($id_html ,$html);
?>