mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
Speed now optimized for weak hardware like the NLSU2. Improvement is more than 50 percent.
git-svn-id: https://svn.fhem.de/fhem/trunk@104 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
539bb61ea8
commit
1496f40178
@ -136,3 +136,6 @@ It is not necessary to tell fhem that there are other logs.
|
||||
|
||||
2007-10-18 (CVS)
|
||||
-- feature: User defined graphics for FS20 now with a full picture.
|
||||
|
||||
2007-10-23 (071023cvs)
|
||||
-- feature: optimized speed for small devices (more than 50 percent on e.g a NSLU2)
|
||||
|
@ -30,7 +30,12 @@
|
||||
- Now pgm3 shows other logfiles (like from wired devices) too. Changes in index.php, config.php, gnuplot.php, new userdefs.php)
|
||||
- Martin 2007-10-14
|
||||
- User defined logs with several values in one file now supported. Changes in index.php, gnuplot.php, userdefs.php and config.php.
|
||||
|
||||
- Martin 2007-10-16
|
||||
- User defined graphics now for Piri an FS20 too
|
||||
|
||||
- Martin 2007-10-18
|
||||
- User defined graphics for FS20 improved ("full" picture)
|
||||
|
||||
- Martin 2007-10-23
|
||||
- every module now checks if a redraw of the picture is really necessary. If not the old picture will be sent. The time to reload the screen now is down to less than 50 percent.
|
||||
|
@ -10,7 +10,10 @@
|
||||
# run global: "port <nr> global"
|
||||
$fhz1000port="7072"; # port of fhem.pl
|
||||
$logpath="/var/tmp"; # where are your logs?
|
||||
$fhz1000_pl="/home/FHZ/fhem/fhem.pl"; #only required if you are using PHP4
|
||||
$AbsolutPath="/srv/www/htdocs/pgm3"; # where ist your pgm3?
|
||||
|
||||
|
||||
$fhz1000_pl="/home/FHZ/fhem/fhem.pl"; #only required if you are using HP4
|
||||
|
||||
##################################################################################
|
||||
###### nice to have
|
||||
@ -63,7 +66,7 @@
|
||||
$showroombuttons=1; #default 1 Values 0/1
|
||||
$imgmaxxroom=$imgmaxxfs20; #Size of the pictures, default=$imgmaxxfs20
|
||||
$imgmaxyroom=30; # default=30
|
||||
$roomfontsizetitel=10; # default=10
|
||||
$roomfontsizetitel=10; # default=9
|
||||
$roommaxiconperline=$fs20maxiconperline; # default=$fs20maxiconperline
|
||||
|
||||
##############################################################################################
|
||||
@ -146,35 +149,38 @@ $UserDefs=0;
|
||||
#####################
|
||||
## Userdef: 0
|
||||
|
||||
# the sortnumbers must be complete. eg. 0 1 2 3 or 2 0 3 1 and so on
|
||||
$sortnumber=0;
|
||||
|
||||
# No blanks or other special signs!!
|
||||
$userdef[0]['name']='SolarV';
|
||||
$userdef[$sortnumber]['name']='SolarV';
|
||||
|
||||
#In which field are the values?? See the example above
|
||||
$userdef[0]['valuefield']=4;
|
||||
$userdef[$sortnumber]['valuefield']=4;
|
||||
|
||||
#Type of Device [temperature | piri | fs20] pgm3 will try to generate a gnuplot picture
|
||||
$userdef[0]['gnuplottype']='temperature';
|
||||
#Type of Device [temperature | piri] pgm3 will try to generate a gnuplot picture
|
||||
$userdef[$sortnumber]['gnuplottype']='temperature';
|
||||
|
||||
# example, path to the logfile with the entrys like above
|
||||
$userdef[0]['logpath']=$logpath.'/lse_solarV.log';
|
||||
$userdef[$sortnumber]['logpath']=$logpath.'/lse_solarV.log';
|
||||
|
||||
$userdef[0]['room']='user';
|
||||
$userdef[$sortnumber]['room']='hidden';
|
||||
|
||||
# Semantic eg. Voltage
|
||||
$userdef[0]['semlong']='Voltage';
|
||||
$userdef[$sortnumber]['semlong']='Voltage';
|
||||
|
||||
# Semantic short e.g. V
|
||||
$userdef[0]['semshort']='V';
|
||||
$userdef[$sortnumber]['semshort']='V';
|
||||
|
||||
#Size of the pictures. Default: 725
|
||||
$userdef[0]['imagemax']=725;
|
||||
$userdef[0]['imagemay']=52;
|
||||
$userdef[$sortnumber]['imagemax']=725;
|
||||
$userdef[$sortnumber]['imagemay']=52;
|
||||
|
||||
# Maximum count of pixel (from right to left) (Default:575)
|
||||
$userdef[0]['maxcount']=575;
|
||||
$userdef[$sortnumber]['maxcount']=575;
|
||||
|
||||
# Text of main text from the right side (Default:)
|
||||
$userdef[0]['XcorrectMainText']=25;
|
||||
$userdef[$sortnumber]['XcorrectMainText']=25;
|
||||
|
||||
# automatic Logrotate; $logrotate must be 'yes'.
|
||||
# Default:2200
|
||||
@ -182,91 +188,78 @@ $userdef[0]['XcorrectMainText']=25;
|
||||
# otherwise the system will slow down
|
||||
# pgm3 (user www-data) needs the rights to write the logs
|
||||
# from fhz1000.pl (user = ???)
|
||||
$userdef[0]['logrotatelines']=2200;
|
||||
$userdef[$sortnumber]['logrotatelines']=2200;
|
||||
|
||||
|
||||
#################
|
||||
## Userdef: 1
|
||||
#
|
||||
#$userdef[1]['name']='';
|
||||
#$userdef[1]['valuefield']=;
|
||||
#$userdef[1]['gnuplottype']='temperature';
|
||||
#$userdef[1]['logpath']='/var/tmp/log.log';
|
||||
#$userdef[1]['room']='';
|
||||
#$userdef[1]['semlong']='';
|
||||
#$userdef[1]['semshort']='';
|
||||
#$userdef[1]['imagemax']=725;
|
||||
#$userdef[1]['imagemay']=52;
|
||||
#$userdef[1]['maxcount']=575;
|
||||
#$userdef[1]['XcorrectMainText']=25;
|
||||
#$userdef[1]['logrotatelines']=2200;
|
||||
|
||||
########################
|
||||
# example:
|
||||
# define piriulog FileLog /var/tmp/piriu.log piriu:.*
|
||||
#$userdef[1]['name']='PiriU';
|
||||
#$userdef[1]['valuefield']=3;
|
||||
#$userdef[1]['gnuplottype']='piri';
|
||||
#$userdef[1]['logpath']='/mnt/fhz/piriu.log';
|
||||
#$userdef[1]['room']='wgu';
|
||||
#$userdef[1]['semlong']='Bewegungsmelder';
|
||||
#$userdef[1]['semshort']='';
|
||||
#$userdef[1]['imagemax']=725;
|
||||
#$userdef[1]['imagemay']=52;
|
||||
#$userdef[1]['maxcount']=575;
|
||||
#$userdef[1]['XcorrectMainText']=25;
|
||||
#$userdef[1]['logrotatelines']=2200;
|
||||
|
||||
########################
|
||||
# example:
|
||||
# define piriolog FileLog /var/tmp/pirio.log pirio:.*
|
||||
#$userdef[2]['name']='PiriO';
|
||||
#$userdef[2]['valuefield']=3;
|
||||
#$userdef[2]['gnuplottype']='piri';
|
||||
#$userdef[2]['logpath']='/mnt/fhz/pirio.log';
|
||||
#$userdef[2]['room']='wgo';
|
||||
#$userdef[2]['semlong']='Bewegungsmelder';
|
||||
#$userdef[2]['semshort']='';
|
||||
#$userdef[2]['imagemax']=725;
|
||||
#$userdef[2]['imagemay']=52;
|
||||
#$userdef[2]['maxcount']=575;
|
||||
#$userdef[2]['XcorrectMainText']=25;
|
||||
#$userdef[2]['logrotatelines']=2200;
|
||||
#
|
||||
|
||||
########################
|
||||
# example:
|
||||
#define solarpumpe.log FileLog /var/tmp/solarpumpe.log solarpumpe:.*(on|off).*
|
||||
#$userdef[3]['name']='SolarPumpe';
|
||||
#$userdef[3]['valuefield']=3;
|
||||
#$userdef[3]['gnuplottype']='fs20';
|
||||
#$userdef[3]['logpath']='/mnt/fhz/solarpumpe.log';
|
||||
#$userdef[3]['room']='cellar';
|
||||
#$userdef[3]['semlong']='Solarpumpe';
|
||||
#$userdef[3]['semshort']='';
|
||||
#$userdef[3]['imagemax']=725;
|
||||
#$userdef[3]['imagemay']=52;
|
||||
#$userdef[3]['maxcount']=575;
|
||||
#$userdef[3]['XcorrectMainText']=25;
|
||||
#$userdef[3]['logrotatelines']=50;
|
||||
#
|
||||
#$sortnumber=1;
|
||||
#$userdef[$sortnumber]['name']='PiriO';
|
||||
#$userdef[$sortnumber]['name']='SolarPumpe';
|
||||
##$userdef[$sortnumber]['valuefield']=3;
|
||||
#$userdef[$sortnumber]['gnuplottype']='fs20';
|
||||
#$userdef[$sortnumber]['logpath']='/var/tmp/solarpumpe.log';
|
||||
#$userdef[$sortnumber]['room']='cellar';
|
||||
#$userdef[$sortnumber]['semlong']='Solarpumpe';
|
||||
#$userdef[$sortnumber]['semshort']='';
|
||||
#$userdef[$sortnumber]['imagemax']=725;
|
||||
#$userdef[$sortnumber]['imagemay']=52;
|
||||
#$userdef[$sortnumber]['maxcount']=575;
|
||||
#$userdef[$sortnumber]['XcorrectMainText']=25;
|
||||
#$userdef[$sortnumber]['logrotatelines']=50;
|
||||
|
||||
|
||||
##########################
|
||||
# example:
|
||||
#define rolu1.log FileLog /var/tmp/rolu1.log rolu1:.*(on|off|dimup|dimdown).*
|
||||
#$userdef[4]['name']='Rolu1';
|
||||
#$userdef[4]['valuefield']=3;
|
||||
#$userdef[4]['gnuplottype']='fs20';
|
||||
#$userdef[4]['logpath']='/mnt/fhz/rolu1.log';
|
||||
#$userdef[4]['room']='wgu';
|
||||
#$userdef[4]['semlong']='Rolladen';
|
||||
#$userdef[4]['semshort']='';
|
||||
#$userdef[4]['imagemax']=725;
|
||||
#$userdef[4]['imagemay']=52;
|
||||
#$userdef[4]['maxcount']=575;
|
||||
#$userdef[4]['XcorrectMainText']=25;
|
||||
#$userdef[4]['logrotatelines']=30;
|
||||
#
|
||||
#$sortnumber=3;
|
||||
#$userdef[$sortnumber]['name']='Rolu1';
|
||||
#$userdef[$sortnumber]['valuefield']=3;
|
||||
#$userdef[$sortnumber]['gnuplottype']='fs20';
|
||||
#$userdef[$sortnumber]['logpath']='/var/tmp/rolu1.log';
|
||||
#$userdef[$sortnumber]['room']='wgu';
|
||||
##$userdef[$sortnumber]['semlong']='Rolladen';
|
||||
#$userdef[$sortnumber]['semshort']='';
|
||||
#$userdef[$sortnumber]['imagemax']=725;
|
||||
#$userdef[$sortnumber]['imagemay']=52;
|
||||
#$userdef[$sortnumber]['maxcount']=575;
|
||||
#$userdef[$sortnumber]['XcorrectMainText']=25;
|
||||
#$userdef[$sortnumber]['logrotatelines']=30;
|
||||
|
||||
##########################
|
||||
# example:
|
||||
#define rolu1.log FileLog /var/tmp/rolu1.log rolu1:.*(on|off|dimup|dimdown).*
|
||||
#$sortnumber=4;
|
||||
#$userdef[$sortnumber]['name']='allight';
|
||||
#$userdef[$sortnumber]['valuefield']=3;
|
||||
#$userdef[$sortnumber]['gnuplottype']='fs20';
|
||||
#$userdef[$sortnumber]['logpath']='/var/tmp/allight.log';
|
||||
#$userdef[$sortnumber]['room']='alarm';
|
||||
#$userdef[$sortnumber]['semlong']='Alarm light';
|
||||
#$userdef[$sortnumber]['semshort']='';
|
||||
#$userdef[$sortnumber]['imagemax']=725;
|
||||
#$userdef[$sortnumber]['imagemay']=52;
|
||||
#$userdef[$sortnumber]['maxcount']=575;
|
||||
#$userdef[$sortnumber]['XcorrectMainText']=25;
|
||||
#$userdef[$sortnumber]['logrotatelines']=30;
|
||||
##########################
|
||||
# example:
|
||||
#define rolu1.log FileLog /var/tmp/rolu1.log rolu1:.*(on|off|dimup|dimdown).*
|
||||
#$sortnumber=5;
|
||||
#$userdef[$sortnumber]['name']='FS10';
|
||||
#$userdef[$sortnumber]['valuefield']=2;
|
||||
#$userdef[$sortnumber]['gnuplottype']='temperature';
|
||||
#$userdef[$sortnumber]['logpath']='/var/tmp/wspd_7.gnu';
|
||||
#$userdef[$sortnumber]['timeformat']='%Y/%m/%d %H:%M:%S';
|
||||
#$userdef[$sortnumber]['room']='hidden';
|
||||
#$userdef[$sortnumber]['semlong']='FS10';
|
||||
#$userdef[$sortnumber]['semshort']='°C';
|
||||
#$userdef[$sortnumber]['imagemax']=725;
|
||||
#$userdef[$sortnumber]['imagemay']=52;
|
||||
#$userdef[$sortnumber]['maxcount']=575;
|
||||
#$userdef[$sortnumber]['XcorrectMainText']=25;
|
||||
#$userdef[$sortnumber]['logrotatelines']=3300;
|
||||
#################
|
||||
## Userdef: x
|
||||
#
|
||||
@ -278,17 +271,12 @@ $userdef[0]['logrotatelines']=2200;
|
||||
########################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##############################################################################################
|
||||
## misc
|
||||
$taillog=1; #make shure to have the correct rights. Values: 0/1
|
||||
$tailcount=20; #make shure to have the correct rights. Values: 0/1
|
||||
$taillogorder="/usr/bin/tail -$tailcount $logpath/fhem.log ";
|
||||
$tailpath="/usr/bin/tail";
|
||||
$taillogorder=$tailpath." -$tailcount $logpath/fhem.log ";
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
All the Documentation of pgm3 is now only online
|
||||
Be sure that the directory <pgm3>/tmp is writeable for the user of the webserver (e.g. wwwrun.www)
|
||||
Make something like "chown -R wwwrun.www tmp"
|
||||
|
||||
All the other Documentation of pgm3 is now only online
|
||||
http://www.martin-haas.de/fhz
|
||||
|
||||
|
||||
Enjoy it :-)
|
||||
|
@ -22,25 +22,6 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
||||
|
||||
$_SESSION["arraydata"] = array();
|
||||
|
||||
$im = ImageCreateTrueColor($imgmaxxfht,$imgmaxyfht);
|
||||
$black = ImageColorAllocate($im, 0, 0, 0);
|
||||
$bg1p = ImageColorAllocate($im, 110,148,183);
|
||||
$bg2p = ImageColorAllocate($im, 175,198,219);
|
||||
$bg3p = ImageColorAllocate($im, $fontcol_grap_R,$fontcol_grap_G,$fontcol_grap_B);
|
||||
$white = ImageColorAllocate($im, 255, 255, 255);
|
||||
$gray= ImageColorAllocate($im, 133, 133, 133);
|
||||
#$lightgray= ImageColorAllocate($im, 200, 198, 222);
|
||||
$red = ImageColorAllocate($im, 255, 0, 0);
|
||||
$green = ImageColorAllocate($im, 0, 255, 0);
|
||||
$yellow= ImageColorAllocate($im, 255, 255, 0);
|
||||
$lightyellow= ImageColorAllocate($im, 255, 247,222 );
|
||||
$orange= ImageColorAllocate($im, 255, 230, 25);
|
||||
$actuatorcolor = ImageColorAllocate($im, $actR, $actG, $actB);
|
||||
$desiredcolor = ImageColorAllocate($im, $desR, $desG, $desB);
|
||||
|
||||
|
||||
ImageFill($im, 0, 0, $bg2p);
|
||||
ImageRectangle($im, 0, 0, $imgmaxxfht-1, $imgmaxyfht-1, $white);
|
||||
|
||||
$array = file($file);
|
||||
$oldmin=0; //only the data from every 10min
|
||||
@ -48,10 +29,11 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
||||
$actuator="00%";
|
||||
$actuator_date="unknown";
|
||||
$counter=count($array);
|
||||
|
||||
|
||||
$arraydesired=array();
|
||||
$arrayactuator=array();
|
||||
|
||||
#echo $counter; exit;
|
||||
|
||||
#Logrotate
|
||||
if ((($logrotateFHTlines+200) < $counter) and ($logrotate == 'yes')) LogRotate($array,$file,$logrotateFHTlines);
|
||||
@ -77,7 +59,50 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$resultreverse = array_reverse($_SESSION["arraydata"]);
|
||||
|
||||
|
||||
#if the expected graphic alreay exist then do not redraw the picture
|
||||
|
||||
$savefile=$AbsolutPath."/tmp/FHT.".$drawfht.".log.".$resultreverse[0][0].".png";
|
||||
if (file_exists($savefile)) {
|
||||
|
||||
$im2 = @ImageCreateFromPNG($savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im2);
|
||||
exit; # ;-)))
|
||||
}
|
||||
else #delete old pngs
|
||||
{
|
||||
$delfile=$AbsolutPath."/tmp/FHT.".$drawfht.".log.*.png";
|
||||
foreach (glob($delfile) as $filename) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$im = ImageCreateTrueColor($imgmaxxfht,$imgmaxyfht);
|
||||
$black = ImageColorAllocate($im, 0, 0, 0);
|
||||
$bg1p = ImageColorAllocate($im, 110,148,183);
|
||||
$bg2p = ImageColorAllocate($im, 175,198,219);
|
||||
$bg3p = ImageColorAllocate($im, $fontcol_grap_R,$fontcol_grap_G,$fontcol_grap_B);
|
||||
$white = ImageColorAllocate($im, 255, 255, 255);
|
||||
$gray= ImageColorAllocate($im, 133, 133, 133);
|
||||
#$lightgray= ImageColorAllocate($im, 200, 198, 222);
|
||||
$red = ImageColorAllocate($im, 255, 0, 0);
|
||||
$green = ImageColorAllocate($im, 0, 255, 0);
|
||||
$yellow= ImageColorAllocate($im, 255, 255, 0);
|
||||
$lightyellow= ImageColorAllocate($im, 255, 247,222 );
|
||||
$orange= ImageColorAllocate($im, 255, 230, 25);
|
||||
$actuatorcolor = ImageColorAllocate($im, $actR, $actG, $actB);
|
||||
$desiredcolor = ImageColorAllocate($im, $desR, $desG, $desB);
|
||||
|
||||
|
||||
ImageFill($im, 0, 0, $bg2p);
|
||||
ImageRectangle($im, 0, 0, $imgmaxxfht-1, $imgmaxyfht-1, $white);
|
||||
|
||||
|
||||
$reversedesired = array_reverse($arraydesired);
|
||||
$reverseactuator = array_reverse($arrayactuator);
|
||||
$xold=$imgmaxxfht;
|
||||
@ -158,19 +183,13 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
||||
|
||||
ImageTTFText ($im, $fontsize, 0, $imgmaxxfht-230-$XcorrectDate, 23, $txtcolor, $fontttf, $text);
|
||||
|
||||
#$text=$desired_date;
|
||||
#ImageTTFText ($im, $fontsize, 0, $imgmaxxfht-127-$XcorrectDate, 23, $txtcolor, $fontttf, $text);
|
||||
|
||||
$text="Actuator: $actuator";
|
||||
ImageTTFText ($im, $fontsize, 0, $imgmaxxfht-230-$XcorrectDate, 33, $txtcolor, $fontttf, $text);
|
||||
|
||||
#$text=$actuator_date;
|
||||
#ImageTTFText ($im, $fontsize, 0, $imgmaxxfht-127-$XcorrectDate, 33, $txtcolor, $fontttf, $text);
|
||||
|
||||
$text=$resultreverse[0][0];
|
||||
ImageTTFText ($im, $fontsize, 0, $imgmaxxfht-127, 13, $txtcolor, $fontttf, $text);
|
||||
#ImageTTFText ($im, $fontsize, 0, $imgmaxxfht-127-$XcorrectDate, 13, $txtcolor, $fontttf, $text);
|
||||
|
||||
imagePng($im,$savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im);
|
||||
|
||||
@ -195,4 +214,6 @@ function show_error($file,$drawfht,$imgmaxxfht,$imgmaxyfht)
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -11,6 +11,35 @@ include "../config.php";
|
||||
$datefs20=$_GET['datefs20'];
|
||||
$room=$_GET['room'];
|
||||
|
||||
|
||||
## do we really need a new graphic??
|
||||
#$execorder=$tailpath.' -1 '.$file;
|
||||
#exec($execorder,$tail1);
|
||||
#$parts = explode(" ", $tail1[0]);
|
||||
#$date=$parts[0];
|
||||
|
||||
|
||||
$savefile=$AbsolutPath."/tmp/FS20.".$drawfs20.".log.".$datefs20.".png";
|
||||
if (file_exists($savefile)) {
|
||||
|
||||
$im2 = @ImageCreateFromPNG($savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im2);
|
||||
exit; # ;-)))
|
||||
}
|
||||
else #delete old pngs
|
||||
{
|
||||
$delfile=$AbsolutPath."/tmp/FS20.".$drawfs20.".log.*.png";
|
||||
foreach (glob($delfile) as $filename) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$im = ImageCreateTrueColor($imgmaxxfs20,$imgmaxyfs20);
|
||||
$black = ImageColorAllocate($im, 0, 0, 0);
|
||||
$bg1p = ImageColorAllocate($im, 110,148,183);
|
||||
@ -86,6 +115,7 @@ include "../config.php";
|
||||
if ($room != '') {ImageTTFText ($im, 7, 0, 5, 26, $txtcolor, $fontttf, $txtroom.$room);};
|
||||
|
||||
|
||||
imagePng($im,$savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im);
|
||||
?>
|
||||
|
@ -71,7 +71,7 @@ break;
|
||||
$gplotmain="
|
||||
set ylabel 'Temperature (Celsius)'
|
||||
set y2label 'Humidity (%)'
|
||||
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 3,\
|
||||
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2,\
|
||||
'$logfile' using 1:6 axes x1y2 title 'Rel. Humidity (%)' with lines
|
||||
";
|
||||
break;
|
||||
@ -89,7 +89,7 @@ EOD;
|
||||
$gplotmain="
|
||||
set ylabel 'Temperature (Celsius)'
|
||||
set y2label 'Humidity (%)'
|
||||
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 3,\
|
||||
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2,\
|
||||
'$logfile' using 1:6 axes x1y2 title 'Rel. Humidity (%)' with lines
|
||||
";
|
||||
break;
|
||||
@ -118,7 +118,7 @@ EOD;
|
||||
$gplotmaintmp = <<<EOD
|
||||
|
||||
plot "< awk '/measured/{print $1, $4}' $logfile"\
|
||||
using 1:2 axes x1y1 title 'Measured temperature' with lines lw 3,\
|
||||
using 1:2 axes x1y1 title 'Measured temperature' with lines lw 2,\
|
||||
"< awk '/actuator/{print $1, $4+0}' $logfile"\
|
||||
using 1:2 axes x1y2 title 'Actuator (%)' with steps lw 1,\
|
||||
"< awk '/desired/{print $1, $4}' $logfile"\
|
||||
@ -128,7 +128,7 @@ EOD;
|
||||
$gplotmainonlymeasured = <<<EOD
|
||||
|
||||
plot "< awk '/measured/{print $1, $4}' $logfile"\
|
||||
using 1:2 axes x1y1 title 'Measured temperature' with lines lw 3
|
||||
using 1:2 axes x1y1 title 'Measured temperature' with lines lw 2
|
||||
EOD;
|
||||
$gplotmain=$gplotmain.$gplotmaintmp;
|
||||
$gplotmain2=$gplotmain2.$gplotmainonlymeasured;
|
||||
@ -137,7 +137,7 @@ EOD;
|
||||
Case HMS100T: ############################################
|
||||
$gplotmain="
|
||||
set ylabel 'Temperature (Celsius)'
|
||||
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 3
|
||||
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2
|
||||
";
|
||||
break;
|
||||
|
||||
@ -147,7 +147,7 @@ $gplotmain=<<<EOD
|
||||
set size 1,0.5
|
||||
set noytics
|
||||
set noy2tics
|
||||
plot "$logfile" using 1:$valuefield axes x1y1 title '$SemanticLong' with lines lw 3
|
||||
plot "$logfile" using 1:$valuefield axes x1y1 title '$SemanticLong' with lines lw 2
|
||||
EOD;
|
||||
break;
|
||||
Case piri: ############################################
|
||||
@ -160,7 +160,7 @@ set yrange [-1.2:2.2]
|
||||
plot "< awk '{print $1, 1; }' $logfile "\
|
||||
using 1:2 title '$drawuserdef' with impulses
|
||||
|
||||
plot "$logfile" using 1:$valuefield axes x1y1 title '$SemanticLong' with lines lw 3
|
||||
plot "$logfile" using 1:$valuefield axes x1y1 title '$SemanticLong' with lines lw 2
|
||||
EOD;
|
||||
break;
|
||||
|
||||
@ -176,7 +176,7 @@ EOD;
|
||||
endswitch;
|
||||
|
||||
$message=$OUT1.$gplothdr.$gplotmain;
|
||||
$f1=fopen("tmp/gnu1","w");
|
||||
$f1=fopen("tmp/gnu1","w+");
|
||||
fputs($f1,$message);
|
||||
fclose($f1);
|
||||
exec("$gnuplot tmp/gnu1",$output);
|
||||
|
@ -22,6 +22,34 @@ $supported_HMS= array('HMS100T','HMS100TF','HMS100WD','HMS100MG','HMS100TFK','HM
|
||||
$file="$logpath/$drawhms.log";
|
||||
if (! in_array($type,$supported_HMS)) show_error_type($imgmaxxhms,$imgmaxyhms,$type);
|
||||
if (! file_exists($file)) show_error($file,$drawhms,$imgmaxxhms,$imgmaxyhms,$type);
|
||||
|
||||
## do we really need a new graphic??
|
||||
$execorder=$tailpath.' -1 '.$file;
|
||||
exec($execorder,$tail1);
|
||||
$parts = explode(" ", $tail1[0]);
|
||||
$date=$parts[0];
|
||||
|
||||
|
||||
$savefile=$AbsolutPath."/tmp/HMS.".$drawhms.".log.".$parts[0].".png";
|
||||
if (file_exists($savefile)) {
|
||||
|
||||
#echo "exists: $savefile"; exit;
|
||||
$im2 = @ImageCreateFromPNG($savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im2);
|
||||
exit; # ;-)))
|
||||
}
|
||||
else #delete old pngs
|
||||
{
|
||||
#echo "not exist: $savefile"; exit;
|
||||
$delfile=$AbsolutPath."/tmp/HMS.".$drawhms.".log.*.png";
|
||||
foreach (glob($delfile) as $filename) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$_SESSION["arraydata"] = array();
|
||||
|
||||
@ -282,6 +310,7 @@ if ( $type == "HMS100WD" or $type == "HMS100MG" or $type == "HMS100W"
|
||||
|
||||
#ok. let's draw
|
||||
|
||||
imagePng($im,$savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im);
|
||||
|
||||
@ -337,6 +366,7 @@ function show_error($file,$drawhms,$imgmaxx,$imgmaxy,$type)
|
||||
}
|
||||
ImageTTFText ($im, $fontsize, 0, 5, 45, $txtcolor, $fontttf, $text);
|
||||
|
||||
imagePng($im,$savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im);
|
||||
exit;
|
||||
@ -365,6 +395,7 @@ function show_error_type($imgmaxx,$imgmaxy,$type)
|
||||
ImageFill($im, 0, 0, $bg2p);
|
||||
ImageRectangle($im, 0, 0, $imgmaxx-1, $imgmaxy-1, $white);
|
||||
|
||||
imagePng($im,$savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im);
|
||||
exit;
|
||||
|
@ -13,11 +13,36 @@ $drawks=$_GET['drawks'];
|
||||
$room=$_GET['room'];
|
||||
$avgday=$_GET['avgday'];
|
||||
$avgmonth=$_GET['avgmonth'];
|
||||
#$drawks="ks300";
|
||||
|
||||
$file="$logpath/$drawks.log";
|
||||
if (! file_exists($file)) show_error($file,$drawks,$imgmaxxks,$imgmaxyks);
|
||||
|
||||
## do we really need a new graphic??
|
||||
$execorder=$tailpath.' -1 '.$file;
|
||||
exec($execorder,$tail1);
|
||||
$parts = explode(" ", $tail1[0]);
|
||||
|
||||
|
||||
$savefile=$AbsolutPath."/tmp/KS.".$drawks.".log.".$parts[0].".png";
|
||||
if (file_exists($savefile)) {
|
||||
|
||||
$im2 = @ImageCreateFromPNG($savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im2);
|
||||
exit; # ;-)))
|
||||
}
|
||||
else #delete old pngs
|
||||
{
|
||||
#echo "not exist: $savefile"; exit;
|
||||
$delfile=$AbsolutPath."/tmp/KS.".$drawks.".log.*.png";
|
||||
foreach (glob($delfile) as $filename) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$arraydata = array();
|
||||
|
||||
$im = ImageCreateTrueColor($imgmaxxks,$imgmaxyks);
|
||||
@ -405,6 +430,7 @@ ImageCopy ($imall,$imw,0,$imgmaxyks*2,0,0,$imgmaxxks,$imgmaxyks);
|
||||
ImageCopy ($imall,$imr,0,$imgmaxyks*3,0,0,$imgmaxxks,$imgmaxyks);
|
||||
|
||||
|
||||
imagePng($imall,$savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($imall);
|
||||
|
||||
|
@ -32,23 +32,36 @@ include "functions.php";
|
||||
|
||||
if (! file_exists($file)) show_error($file,$drawuserdef,$imgmaxxuserdef,$imgmaxyuserdef,$type,$userdefnr);
|
||||
|
||||
|
||||
|
||||
## do we really need a new graphic??
|
||||
$execorder=$tailpath.' -1 '.$file;
|
||||
exec($execorder,$tail1);
|
||||
$parts = explode(" ", $tail1[0]);
|
||||
|
||||
|
||||
$savefile=$AbsolutPath."/tmp/USERDEF.".$drawuserdef.".log.".$parts[0].".png";
|
||||
if (file_exists($savefile)) {
|
||||
|
||||
$im2 = @ImageCreateFromPNG($savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im2);
|
||||
exit; # ;-)))
|
||||
}
|
||||
else #delete old pngs
|
||||
{
|
||||
$delfile=$AbsolutPath."/tmp/USERDEF.".$drawuserdef.".log.*.png";
|
||||
foreach (glob($delfile) as $filename) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$_SESSION["arraydata"] = array();
|
||||
|
||||
$im = ImageCreateTrueColor($imgmaxxuserdef,$imgmaxyuserdef);
|
||||
$black = ImageColorAllocate($im, 0, 0, 0);
|
||||
$bg1p = ImageColorAllocate($im, 110,148,183);
|
||||
$bg2p = ImageColorAllocate($im, 175,198,219);
|
||||
$bg3p = ImageColorAllocate($im, $fontcol_grap_R,$fontcol_grap_G,$fontcol_grap_B);
|
||||
$white = ImageColorAllocate($im, 255, 255, 255);
|
||||
$gray= ImageColorAllocate($im, 133, 133, 133);
|
||||
$red = ImageColorAllocate($im, 255, 0, 0);
|
||||
$green = ImageColorAllocate($im, 0, 255, 0);
|
||||
$yellow= ImageColorAllocate($im, 255, 255, 0);
|
||||
$orange= ImageColorAllocate($im, 255, 230, 25);
|
||||
|
||||
|
||||
ImageFill($im, 0, 0, $bg2p);
|
||||
ImageRectangle($im, 0, 0, $imgmaxxuserdef-1, $imgmaxyuserdef-1, $white);
|
||||
|
||||
$array = file($file);
|
||||
$oldmin=0; //only the data from every 10min
|
||||
@ -92,8 +105,30 @@ include "functions.php";
|
||||
}
|
||||
|
||||
|
||||
$resultreverse = array_reverse($_SESSION["arraydata"]);
|
||||
|
||||
|
||||
# Start Graphic
|
||||
$im = ImageCreateTrueColor($imgmaxxuserdef,$imgmaxyuserdef);
|
||||
$black = ImageColorAllocate($im, 0, 0, 0);
|
||||
$bg1p = ImageColorAllocate($im, 110,148,183);
|
||||
$bg2p = ImageColorAllocate($im, 175,198,219);
|
||||
$bg3p = ImageColorAllocate($im, $fontcol_grap_R,$fontcol_grap_G,$fontcol_grap_B);
|
||||
$white = ImageColorAllocate($im, 255, 255, 255);
|
||||
$gray= ImageColorAllocate($im, 133, 133, 133);
|
||||
$red = ImageColorAllocate($im, 255, 0, 0);
|
||||
$green = ImageColorAllocate($im, 0, 255, 0);
|
||||
$yellow= ImageColorAllocate($im, 255, 255, 0);
|
||||
$orange= ImageColorAllocate($im, 255, 230, 25);
|
||||
|
||||
|
||||
ImageFill($im, 0, 0, $bg2p);
|
||||
ImageRectangle($im, 0, 0, $imgmaxxuserdef-1, $imgmaxyuserdef-1, $white);
|
||||
|
||||
|
||||
|
||||
|
||||
$xold=$imgmaxxuserdef;
|
||||
$resultreverse = array_reverse($_SESSION["arraydata"]);
|
||||
|
||||
if ( $imgmaxxuserdef > count ($resultreverse) )
|
||||
{ $_SESSION["maxdata"] = count ($resultreverse); }
|
||||
@ -126,12 +161,11 @@ if ($gnuplottype=='piri' or $gnuplottype=='fs20')
|
||||
$datumyesterday= mktime (0,0,0,date("m") ,date("d")-5,date("Y"));
|
||||
$xrange2= date ("Y-m-d",$datumyesterday);
|
||||
$xrange="set xrange ['$xrange2':'$xrange1']";
|
||||
$gnuplotfile="../tmp/".$drawuserdef;
|
||||
#$gnuplotpng="../tmp/".$drawuserdef.".png";
|
||||
$gnuplotpng=$drawuserdef.".png";
|
||||
$gnuplotfile=$AbsolutPath."/tmp/".$drawuserdef;
|
||||
$gnuplotpng=$drawuserdef.".sm.png";
|
||||
|
||||
$messageA=<<<EOD
|
||||
set output '$gnuplotpng'
|
||||
set output '$AbsolutPath/tmp/$gnuplotpng'
|
||||
set terminal png
|
||||
set xdata time
|
||||
set timefmt '%Y-%m-%d_%H:%M:%S'
|
||||
@ -159,7 +193,7 @@ EOD;
|
||||
$newlastline=$actdate." ".$f2." ".$f3." ".$f4." ".$f5." ".$f6;
|
||||
array_push( $array ,$newlastline);
|
||||
$filename=substr($file,strrpos($file, '/')+1);
|
||||
$filename='../tmp/'.$filename.'.tmp';
|
||||
$filename=$AbsolutPath.'/tmp/'.$filename.'.tmp';
|
||||
$f1=fopen("$filename","w");
|
||||
for ($x = 0; $x <= count($array); $x++)
|
||||
{
|
||||
@ -199,15 +233,16 @@ endswitch;
|
||||
if ($gnuplottype=='piri' or $gnuplottype=='fs20')
|
||||
{
|
||||
$message=$messageA.$messageB;
|
||||
$f1=fopen("$gnuplotfile","w");
|
||||
$f1=fopen("$AbsolutPath/tmp/$drawuserdef","w+");
|
||||
fputs($f1,$message);
|
||||
fclose($f1);
|
||||
exec("$gnuplot $gnuplotfile",$output);
|
||||
# exit;
|
||||
exec("$gnuplot $AbsolutPath/tmp/$drawuserdef",$output);
|
||||
|
||||
$w = imagesx($im);
|
||||
$h = imagesy($im);
|
||||
|
||||
$im2 = imagecreatefrompng("$gnuplotpng");
|
||||
$im2 = imagecreatefrompng("$AbsolutPath/tmp/$gnuplotpng");
|
||||
$w2 = imagesx($im2);
|
||||
$h2 = imagesy($im2);
|
||||
ImageCopy($im,$im2,150,0,0,10,$w2-10,$h2);
|
||||
@ -253,6 +288,7 @@ if ($gnuplottype=='piri' or $gnuplottype=='fs20')
|
||||
#############################################################################
|
||||
#ok. let's draw
|
||||
|
||||
imagePng($im,$savefile);
|
||||
header("Content-type: image/png");
|
||||
imagePng($im);
|
||||
|
||||
|
@ -41,7 +41,7 @@ include "include/gnuplot.php";
|
||||
include "include/functions.php";
|
||||
|
||||
|
||||
$pgm3version='0.8.5cvs';
|
||||
$pgm3version='071023cvs';
|
||||
|
||||
|
||||
$Action = $_POST['Action'];
|
||||
@ -199,7 +199,7 @@ endswitch;
|
||||
|
||||
|
||||
if (! isset($showroom)) $showroom="ALL";
|
||||
if ($taillog==1) exec($taillogorder,$tailoutput);
|
||||
if (($taillog==1) and (isset ($showhist)) ) exec($taillogorder,$tailoutput);
|
||||
|
||||
|
||||
#executes over the network to the fhem.pl (or localhost)
|
||||
|
Loading…
Reference in New Issue
Block a user