DBlog added
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@579 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
3
CHANGED
3
CHANGED
@@ -571,3 +571,6 @@
|
|||||||
- feature: 11_FHT.pm added new readings for warnings on battery, lowtemp,
|
- feature: 11_FHT.pm added new readings for warnings on battery, lowtemp,
|
||||||
window and windowsensor (M.Fischer)
|
window and windowsensor (M.Fischer)
|
||||||
- feature: on-for-timer added for X10 modules (Boris)
|
- feature: on-for-timer added for X10 modules (Boris)
|
||||||
|
- bugfix: pgm3: Better check of availability of google-weather (MartinH)
|
||||||
|
- feature: pgm3: DBLog added for everything except UserDefs
|
||||||
|
(Gerhard Pfeffer / MartinH)
|
||||||
|
|||||||
@@ -198,3 +198,9 @@ It is not necessary to tell fhem that there are other logs.
|
|||||||
2010-01-08
|
2010-01-08
|
||||||
-- Feature, Bugs look at HISTORY
|
-- Feature, Bugs look at HISTORY
|
||||||
Changed: every php-File!
|
Changed: every php-File!
|
||||||
|
2010-03-12
|
||||||
|
-- Bugfix: Better check of availability of Google-Weather
|
||||||
|
Changed: weather.php
|
||||||
|
-- Feature: DBLog for everything except UserDefs
|
||||||
|
Changed: index.php, config.php, fht.php, hsm100.php,
|
||||||
|
fhtpulldown.php, ks300.php
|
||||||
|
|||||||
@@ -105,3 +105,6 @@
|
|||||||
-- Misc: Output of html better formated
|
-- Misc: Output of html better formated
|
||||||
-- Feature. Skinable -- change the colors
|
-- Feature. Skinable -- change the colors
|
||||||
|
|
||||||
|
- Martin 2010-03-12
|
||||||
|
-- Bugfix: better check of availability of google-weather
|
||||||
|
-- Feature: DBLog added for everything except UserDefs
|
||||||
|
|||||||
@@ -7,14 +7,21 @@
|
|||||||
|
|
||||||
|
|
||||||
###### required settings
|
###### required settings
|
||||||
$fhem="fhem"; #only php5 is supported! On which machine is fhem runnning??
|
$fhem="localhost"; #only php5 is supported! On which machine is fhem runnning??
|
||||||
#$fhem="localhost"; #only php5 is supported! On which machine is fhem runnning??
|
|
||||||
# it needs not to be on the same machine as fhem
|
# it needs not to be on the same machine as fhem
|
||||||
# if it is not localhost then the fhem.cfg must
|
# if it is not localhost then the fhem.cfg must
|
||||||
# run global: "attr global port <nr> global"
|
# run global: "attr global port <nr> global"
|
||||||
$fhemport="7072"; # port of fhem.pl
|
$fhemport="7072"; # port of fhem.pl
|
||||||
$logpath="/mnt/fhz/"; # where are your logs? Use a writabel nfs-share if pgm3 and fhem are not on the same machine
|
$logpath="/var/tmp/"; # where are your logs? Use a writabel nfs-share if pgm3 and fhem are not on the same machine
|
||||||
$AbsolutPath="/srv/www/htdocs/"; # where ist your pgm3?
|
$AbsolutPath="/var/www/"; # where ist your pgm3?
|
||||||
|
|
||||||
|
###### DBlog instead of Filelogs -- only for experienced Users!
|
||||||
|
## Look at contrib/dblog and http://fhemwiki.de for further information
|
||||||
|
$DBUse="0"; # Wanna use DB-Logging instead of File-Logging? Use 1 for ye s and 0 for no.
|
||||||
|
$DBNode="localhost"; # On which machine is your db running?
|
||||||
|
$DBName="fhem"; # Whats the name of your DB for fhem?
|
||||||
|
$DBUser="USER"; # Enter the username to connect to the DB.
|
||||||
|
$DBPass="PASSWD"; # Enter the password which is needed to connect to the DB
|
||||||
|
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
@@ -102,13 +109,13 @@
|
|||||||
$desR='255'; $desG='255'; $desB='255'; # Color of desired-temp-line Red/Green/Blue (Default: 255/255/255)
|
$desR='255'; $desG='255'; $desB='255'; # Color of desired-temp-line Red/Green/Blue (Default: 255/255/255)
|
||||||
$show_actuator=1; # show the actuator-value as a graphic (0/1)
|
$show_actuator=1; # show the actuator-value as a graphic (0/1)
|
||||||
$actR='255'; $actG='247'; $actB='200'; # Color of Actuator-line Red/Green/Blue (Default: 255/247/200)
|
$actR='255'; $actG='247'; $actB='200'; # Color of Actuator-line Red/Green/Blue (Default: 255/247/200)
|
||||||
$FHTyrange='15:31'; # Temperature in gnuplot. Default 15 to 31 (Celsius)
|
$FHTyrange='14:31'; # Temperature in gnuplot. Default 14 to 31 (Celsius)
|
||||||
$FHTy2range='0:70'; # Actuator in gnuplot. Default 0 to 70 (Percent)
|
$FHTy2range='0:70'; # Actuator in gnuplot. Default 0 to 70 (Percent)
|
||||||
$maxcount='510'; # Maximum count of pixel (from right to left) (Default:460)
|
$maxcount='510'; # Maximum count of pixel (from right to left) (Default:460)
|
||||||
$XcorrectDate=380; # Text of e.g. Date from the right side (Default:380)
|
$XcorrectDate=380; # Text of e.g. Date from the right side (Default:380)
|
||||||
$XcorrectMainText=32; # Text of main text from the right side (Default: 32)
|
$XcorrectMainText=32; # Text of main text from the right side (Default: 32)
|
||||||
$logrotateFHTlines=5400; # automatic Logrotate; $logrotate must be 'yes'.
|
$logrotateFHTlines=8200; # automatic Logrotate; $logrotate must be 'yes'.
|
||||||
# Default:4800
|
# Default:8200
|
||||||
# read docs/logrotate if you want adjust it manually!
|
# read docs/logrotate if you want adjust it manually!
|
||||||
# otherwise the system will slow down
|
# otherwise the system will slow down
|
||||||
# pgm3 (user www-data) needs the rights to write the logs
|
# pgm3 (user www-data) needs the rights to write the logs
|
||||||
@@ -124,8 +131,8 @@
|
|||||||
$maxcountHMS='575'; # Maximum count of pixel (from right to left) (Default:575)
|
$maxcountHMS='575'; # Maximum count of pixel (from right to left) (Default:575)
|
||||||
$XcorrectMainTextHMS=25; # Text of main text from the right side (Default:)
|
$XcorrectMainTextHMS=25; # Text of main text from the right side (Default:)
|
||||||
$showdewpoint='yes'; # Dewpoint (german: taupunkt)
|
$showdewpoint='yes'; # Dewpoint (german: taupunkt)
|
||||||
$logrotateHMSlines=1200; # automatic Logrotate; $logrotate must be 'yes'.
|
$logrotateHMSlines=1500; # automatic Logrotate; $logrotate must be 'yes'.
|
||||||
# Default:1200
|
# Default:1500
|
||||||
# read docs/logrotate if you want adjust it manually!
|
# read docs/logrotate if you want adjust it manually!
|
||||||
# otherwise the system will slow down
|
# otherwise the system will slow down
|
||||||
# pgm3 (user www-data) needs the rights to write the logs
|
# pgm3 (user www-data) needs the rights to write the logs
|
||||||
@@ -170,7 +177,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# Do you want user defined graphics? 1/0 Default: 0
|
# Do you want user defined graphics? 1/0 Default: 0
|
||||||
$UserDefs=1;
|
$UserDefs=0;
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
## Userdef: 0
|
## Userdef: 0
|
||||||
@@ -220,20 +227,20 @@ $UserDefs=1;
|
|||||||
########################
|
########################
|
||||||
# example:
|
# example:
|
||||||
#define solarpumpe.log FileLog /var/tmp/solarpumpe.log solarpumpe:.*(on|off).*
|
#define solarpumpe.log FileLog /var/tmp/solarpumpe.log solarpumpe:.*(on|off).*
|
||||||
#$sortnumber=0;
|
$sortnumber=0;
|
||||||
#$userdef[$sortnumber]['name']='PiriO';
|
$userdef[$sortnumber]['name']='PiriO';
|
||||||
#$userdef[$sortnumber]['name']='SolarPumpe';
|
$userdef[$sortnumber]['name']='SolarPumpe';
|
||||||
#$userdef[$sortnumber]['valuefield']=3;
|
$userdef[$sortnumber]['valuefield']=3;
|
||||||
#$userdef[$sortnumber]['gnuplottype']='fs20';
|
$userdef[$sortnumber]['gnuplottype']='fs20';
|
||||||
#$userdef[$sortnumber]['logpath']='/mnt/fhz/solarpumpe.log';
|
$userdef[$sortnumber]['logpath']='/mnt/fhz/solarpumpe.log';
|
||||||
#$userdef[$sortnumber]['room']='cellar';
|
$userdef[$sortnumber]['room']='cellar';
|
||||||
#$userdef[$sortnumber]['semlong']='Solarpumpe';
|
$userdef[$sortnumber]['semlong']='Solarpumpe';
|
||||||
#$userdef[$sortnumber]['semshort']='';
|
$userdef[$sortnumber]['semshort']='';
|
||||||
#$userdef[$sortnumber]['imagemax']=725;
|
$userdef[$sortnumber]['imagemax']=725;
|
||||||
#$userdef[$sortnumber]['imagemay']=52;
|
$userdef[$sortnumber]['imagemay']=52;
|
||||||
#$userdef[$sortnumber]['maxcount']=575;
|
$userdef[$sortnumber]['maxcount']=575;
|
||||||
#$userdef[$sortnumber]['XcorrectMainText']=25;
|
$userdef[$sortnumber]['XcorrectMainText']=25;
|
||||||
#$userdef[$sortnumber]['logrotatelines']=50;
|
$userdef[$sortnumber]['logrotatelines']=50;
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
@@ -253,6 +260,26 @@ $UserDefs=1;
|
|||||||
#$userdef[$sortnumber]['XcorrectMainText']=25;
|
#$userdef[$sortnumber]['XcorrectMainText']=25;
|
||||||
#$userdef[$sortnumber]['logrotatelines']=30;
|
#$userdef[$sortnumber]['logrotatelines']=30;
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# example:
|
||||||
|
#define rolu1.log FileLog /var/tmp/rolu1.log rolu1:.*(on|off|dimup|dimdown).*
|
||||||
|
$sortnumber=1;
|
||||||
|
$userdef[$sortnumber]['name']='allight';
|
||||||
|
$userdef[$sortnumber]['valuefield']=3;
|
||||||
|
$userdef[$sortnumber]['gnuplottype']='fs20';
|
||||||
|
$userdef[$sortnumber]['logpath']='/mnt/fhz/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;
|
||||||
|
##########################
|
||||||
|
|
||||||
|
|
||||||
|
#$sortnumber=2;
|
||||||
#$userdef[$sortnumber]['name']='tARV';
|
#$userdef[$sortnumber]['name']='tARV';
|
||||||
#$userdef[$sortnumber]['valuefield']=3;
|
#$userdef[$sortnumber]['valuefield']=3;
|
||||||
#$userdef[$sortnumber]['gnuplottype']='temperature';
|
#$userdef[$sortnumber]['gnuplottype']='temperature';
|
||||||
@@ -321,14 +348,15 @@ $UserDefs=1;
|
|||||||
$showAT='no'; #show the AT_JOBS at startup. Default: yes Values: yes/no
|
$showAT='no'; #show the AT_JOBS at startup. Default: yes Values: yes/no
|
||||||
$showNOTI='no'; #show the NOTIFICATIONS at startup. Default: no Values: yes/no
|
$showNOTI='no'; #show the NOTIFICATIONS at startup. Default: no Values: yes/no
|
||||||
$showHIST='yes'; #show the HISTORY (if taillog=1) at startup. Default: yes Values: yes/no
|
$showHIST='yes'; #show the HISTORY (if taillog=1) at startup. Default: yes Values: yes/no
|
||||||
$showPICS='yes'; #if shwowebcam=1 then initial the Pics will be shown. Default: yes
|
$showPICS='no'; #if shwowebcam=1 then initial the Pics will be shown. Default: yes
|
||||||
$showWeath='yes'; # Show weather on startup? $enableweather must 1
|
$showWeath='yes'; # Show weather on startup? $enableweather must 1
|
||||||
|
|
||||||
$RSStitel='FHEM :-)';
|
$RSStitel='FHEM :-)';
|
||||||
|
|
||||||
$urlreload=90; # Automatic reloading page [sec]. Default fast: 60 slow:90
|
$urlreload=90; # Automatic reloading page [sec]. Default fast: 60 slow:90
|
||||||
$titel="PHP-Webmachine for fhem :-)"; #feel free to create an own title
|
$titel="PHP-Webmachine for fhem :-)"; #feel free to create an own title
|
||||||
$timeformat="Y-m-d H:i:s";
|
#$timeformat="Y-m-d H:i:s"; #English
|
||||||
|
$timeformat="d.m.Y H:i:s"; # German
|
||||||
$winsize=800; # width of the pgm3
|
$winsize=800; # width of the pgm3
|
||||||
|
|
||||||
|
|
||||||
@@ -391,4 +419,13 @@ $UserDefs=1;
|
|||||||
############################### end of settings
|
############################### end of settings
|
||||||
putenv('GDFONTPATH=' . realpath('.'));
|
putenv('GDFONTPATH=' . realpath('.'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### If DB-query is used, this is the only point of connect. ###
|
||||||
|
if ($DBUse=="1") {
|
||||||
|
@mysql_connect($DBNode, $DBUser, $DBPass) or die("Can't connect");
|
||||||
|
@mysql_select_db($DBName) or die("No database found");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################# Creates graphics vor pgm3
|
################# Creates graphics vor pgm3
|
||||||
|
|
||||||
|
|
||||||
@@ -9,6 +7,7 @@
|
|||||||
|
|
||||||
include "../config.php";
|
include "../config.php";
|
||||||
include "functions.php";
|
include "functions.php";
|
||||||
|
#include "dblog.php";
|
||||||
|
|
||||||
setlocale (LC_ALL, 'de_DE.utf8');
|
setlocale (LC_ALL, 'de_DE.utf8');
|
||||||
|
|
||||||
@@ -17,21 +16,25 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
|||||||
$battery=$_GET['battery'];
|
$battery=$_GET['battery'];
|
||||||
$room=$_GET['room'];
|
$room=$_GET['room'];
|
||||||
|
|
||||||
|
if ($DBUse=="1") {
|
||||||
|
$sqlquery=mysql_query("select timestamp from history where device='".$drawfht."' and type='FHT' order by timestamp desc limit 1");
|
||||||
|
$query=mysql_fetch_object($sqlquery);
|
||||||
|
$date=str_replace(" ","_",$query->timestamp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$file="$logpath/$drawfht.log";
|
$file="$logpath/$drawfht.log";
|
||||||
|
|
||||||
if (! file_exists($file)) show_error($file,$drawfht,$imgmaxxfht,$imgmaxyfht);
|
if (! file_exists($file)) show_error($file,$drawfht,$imgmaxxfht,$imgmaxyfht);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## do we really need a new graphic??
|
## do we really need a new graphic??
|
||||||
$execorder=$tailpath.' -1 '.$file;
|
$execorder=$tailpath.' -1 '.$file;
|
||||||
exec($execorder,$tail1);
|
exec($execorder,$tail1);
|
||||||
$parts = explode(" ", $tail1[0]);
|
$parts = explode(" ", $tail1[0]);
|
||||||
$date=$parts[0];
|
$date=$parts[0];
|
||||||
|
}
|
||||||
|
|
||||||
#if the expected graphic already exist then do not redraw the picture
|
#if the expected graphic already exist then do not redraw the picture
|
||||||
|
|
||||||
$savefile=$AbsolutPath."/tmp/FHT.".$drawfht.".log.".$parts[0].".png";
|
$savefile=$AbsolutPath."/tmp/FHT.".$drawfht.".log.".$date.".png";
|
||||||
if (file_exists($savefile)) {
|
if (file_exists($savefile)) {
|
||||||
|
|
||||||
$im2 = @ImageCreateFromPNG($savefile);
|
$im2 = @ImageCreateFromPNG($savefile);
|
||||||
@@ -52,42 +55,58 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
|||||||
$_SESSION["arraydata"] = array();
|
$_SESSION["arraydata"] = array();
|
||||||
|
|
||||||
|
|
||||||
$array = file($file);
|
if ($DBUse=="1") $sqlarray=mysql_query("select timestamp,reading,value from (select timestamp,reading,value from history where device='".$drawfht."' order by timestamp desc limit ".$logrotateFHTlines.") as subtable order by timestamp asc") or die (mysql_error());
|
||||||
|
else $array = file($file);
|
||||||
$oldmin=0; //only the data from every 10min
|
$oldmin=0; //only the data from every 10min
|
||||||
$oldhour=0; //only the data from every 10min
|
$oldhour=0; //only the data from every 10min
|
||||||
$actuator="00%";
|
$actuator="00%";
|
||||||
$actuator_date="unknown";
|
$actuator_date="unknown";
|
||||||
$counter=count($array);
|
if ($DBUse=="1") $counter=mysql_num_rows($sqlarray);
|
||||||
|
else $counter=count($array);
|
||||||
|
|
||||||
$arraydesired=array();
|
$arraydesired=array();
|
||||||
$arrayactuator=array();
|
$arrayactuator=array();
|
||||||
|
|
||||||
|
|
||||||
#Logrotate
|
#Logrotate
|
||||||
if ((($logrotateFHTlines+200) < $counter) and ($logrotate == 'yes')) LogRotate($array,$file,$logrotateFHTlines);
|
if ((($logrotateFHTlines+200) < $counter) and ($logrotate == 'yes') and ($DBUse!="1")) LogRotate($array,$file,$logrotateFHTlines);
|
||||||
|
|
||||||
for ($x = 0; $x < $counter; $x++)
|
for ($x = 0; $x < $counter; $x++)
|
||||||
{
|
{
|
||||||
|
if ($DBUse=="1") {
|
||||||
|
mysql_data_seek($sqlarray,$x);
|
||||||
|
$parts=mysql_fetch_assoc($sqlarray);
|
||||||
|
# $date=$parts['timestamp'];
|
||||||
|
$date=str_replace(" ","_",$parts['timestamp']);
|
||||||
|
$type=$parts['reading'];
|
||||||
|
$temp=$parts['value'];
|
||||||
|
$array[$x]=$date." ".$type." ".$temp;
|
||||||
|
if ($type=="actuator") $temp=$temp."%";
|
||||||
|
# print "Output: ".$date." ".$type." ".$temp."<br />";
|
||||||
|
}
|
||||||
|
else {
|
||||||
$parts = explode(" ", $array[$x]);
|
$parts = explode(" ", $array[$x]);
|
||||||
$date=$parts[0];
|
$date=$parts[0];
|
||||||
$type=$parts[2];
|
$type=$parts[2];
|
||||||
$temp=$parts[3];
|
$temp=$parts[3];
|
||||||
if ($type=="desired-temp:")
|
}
|
||||||
|
|
||||||
|
if (substr($type,0,12)=="desired-temp")
|
||||||
{$desired_temp=$temp;$desired_date=$date;}
|
{$desired_temp=$temp;$desired_date=$date;}
|
||||||
if ($type=="actuator:")
|
if (substr($type,0,8)=="actuator")
|
||||||
{
|
{
|
||||||
if (trim($temp) != 'lime-protection')
|
if (trim($temp) != 'lime-protection')
|
||||||
{$actuator=rtrim($temp);$actuator_date=$date;}
|
{$actuator=rtrim($temp);$actuator_date=$date;}
|
||||||
}
|
}
|
||||||
if ((($array[$x][14] != $oldmin) or ($array[$x][12] != $oldhour)) and ($type=="measured-temp:"))
|
# print ":::".$array[$x][14]."---".$oldmin."<br />";
|
||||||
|
# print "...".$array[$x][12]."---".$oldhour."<br />";
|
||||||
|
if ((($array[$x][14] != $oldmin) or ($array[$x][12] != $oldhour)) and (substr($type,0,13)=="measured-temp"))
|
||||||
{
|
{
|
||||||
$oldmin=$array[$x][14];
|
$oldmin=$array[$x][14];
|
||||||
$oldhour=$array[$x][12];
|
$oldhour=$array[$x][12];
|
||||||
array_push( $_SESSION["arraydata"],array($date,$type,$temp));
|
array_push( $_SESSION["arraydata"],array($date,$type,$temp));
|
||||||
array_push( $arraydesired,$desired_temp);
|
array_push( $arraydesired,$desired_temp);
|
||||||
array_push( $arrayactuator,$actuator);
|
array_push( $arrayactuator,$actuator);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +206,7 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
|||||||
$txtcolor=$bg3p;
|
$txtcolor=$bg3p;
|
||||||
$fontsize=7;
|
$fontsize=7;
|
||||||
$text="min= $mintemp max= $maxtemp";
|
$text="min= $mintemp max= $maxtemp";
|
||||||
ImageTTFText ($im, $fontsize, 0, 67-$XcorrectMainText, 49, $txtcolor, $fontttf, $text);
|
ImageTTFText ($im, $fontsize, 0, 90-$XcorrectMainText, 49, $txtcolor, $fontttf, $text);
|
||||||
|
|
||||||
$text=$txtroom.$room;
|
$text=$txtroom.$room;
|
||||||
ImageTTFText ($im, $fontsize, 0, 3, 49, $txtcolor, $fontttf, $text);
|
ImageTTFText ($im, $fontsize, 0, 3, 49, $txtcolor, $fontttf, $text);
|
||||||
@@ -214,7 +233,8 @@ setlocale (LC_ALL, 'de_DE.utf8');
|
|||||||
$fontsize=7;
|
$fontsize=7;
|
||||||
$text=$battery;
|
$text=$battery;
|
||||||
if ($battery == 'none') {$text='Bat: ok';}
|
if ($battery == 'none') {$text='Bat: ok';}
|
||||||
else {$text='Bat: low'; $txtcolor=$red;}
|
elseif ($battery =='empty') {$text='Bat: low'; $txtcolor=$red;}
|
||||||
|
else {$text='';};
|
||||||
ImageTTFText ($im, $fontsize, 0, 165, 10, $txtcolor, $fontttf, $text);
|
ImageTTFText ($im, $fontsize, 0, 165, 10, $txtcolor, $fontttf, $text);
|
||||||
$fontsize=7;
|
$fontsize=7;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
##Functions for pgm3
|
##Functions for pgm3
|
||||||
|
|
||||||
|
### If DB-query is used, this is the only point of connect. ###
|
||||||
|
#if ($DBUse=="1") {
|
||||||
|
# @mysql_connect($DBNode, $DBUser, $DBPass) or die("Can't connect");
|
||||||
|
# @mysql_select_db($DBName) or die("No database found");
|
||||||
|
#}
|
||||||
|
|
||||||
function LogRotate($array,$file,$logrotatelines)
|
function LogRotate($array,$file,$logrotatelines)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
################
|
################
|
||||||
|
|
||||||
|
|
||||||
function drawgnuplot($gnudraw,$gnutyp,$gnuplot,$pictype,$logpath,$FHTyrange,$FHTy2range)
|
function drawgnuplot($gnudraw,$gnutyp,$gnuplot,$pictype,$logpath,$FHTyrange,$FHTy2range,$DBUse)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($gnutyp=="userdef")
|
if ($gnutyp=="userdef")
|
||||||
@@ -33,6 +33,19 @@ function drawgnuplot($gnudraw,$gnutyp,$gnuplot,$pictype,$logpath,$FHTyrange,$FHT
|
|||||||
$IN="$gnudraw ($gnutyp)";
|
$IN="$gnudraw ($gnutyp)";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### DBUse for
|
||||||
|
if ($DBUse == '1' and ( $gnutyp=='FHT' or $gnutyp=='HMS100T' or $gnutyp=='HMS100TF' or $gnutyp=='CUL_WS' or $gnutyp=='KS300_t1' or $gnutyp=='KS300_t2' or $gnutyp=='WS300_t1' or $gnutyp=='WS300_t2'))
|
||||||
|
{
|
||||||
|
include "config.php";
|
||||||
|
$logfile="tmp/".$gnudraw.".log";
|
||||||
|
$f1=fopen($logfile,"w+");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$gnudraw1=$gnudraw.'1';
|
$gnudraw1=$gnudraw.'1';
|
||||||
$OUT1="set output 'tmp/$gnudraw.$pictype'";
|
$OUT1="set output 'tmp/$gnudraw.$pictype'";
|
||||||
$OUT2="set output 'tmp/$gnudraw1.$pictype'";
|
$OUT2="set output 'tmp/$gnudraw1.$pictype'";
|
||||||
@@ -47,17 +60,26 @@ $gplothdr="
|
|||||||
set title '$IN'
|
set title '$IN'
|
||||||
set grid
|
set grid
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
$datumtomorrow= mktime (0,0,0,date("m") ,date("d")+1,date("Y"));
|
$datumtomorrow= mktime (0,0,0,date("m") ,date("d")+1,date("Y"));
|
||||||
$xrange1= date ("Y-m-d",$datumtomorrow);
|
$xrange1= date ("Y-m-d",$datumtomorrow);
|
||||||
$datumyesterday= mktime (0,0,0,date("m") ,date("d")-1,date("Y"));
|
$datumyesterday= mktime (0,0,0,date("m") ,date("d")-1,date("Y"));
|
||||||
|
$datumweek= mktime (0,0,0,date("m") ,date("d")-6,date("Y"));
|
||||||
$xrange2= date ("Y-m-d",$datumyesterday);
|
$xrange2= date ("Y-m-d",$datumyesterday);
|
||||||
$xrange="set xrange ['$xrange2':'$xrange1']
|
$xrange3= date ("Y-m-d",$datumweek);
|
||||||
";
|
$xrange="set xrange ['$xrange2':'$xrange1'] ";
|
||||||
|
$xrangeweek="set xrange ['$xrange3':'$xrange1'] ";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch ($gnutyp):
|
switch ($gnutyp):
|
||||||
Case FS20: ############################################
|
Case FS20: ############################################
|
||||||
$gplotmain=<<<EOD
|
$gplotmain=<<<EOD
|
||||||
|
|
||||||
set size 1,0.5
|
set size 1,0.5
|
||||||
set noytics
|
set noytics
|
||||||
set noy2tics
|
set noy2tics
|
||||||
@@ -65,10 +87,24 @@ set yrange [-0.2:1.2]
|
|||||||
set ylabel "On/Off"
|
set ylabel "On/Off"
|
||||||
plot "< awk '{print $1, $3==\"on\"? 1 : $3==\"dimup\"? 1 : $3==\"dimdown\"? 0 : $3==\"off\"? 0 : 0.5;}' $logfile" using 1:2 title '' with steps
|
plot "< awk '{print $1, $3==\"on\"? 1 : $3==\"dimup\"? 1 : $3==\"dimdown\"? 0 : $3==\"off\"? 0 : 0.5;}' $logfile" using 1:2 title '' with steps
|
||||||
EOD;
|
EOD;
|
||||||
#plot "< awk '{print $1, $3==\"on\"? 1 : $3==\"dimup\"? 0.8 : $3==\"dimdown\"? 0.2 : $3==\"off\"? 0 : 0.5;}' $logfile" using 1:2 title '' with steps
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Case WS300_t1: ############################################
|
Case WS300_t1: ############################################
|
||||||
|
if ($DBUse==1)
|
||||||
|
{
|
||||||
|
$sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' order by timestamp desc limit ".$logrotateKS300lines."") or die (mysql_error());
|
||||||
|
while ($row = mysql_fetch_object($sqlarray)) {
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
fputs($f1,"$date $gnudraw $row->value\n");
|
||||||
|
}
|
||||||
|
fclose($f1);
|
||||||
|
}
|
||||||
$gplotmain="
|
$gplotmain="
|
||||||
set ylabel 'Temperature (Celsius)'
|
set ylabel 'Temperature (Celsius)'
|
||||||
set y2label 'Humidity (%)'
|
set y2label 'Humidity (%)'
|
||||||
@@ -77,7 +113,21 @@ break;
|
|||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Case WS300_t2: ############################################
|
Case WS300_t2: ############################################
|
||||||
|
if ($DBUse==1)
|
||||||
|
{
|
||||||
|
$sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' order by timestamp desc limit ".$logrotateKS300lines."") or die (mysql_error());
|
||||||
|
while ($row = mysql_fetch_object($sqlarray)) {
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
fputs($f1,"$date $gnudraw $row->value\n");
|
||||||
|
}
|
||||||
|
fclose($f1);
|
||||||
|
}
|
||||||
$gplotmain=<<<EOD
|
$gplotmain=<<<EOD
|
||||||
set ylabel "Air Pressure (hPa)"
|
set ylabel "Air Pressure (hPa)"
|
||||||
set y2label "Willi"
|
set y2label "Willi"
|
||||||
@@ -86,7 +136,21 @@ plot "< grep -v avg $logfile" using 1:8 axes x1y1 title 'Air Pressure' with line
|
|||||||
EOD;
|
EOD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Case KS300_t1: ############################################
|
Case KS300_t1: ############################################
|
||||||
|
if ($DBUse==1)
|
||||||
|
{
|
||||||
|
$sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' order by timestamp desc limit ".$logrotateKS300lines."") or die (mysql_error());
|
||||||
|
while ($row = mysql_fetch_object($sqlarray)) {
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
fputs($f1,"$date $gnudraw $row->value\n");
|
||||||
|
}
|
||||||
|
fclose($f1);
|
||||||
|
}
|
||||||
$gplotmain="
|
$gplotmain="
|
||||||
set ylabel 'Temperature (Celsius)'
|
set ylabel 'Temperature (Celsius)'
|
||||||
set y2label 'Humidity (%)'
|
set y2label 'Humidity (%)'
|
||||||
@@ -95,16 +159,44 @@ EOD;
|
|||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Case KS300_t2: ############################################
|
Case KS300_t2: ############################################
|
||||||
$gplotmain=<<<EOD
|
if ($DBUse==1)
|
||||||
set ylabel "Wind (Km/h)"
|
{
|
||||||
set y2label "Rain (l/m2)"
|
$sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' order by timestamp desc limit ".$logrotateKS300lines."") or die (mysql_error());
|
||||||
plot "< grep -v avg $logfile" using 1:8 axes x1y1 title 'Wind' with lines, \
|
while ($row = mysql_fetch_object($sqlarray)) {
|
||||||
"< grep -v avg $logfile" using 1:10 axes x1y2 title 'Rain' with lines
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
EOD;
|
fputs($f1,"$date $gnudraw $row->value\n");
|
||||||
|
}
|
||||||
|
fclose($f1);
|
||||||
|
}
|
||||||
|
$gplotmain="
|
||||||
|
set ylabel 'Wind (Km/h)'
|
||||||
|
set y2label 'Rain (l/m2)'
|
||||||
|
plot '$logfile' using 1:8 axes x1y1 title 'Wind' with lines, \
|
||||||
|
'$logfile' using 1:10 axes x1y2 title 'Rain' with lines
|
||||||
|
";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Case FHT: ############################################
|
Case FHT: ############################################
|
||||||
|
if ($DBUse==1)
|
||||||
|
{
|
||||||
|
$sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' order by timestamp desc limit ".$logrotateFHTlines."") or die (mysql_error());
|
||||||
|
while ($row = mysql_fetch_object($sqlarray)) {
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
fputs($f1,"$date $gnudraw $row->reading $row->value\n");
|
||||||
|
}
|
||||||
|
fclose($f1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$gplotmain="
|
$gplotmain="
|
||||||
set ylabel 'Temperature (Celsius)'
|
set ylabel 'Temperature (Celsius)'
|
||||||
set yrange [$FHTyrange]
|
set yrange [$FHTyrange]
|
||||||
@@ -136,6 +228,15 @@ EOD;
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
Case HMS100T: ############################################
|
Case HMS100T: ############################################
|
||||||
|
if ($DBUse==1)
|
||||||
|
{
|
||||||
|
$sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' and type='HMS' order by timestamp desc limit ".$logrotateHMSlines."") or die (mysql_error());
|
||||||
|
while ($row = mysql_fetch_object($sqlarray)) {
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
fputs($f1,"$date $gnudraw $row->value\n");
|
||||||
|
}
|
||||||
|
fclose($f1);
|
||||||
|
}
|
||||||
$gplotmain="
|
$gplotmain="
|
||||||
set ylabel 'Temperature (Celsius)'
|
set ylabel 'Temperature (Celsius)'
|
||||||
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2
|
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2
|
||||||
@@ -166,6 +267,16 @@ EOD;
|
|||||||
|
|
||||||
Case HMS100TF: ############################################
|
Case HMS100TF: ############################################
|
||||||
Case CUL_WS: ############################################
|
Case CUL_WS: ############################################
|
||||||
|
if ($DBUse==1)
|
||||||
|
{
|
||||||
|
$sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' and (type='HMS' or type='CUL_WS') order by timestamp desc limit ".$logrotateHMSlines."") or die (mysql_error());
|
||||||
|
while ($row = mysql_fetch_object($sqlarray)) {
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
fputs($f1,"$date $gnudraw $row->value\n");
|
||||||
|
}
|
||||||
|
fclose($f1);
|
||||||
|
}
|
||||||
|
|
||||||
$gplotmain="
|
$gplotmain="
|
||||||
set ylabel 'Temperature (Celsius)'
|
set ylabel 'Temperature (Celsius)'
|
||||||
set y2label 'Humidity (%)'
|
set y2label 'Humidity (%)'
|
||||||
@@ -176,10 +287,13 @@ EOD;
|
|||||||
default:
|
default:
|
||||||
endswitch;
|
endswitch;
|
||||||
|
|
||||||
$message=$OUT1.$gplothdr.$gplotmain;
|
|
||||||
$f1=fopen("tmp/gnu1","w+");
|
|
||||||
fputs($f1,$message);
|
|
||||||
fclose($f1);
|
$message=$OUT1.$gplothdr.$xrangeweek.$gplotmain;
|
||||||
|
$f3=fopen("tmp/gnu1","w+");
|
||||||
|
fputs($f3,$message);
|
||||||
|
fclose($f3);
|
||||||
exec("$gnuplot tmp/gnu1",$output);
|
exec("$gnuplot tmp/gnu1",$output);
|
||||||
|
|
||||||
$message=$OUT2.$gplothdr.$xrange.$gplotmain;
|
$message=$OUT2.$gplothdr.$xrange.$gplotmain;
|
||||||
|
|||||||
@@ -18,10 +18,20 @@ $battery=$_GET['battery'];
|
|||||||
$supported_HMS= array('HMS100T','HMS100TF','HMS100WD','HMS100MG','HMS100TFK','HMS100W','RM100-2','HMS100CO','CUL_WS');
|
$supported_HMS= array('HMS100T','HMS100TF','HMS100WD','HMS100MG','HMS100TFK','HMS100W','RM100-2','HMS100CO','CUL_WS');
|
||||||
|
|
||||||
|
|
||||||
|
#Supported Device. Use UserDefs if you have other devices
|
||||||
|
if (! in_array($type,$supported_HMS)) show_error_type($imgmaxxhms,$imgmaxyhms,$type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($DBUse=="1") {
|
||||||
|
$sqlquery=mysql_query("select timestamp from history where device='".$drawhms."' and reading='data' order by timestamp desc limit 1");
|
||||||
|
$query=mysql_fetch_object($sqlquery);
|
||||||
|
$date=str_replace(" ","_",$query->timestamp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
$file="$logpath/$drawhms.log";
|
$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);
|
if (! file_exists($file)) show_error($file,$drawhms,$imgmaxxhms,$imgmaxyhms,$type);
|
||||||
|
|
||||||
## do we really need a new graphic??
|
## do we really need a new graphic??
|
||||||
@@ -30,19 +40,20 @@ $supported_HMS= array('HMS100T','HMS100TF','HMS100WD','HMS100MG','HMS100TFK','HM
|
|||||||
$parts = explode(" ", $tail1[0]);
|
$parts = explode(" ", $tail1[0]);
|
||||||
$date=$parts[0];
|
$date=$parts[0];
|
||||||
|
|
||||||
|
} #DBUse
|
||||||
|
|
||||||
|
|
||||||
|
$savefile=$AbsolutPath."/tmp/HMS.".$drawhms.".log.".$date.".png";
|
||||||
|
|
||||||
$savefile=$AbsolutPath."/tmp/HMS.".$drawhms.".log.".$parts[0].".png";
|
|
||||||
if (file_exists($savefile)) {
|
if (file_exists($savefile)) {
|
||||||
|
|
||||||
#echo "exists: $savefile"; exit;
|
|
||||||
$im2 = @ImageCreateFromPNG($savefile);
|
$im2 = @ImageCreateFromPNG($savefile);
|
||||||
header("Content-type: image/png");
|
header("Content-type: image/png");
|
||||||
imagePng($im2);
|
imagePng($im2);
|
||||||
exit; # ;-)))
|
exit; # ;-))) we do not need a new graphic
|
||||||
}
|
}
|
||||||
else #delete old pngs
|
else #delete old pngs
|
||||||
{
|
{
|
||||||
#echo "not exist: $savefile"; exit;
|
|
||||||
$delfile=$AbsolutPath."/tmp/HMS.".$drawhms.".log.*.png";
|
$delfile=$AbsolutPath."/tmp/HMS.".$drawhms.".log.*.png";
|
||||||
foreach (glob($delfile) as $filename) {
|
foreach (glob($delfile) as $filename) {
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
@@ -70,7 +81,21 @@ $supported_HMS= array('HMS100T','HMS100TF','HMS100WD','HMS100MG','HMS100TFK','HM
|
|||||||
ImageFill($im, 0, 0, $bg2p);
|
ImageFill($im, 0, 0, $bg2p);
|
||||||
ImageRectangle($im, 0, 0, $imgmaxxhms-1, $imgmaxyhms-1, $white);
|
ImageRectangle($im, 0, 0, $imgmaxxhms-1, $imgmaxyhms-1, $white);
|
||||||
|
|
||||||
$array = file($file);
|
|
||||||
|
if ($DBUse=="1")
|
||||||
|
{
|
||||||
|
$array=array();
|
||||||
|
$sqlarray=mysql_query("select timestamp,event from history where device='".$drawhms."' and reading='data' order by timestamp desc limit ".$logrotateHMSlines."") or die (mysql_error());
|
||||||
|
while ( $row=mysql_fetch_object($sqlarray))
|
||||||
|
{
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
array_push($array,$date.' '.$drawhms.' '.$row->event);
|
||||||
|
}
|
||||||
|
$array=array_reverse($array);
|
||||||
|
}
|
||||||
|
else $array = file($file);
|
||||||
|
|
||||||
|
|
||||||
$oldmin=0; //only the data from every 10min
|
$oldmin=0; //only the data from every 10min
|
||||||
$oldhour=0; //only the data from every 10min
|
$oldhour=0; //only the data from every 10min
|
||||||
$mintemp=100;
|
$mintemp=100;
|
||||||
@@ -79,7 +104,7 @@ $supported_HMS= array('HMS100T','HMS100TF','HMS100WD','HMS100MG','HMS100TFK','HM
|
|||||||
#if ($maxcountHMS < $counter) {$counter=$maxcountHMS;};
|
#if ($maxcountHMS < $counter) {$counter=$maxcountHMS;};
|
||||||
|
|
||||||
#Logrotate
|
#Logrotate
|
||||||
if ((($logrotateHMSlines+100) < $counter) and ($logrotate == 'yes')) LogRotate($array,$file,$logrotateHMSlines);
|
if ((($logrotateHMSlines+100) < $counter) and ($logrotate == 'yes') and ($DBUse!="1")) LogRotate($array,$file,$logrotateHMSlines);
|
||||||
|
|
||||||
#print_r($array[1]);
|
#print_r($array[1]);
|
||||||
#print_r($array[1][12]); exit;
|
#print_r($array[1][12]); exit;
|
||||||
@@ -243,7 +268,7 @@ if ( $type == "HMS100TF" and $showdewpoint=='yes' )
|
|||||||
$fontsize=7;
|
$fontsize=7;
|
||||||
$text='Bat: '.$battery;
|
$text='Bat: '.$battery;
|
||||||
if ($type=="CUL_WS") $text="";
|
if ($type=="CUL_WS") $text="";
|
||||||
if ($battery != 'ok') {$txtcolor=$red; $text='Bat: low';};
|
if ($battery == 'empty') {$txtcolor=$red; $text='Bat: low';};
|
||||||
ImageTTFText ($im, $fontsize, 0, 105, 10, $txtcolor, $fontttf, $text);
|
ImageTTFText ($im, $fontsize, 0, 105, 10, $txtcolor, $fontttf, $text);
|
||||||
$fontsize=7;
|
$fontsize=7;
|
||||||
$txtcolor=$bg3p;
|
$txtcolor=$bg3p;
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ $room=$_GET['room'];
|
|||||||
$avgday=$_GET['avgday'];
|
$avgday=$_GET['avgday'];
|
||||||
$avgmonth=$_GET['avgmonth'];
|
$avgmonth=$_GET['avgmonth'];
|
||||||
|
|
||||||
|
|
||||||
|
if ($DBUse=="1") {
|
||||||
|
$sqlquery=mysql_query("select timestamp from history where device='".$drawks."' order by timestamp desc limit 1");
|
||||||
|
$query=mysql_fetch_object($sqlquery);
|
||||||
|
$date=str_replace(" ","_",$query->timestamp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
$file="$logpath/$drawks.log";
|
$file="$logpath/$drawks.log";
|
||||||
if (! file_exists($file)) show_error($file,$drawks,$imgmaxxks,$imgmaxyks);
|
if (! file_exists($file)) show_error($file,$drawks,$imgmaxxks,$imgmaxyks);
|
||||||
|
|
||||||
@@ -21,9 +30,12 @@ $avgmonth=$_GET['avgmonth'];
|
|||||||
$execorder=$tailpath.' -1 '.$file;
|
$execorder=$tailpath.' -1 '.$file;
|
||||||
exec($execorder,$tail1);
|
exec($execorder,$tail1);
|
||||||
$parts = explode(" ", $tail1[0]);
|
$parts = explode(" ", $tail1[0]);
|
||||||
|
$date=$parts[0];
|
||||||
|
} #dbuse
|
||||||
|
|
||||||
|
|
||||||
$savefile=$AbsolutPath."/tmp/KS.".$drawks.".log.".$parts[0].".png";
|
#if the expected graphic already exist then do not redraw the picture
|
||||||
|
$savefile=$AbsolutPath."/tmp/KS.".$drawks.".log.".$date.".png";
|
||||||
if (file_exists($savefile)) {
|
if (file_exists($savefile)) {
|
||||||
|
|
||||||
$im2 = @ImageCreateFromPNG($savefile);
|
$im2 = @ImageCreateFromPNG($savefile);
|
||||||
@@ -66,7 +78,24 @@ $avgmonth=$_GET['avgmonth'];
|
|||||||
ImageFill($im, 0, 0, $bg2p);
|
ImageFill($im, 0, 0, $bg2p);
|
||||||
ImageRectangle($im, 0, 0, $imgmaxxks-1, $imgmaxyks-1, $white);
|
ImageRectangle($im, 0, 0, $imgmaxxks-1, $imgmaxyks-1, $white);
|
||||||
|
|
||||||
$array = file($file);
|
if ($DBUse=="1")
|
||||||
|
{
|
||||||
|
$array=array();
|
||||||
|
$sqlarray=mysql_query("select timestamp,event from history where device='".$drawks."' and reading='data' order by timestamp desc limit ".$logrotateKS300lines."") or die (mysql_error());
|
||||||
|
while ( $row=mysql_fetch_object($sqlarray))
|
||||||
|
{
|
||||||
|
$date=str_replace(" ","_",$row->timestamp);
|
||||||
|
array_push($array,$date.' '.$drawks.' '.$row->event);
|
||||||
|
}
|
||||||
|
$array=array_reverse($array);
|
||||||
|
#print_r($array); #debug
|
||||||
|
#exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
else $array = file($file);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$oldmin=0; //only the data from every 10min
|
$oldmin=0; //only the data from every 10min
|
||||||
$oldhour=0; //only the data from every 10min
|
$oldhour=0; //only the data from every 10min
|
||||||
$mintemp=100;
|
$mintemp=100;
|
||||||
@@ -74,7 +103,7 @@ $avgmonth=$_GET['avgmonth'];
|
|||||||
$counter=count($array);
|
$counter=count($array);
|
||||||
|
|
||||||
#Logrotate
|
#Logrotate
|
||||||
if ((($logrotateKS300lines+200) < $counter) and ($logrotate == 'yes')) LogRotate($array,$file,$logrotateKS300lines);
|
if ((($logrotateKS300lines+200) < $counter) and ($logrotate == 'yes') and ($DBUse!="1")) LogRotate($array,$file,$logrotateKS300lines);
|
||||||
|
|
||||||
# go
|
# go
|
||||||
for ($x = 0; $x < $counter; $x++)
|
for ($x = 0; $x < $counter; $x++)
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ include "include/gnuplot.php";
|
|||||||
include "include/functions.php";
|
include "include/functions.php";
|
||||||
|
|
||||||
|
|
||||||
$pgm3version='100108';
|
$pgm3version='100312';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$Action = $_POST['Action'];
|
$Action = $_POST['Action'];
|
||||||
$order = $_POST['order'];
|
$order = $_POST['order'];
|
||||||
@@ -388,11 +390,12 @@ xml_parser_free($xml_parser);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#################################################### HMS
|
#################################################### HMS and CUL_WS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
elseif (substr($stack[0][children][$i][name],0,4)=='HMS_')
|
elseif ((substr($stack[0][children][$i][name],0,4)=='HMS_') || (substr($stack[0][children][$i][name],0,7)=='CUL_WS_'))
|
||||||
|
|
||||||
{
|
{
|
||||||
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
|
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
|
||||||
{
|
{
|
||||||
@@ -404,7 +407,7 @@ xml_parser_free($xml_parser);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} # HMS
|
} # HMS and CUL_WS
|
||||||
|
|
||||||
#################################################### LogpathFileLOG
|
#################################################### LogpathFileLOG
|
||||||
|
|
||||||
@@ -753,7 +756,7 @@ ht><font $fontcolor1><b>
|
|||||||
echo "</td></tr>\r";
|
echo "</td></tr>\r";
|
||||||
if (isset($showfs20) and $showgnuplot == 1)
|
if (isset($showfs20) and $showgnuplot == 1)
|
||||||
{
|
{
|
||||||
drawgnuplot($showfs20,"FS20",$gnuplot,$pictype,$logpath, $FHTyrange,$FHTy2range);
|
drawgnuplot($showfs20,"FS20",$gnuplot,$pictype,$logpath, $FHTyrange,$FHTy2range,$DBUse);
|
||||||
$FS20dev1=$showfs20.'1';
|
$FS20dev1=$showfs20.'1';
|
||||||
echo "\r<tr><td colspan=5 align=center><img src='tmp/$showfs20.$pictype'><br>
|
echo "\r<tr><td colspan=5 align=center><img src='tmp/$showfs20.$pictype'><br>
|
||||||
<img src='tmp/$FS20dev1.$pictype'>
|
<img src='tmp/$FS20dev1.$pictype'>
|
||||||
@@ -819,7 +822,7 @@ ht><font $fontcolor1><b>
|
|||||||
|
|
||||||
if ($showfht==$FHTdev and $showgnuplot == 1)
|
if ($showfht==$FHTdev and $showgnuplot == 1)
|
||||||
{
|
{
|
||||||
drawgnuplot($FHTdev,"FHT",$gnuplot,$pictype,$logpath, $FHTyrange,$FHTy2range);
|
drawgnuplot($FHTdev,"FHT",$gnuplot,$pictype,$logpath, $FHTyrange,$FHTy2range,$DBUse);
|
||||||
$FHTdev1=$FHTdev.'1';
|
$FHTdev1=$FHTdev.'1';
|
||||||
echo "\r<tr><td colspan=5 align=center><img src='tmp/$FHTdev.$pictype'><br>
|
echo "\r<tr><td colspan=5 align=center><img src='tmp/$FHTdev.$pictype'><br>
|
||||||
<img src='tmp/$FHTdev1.$pictype'>
|
<img src='tmp/$FHTdev1.$pictype'>
|
||||||
@@ -893,7 +896,7 @@ ht><font $fontcolor1><b>
|
|||||||
echo "<img src='include/hms100.php?drawhms=$HMSdev&room=$room&type=$type&battery=$battery' width='$imgmaxxhms' height='$imgmaxyhms'></td> </tr>";
|
echo "<img src='include/hms100.php?drawhms=$HMSdev&room=$room&type=$type&battery=$battery' width='$imgmaxxhms' height='$imgmaxyhms'></td> </tr>";
|
||||||
|
|
||||||
if ($showhmsgnu == $HMSdev and $showgnuplot == 1)
|
if ($showhmsgnu == $HMSdev and $showgnuplot == 1)
|
||||||
{ drawgnuplot($HMSdev,$type,$gnuplot,$pictype,$logpath,0,0);
|
{ drawgnuplot($HMSdev,$type,$gnuplot,$pictype,$logpath,0,0,$DBUse);
|
||||||
$HMSdev1=$HMSdev.'1';
|
$HMSdev1=$HMSdev.'1';
|
||||||
echo "\r<tr><td colspan=5 align=center><img src='tmp/$HMSdev.$pictype'><br>
|
echo "\r<tr><td colspan=5 align=center><img src='tmp/$HMSdev.$pictype'><br>
|
||||||
<img src='tmp/$HMSdev1.$pictype'>
|
<img src='tmp/$HMSdev1.$pictype'>
|
||||||
@@ -967,11 +970,11 @@ ht><font $fontcolor1><b>
|
|||||||
{
|
{
|
||||||
if ($kstyp=="1")
|
if ($kstyp=="1")
|
||||||
{
|
{
|
||||||
drawgnuplot($KSdev,$drawtype."_t1",$gnuplot,$pictype,$logpath,0,0);
|
drawgnuplot($KSdev,$drawtype."_t1",$gnuplot,$pictype,$logpath,0,0,$DBUse);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawgnuplot($KSdev,$drawtype."_t2",$gnuplot,$pictype,$logpath,0,0);
|
drawgnuplot($KSdev,$drawtype."_t2",$gnuplot,$pictype,$logpath,0,0,$DBUse);
|
||||||
}
|
}
|
||||||
$KSdev1=$KSdev.'1';
|
$KSdev1=$KSdev.'1';
|
||||||
echo "\r<tr><td colspan=5 align=center><img src='tmp/$KSdev.$pictype'><br>
|
echo "\r<tr><td colspan=5 align=center><img src='tmp/$KSdev.$pictype'><br>
|
||||||
@@ -1106,7 +1109,7 @@ ht><font $fontcolor1><b>
|
|||||||
echo "\r<img src='include/userdefs.php?userdefnr=$i' width='$imgmaxxuserdef' height='$imgmaxyuserdef'></td> </tr>";
|
echo "\r<img src='include/userdefs.php?userdefnr=$i' width='$imgmaxxuserdef' height='$imgmaxyuserdef'></td> </tr>";
|
||||||
|
|
||||||
if ($showuserdefgnu == $UserDef and $showgnuplot == 1)
|
if ($showuserdefgnu == $UserDef and $showgnuplot == 1)
|
||||||
{ drawgnuplot($UserDef,$type,$gnuplot,$pictype,$logpath,$userdef[$i],$i);
|
{ drawgnuplot($UserDef,$type,$gnuplot,$pictype,$logpath,$userdef[$i],$i,$DBUse);
|
||||||
$UserDef1=$UserDef.'1';
|
$UserDef1=$UserDef.'1';
|
||||||
echo "\r<tr><td colspan=5 align=center><img src='tmp/$UserDef.$pictype'><br>
|
echo "\r<tr><td colspan=5 align=center><img src='tmp/$UserDef.$pictype'><br>
|
||||||
<img src='tmp/$UserDef1.$pictype'>
|
<img src='tmp/$UserDef1.$pictype'>
|
||||||
|
|||||||
Reference in New Issue
Block a user