Skulle vilja ha 2 st tempgivare åt olika väderstreck och att den visar lägsta temperatur på en graph .
Går det ?
Kod: Markera allt
<?php
$north = exec("wget -O - -q http://10.0.20.11/utenorr.txt");
$east = exec("wget -O - -q http://10.0.20.11/uteost.txt");
if ($north < $east){
$lowest = "North";
$temp = $north;
}
else{
$lowest = "East";
$temp = $east;
}
echo "$lowest har lgst temp: $temp grader";
exec("echo " . $temp . " > /home/essunga/public_html/wwwroot/temperature_lowest.txt");
?>
Kod: Markera allt
#!/usr/bin/perl
use RRDs;
my $cur_time = time();
my $start_time = $cur_time - 86400; # set end time to 24 hours ago
use HTTP::Date;
my ($date, $time) = split(" ", HTTP::Date::time2iso());
my ($hour, $min) = split(":", $time);
RRDs::graph "/home/essunga/public_html/wwwroot/onewire/dualindoor_temp_dag.png",
"--start= $start_time",
"--end= $cur_time",
"--title=Inside the house",
"--lazy",
"-h", "160", "-w", "550",
"-a", "PNG",
"-v Celsius",
"--slope-mode",
"--watermark= http://essunga.org | Graph generated\: $date kl\: $hour\:$min",
"DEF:livingroom=/home/plutonium/scripts/RRD_DB/owfs-livingroom_temperature.rrd:temp:AVERAGE",
"DEF:bedroom=/home/plutonium/scripts/RRD_DB/masterbedroom_temp.rrd:temp:AVERAGE",
"DEF:agust=/home/plutonium/scripts/RRD_DB/agust_temp.rrd:temp:AVERAGE",
"DEF:jonathan=/home/plutonium/scripts/RRD_DB/jonathan_temp.rrd:temp:AVERAGE",
"AREA:livingroom#ccffcc",
"LINE2:livingroom#009900:Living room ",
"GPRINT:livingroom:MIN: Min\\:%6.1lf",
"GPRINT:livingroom:MAX: Max\\:%6.1lf",
"GPRINT:livingroom:AVERAGE:Avg\\:%6.1lf",
"GPRINT:livingroom:LAST:Now\\:%6.1lf degrees C\\n",
"LINE2:bedroom#46E4F9:Master bedroom ",
"GPRINT:bedroom:MIN: Min\\:%6.1lf",
"GPRINT:bedroom:MAX: Max\\:%6.1lf",
"GPRINT:bedroom:AVERAGE:Avg\\:%6.1lf",
"GPRINT:bedroom:LAST:Now\\:%6.1lf degrees C\\n",
"LINE2:agust#191970:Agust bedroom ",
"GPRINT:agust:MIN: Min\\:%6.1lf",
"GPRINT:agust:MAX: Max\\:%6.1lf",
"GPRINT:agust:AVERAGE:Avg\\:%6.1lf",
"GPRINT:agust:LAST:Now\\:%6.1lf degrees C\\n",
"LINE2:jonathan#CD5C5C:Jonathans bedroom",
"GPRINT:jonathan:MIN:Min\\:%6.1lf",
"GPRINT:jonathan:MAX: Max\\:%6.1lf",
"GPRINT:jonathan:AVERAGE:Avg\\:%6.1lf",
"GPRINT:jonathan:LAST:Now\\:%6.1lf degrees C\\n";
my $err=RRDs::error;
if ($err) {print "problem generating the graph: $err\n";}
print "Done!\n"