Status

[insert_php]

function elapsed_slice($arg1,$arg2,$arg3)
{
$SP = “”;
$CALC = floor($arg3/$arg1);
$Remaining = $arg3 – $CALC*$arg1;
if ( $arg1 <> 1 ) {
$SP = ” “;
}
switch ($CALC) {
case 0: $TEXT=””;
break;
case 1: $TEXT=$CALC.” “.$arg2.$SP;
break;
default: $TEXT=$CALC.” “.$arg2.”s”.$SP;
break;
}
print($TEXT);
return $Remaining;
}

$Names = array(‘Garden Lights’,’Cabinet’,’Pool Pump’,’Pool Light’,
”,’Main Water Feature’,’Lounge Lights’,
‘Fireplace’,’Fireplace LED’,’Table Lamp’,
‘Rock Lamp’,”,”,”,”,”);

print (“This page shows the status of various devices and servers

“);
print (”

House Status

\n”);
print (”

“);
$url = ‘http://host.while.org.uk/ws/’;

$result = file_get_contents($url.”GetLastSensorValue.pl?sensor=F8D111BD3962-0″);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf(”

“,$value, $updated);

$result = file_get_contents($url.”GetLastSensorValue.pl?sensor=F8D111BD3962-1″);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf(”

“,$value, $updated);

$result = file_get_contents($url.”GetOutTempValue.pl”);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf (”

“,$value, $updated);

$result = file_get_contents($url.”GetLastSensorValue.pl?sensor=F8D111BD3962″);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf(”

“, $value, $updated);

$result = file_get_contents($url.”GetLastSensorValue.pl?sensor=11338″);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf (”

“,$value, $updated);

$result = file_get_contents($url.”GetLastSensorValue.pl?sensor=11233″);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf (”

“,$value, $updated);

$result = file_get_contents($url.”GetLastSensorValue.pl?sensor=10916″);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf (”

“,$value, $updated);

$result = file_get_contents($url.”GetLastSensorValue.pl?sensor=10731″);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf (”

“,$value, $updated);

$result = file_get_contents($url.”GetPressureValue.pl”);
$value = substr($result, 20);
$updated = substr($result, 0, 20);
printf (”

“,$value, $updated);
print (“

Current house power consumption: %d watts updated %s
Current cattery power consumption: %d watts updated %s
Current external temperature: %2.1f degrees updated %s
Current study temperature: %2.1f degrees updated %s
Current temperature cattery office: %2.1f degrees updated %s
Current temperature Sammy’s Lodge: %2.1f degrees updated %s
Current temperature Golly’s Lodge: %2.1f degrees updated %s
Current temperature Mitzy’s Lodge: %2.1f degrees updated %s
Current air pressure: %2.1f mbar updated %s

“);

[/insert_php]