Hab das Script gerade mal auf die das Homegear Objekt umgeschrieben (quick hack):
index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Homegear RPC Server</title>
<!-- Bootstrap core CSS -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="jumbotron">
<div class="container">
<img style="float: left; margin-top: 13px; margin-right: 40px" src="Logo.png" />
<h2>Your</h2>
<h1>Homegear RPC Server</h1>
<h2>welcomes you!</h2>
</div>
</div>
<div class="container marketing">
<div class="row">
<div style="height: 350px" class="col-lg-4">
<span class="glyphicon glyphicon-education" style="font-size: 140px"></span>
<h2>Wiki</h2>
<p style="height: 40px">For help and tutorials visit the Homegear Wiki.</p>
<p><a class="btn btn-default" href="https://homegear.eu" role="button">Go there »</a></p>
</div><!-- /.col-lg-4 -->
<div style="height: 350px" class="col-lg-4">
<span class="glyphicon glyphicon-wrench" style="font-size: 140px"></span>
<h2>Reference</h2>
<p style="height: 40px">Visit the Homegear reference for information about using this RPC server.</p>
<p><a class="btn btn-default" href="https://www.homegear.eu/index.php/Homegear_Reference" role="button">Go there »</a></p>
</div><!-- /.col-lg-4 -->
<div style="height: 350px" class="col-lg-4">
<span class="glyphicon glyphicon-comment" style="font-size: 140px"></span>
<h2>Forum</h2>
<p style="height: 40px">If you still don't know, what to do, get help in our forum.</p>
<p><a class="btn btn-default" href="https://forum.homegear.eu" role="button">Go there »</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">Device Overview</div>
<div class="panel-body"><p>Here's a list of all devices known to Homegear.</p></div>
<table class="table">
<thead><tr><th>Name</th><th>Family</th><th>ID</th><th>Serial Number</th><th>Type</th><th>Interface</th><th>Firmware</th></tr></thead>
<?php
$hg = new \Homegear\Homegear();
$families = $hg->listFamilies();
$familyNames = array();
foreach($families as $value)
{
$familyNames[$value["ID"]] = $value["NAME"];
}
$devices = $hg->listDevices(false, array("FAMILY", "ID", "ADDRESS", "TYPE", "FIRMWARE"));
foreach($devices as $value)
{
//$info = hg_invoke("getDeviceInfo", $value["ID"], array("NAME", "INTERFACE"));
$info = $hg->getDeviceInfo($value["ID"], array("NAME", "INTERFACE"));
echo "<tr>";
echo "<td>".$info["NAME"]."</td>";
echo "<td>".$familyNames[$value["FAMILY"]]."</td>";
echo "<td>".($value["ID"] > 999999 ? "0x".dechex($value["ID"]) : $value["ID"])."</td>";
echo "<td>".$value["ADDRESS"]."</td>";
echo "<td>".$value["TYPE"]."</td>";
echo "<td>".$info["INTERFACE"]."</td>";
echo "<td>".$value["FIRMWARE"]."</td>";
echo "</tr>";
}
?>
</table>
</div>
</div>
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>© 2014-2016 Homegear UG</p>
</footer>
</div>
</body>
</html>
Allerdings bringt das homegear komplett zum Absturz:
root@homegearpi:/var/lib/homegear/www/rpc# ps aux | grep homegear
homegear 12208 4.8 4.5 432816 43584 ? TLsl 01:01 0:05 /usr/bin/homegear -u homegear -g homegear -p /var/run/homegear/homegear.pid
homegear 12503 0.2 2.0 108248 19112 ? SLsl 01:01 0:00 homegear -c /etc/homegear/ -rse
homegear 12520 0.5 2.7 432816 26204 ? S 01:03 0:00 /usr/bin/homegear -u homegear -g homegear -p /var/run/homegear/homegear.pid
homegear 12522 0.0 0.3 6660 2960 ? R 01:03 0:00 addr2line 0x20c4d8 -f -C -e /usr/lib/libhomegear-base.so.1
root 12524 0.0 0.2 5888 1900 pts/1 S+ 01:03 0:00 grep homegear
listFamilies
funktioniert noch, bei listDevices
steigt er aus.