Home‎ > ‎Home Automation Project‎ > ‎

php - power_consumption

<html>
<head>
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<title>Power consumption</title>
</head>
<body>
<h1>KaaSwe</h1>
<a href="/index.php">Back</a><br><br>
<?php
//phpinfo(INFO_MODULES);

$file_handle = fopen("/home/jl/rrddata/vp.log", "rb");

while (!feof($file_handle) ) {

$line_of_text = fgets($file_handle);
$parts = explode('-', $line_of_text);

$datum = substr($parts[0],0,6);
$el = $parts[1];
$total = ($el - $oldel) / 1000;
print "Datum:" . $datum . " - " . $el . " W/h - <b>Total Last day: " . $total . " kW/h</b><BR>";
$oldel = $el;


}

fclose($file_handle);
?>
</body></html>
Comments