2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

-- Commit Version 0.7.1 (old number)

-- Bugfix: DEL Button for at-Jobs now works
-- Now you can use php4 OR php5 (php5 is recommended)
-- Feature: php-Pictures of FHT now inclusive "desired-temp"


git-svn-id: https://svn.fhem.de/fhem/trunk@16 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinhaas 2007-02-14 20:12:59 +00:00
parent bd7a4c66a4
commit d3f5eb87ee
5 changed files with 90 additions and 48 deletions

View File

@ -5,11 +5,12 @@
###### required settings ###### required settings
$fhz1000="localhost"; # on which machine is fhz1000 runnning?? $fhz1000="localhost"; #only php5 ! On which machine is fhz1000 runnning??
# if it is not localhost then the fhz1000.cfg must # if it is not localhost then the fhz1000.cfg must
# run global: "port <nr> global" # run global: "port <nr> global"
$fhz1000port="7072"; # port of fhz1000.pl $fhz1000port="7072"; # port of fhz1000.pl
$logpath="/var/tmp"; # where are your logs? $logpath="/var/tmp"; # where are your logs?
$fhz1000_pl="/home/FHZ/fhz1000/fhz1000.pl"; #only required if you are using PHP4
################################################################################## ##################################################################################
###### nice to have ###### nice to have
@ -34,27 +35,17 @@
## HMS-Devices
$imgmaxxhms=620; #Size of the pictures. Default: 620 for faster systems else 380
$imgmaxyhms=52;
$logrotateHMSlines=1200; # automatic Logrotate; $logrotate must be 'yes'.
# Default:1200
# read docs/logrotate if you want adjust it manually!
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# from fhz1000.pl (user = ???)
## FHT-Devices ##############################################################################################
$imgmaxxfht=450; #Size of the pictures Default: 450 for faster systems else 380 ## FHZ-DEVICES
$imgmaxyfht=52; $show_general=1; #field to type FHZ1000-orders 0/1 Default:1
$logrotateFHTlines=4300; # automatic Logrotate; $logrotate must be 'yes'. $show_fs20pulldown=1; #Pull-Down for the FS20 Devices 0/1 Default:1
# Default:4300 $show_fhtpulldown=1; #Pull-Down for the FHT-Devices 0/1 Default:1
# read docs/logrotate if you want adjust it manually!
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# from fhz1000.pl (user = ???)
##############################################################################################
## FS20-Device, adjust it if you have e.g. long titles ## FS20-Device, adjust it if you have e.g. long titles
$imgmaxxfs20=85; #Size of the pictures, default=85 $imgmaxxfs20=85; #Size of the pictures, default=85
$imgmaxyfs20=85; # default=85 $imgmaxyfs20=85; # default=85
@ -66,7 +57,7 @@
$txtroom=""; # default=""; example: $txtroom="room: "; $txtroom=""; # default=""; example: $txtroom="room: ";
# room hidden will not be shown # room hidden will not be shown
##############################################################################################
## ROOMS adjust it if you have e.g. long titles ## ROOMS adjust it if you have e.g. long titles
$showroombuttons=1; #default 1 Values 0/1 $showroombuttons=1; #default 1 Values 0/1
$imgmaxxroom=$imgmaxxfs20; #Size of the pictures, default=$imgmaxxfs20 $imgmaxxroom=$imgmaxxfs20; #Size of the pictures, default=$imgmaxxfs20
@ -74,9 +65,32 @@
$roomfontsizetitel=10; # default=9 $roomfontsizetitel=10; # default=9
$roommaxiconperline=$fs20maxiconperline; # default=$fs20maxiconperline $roommaxiconperline=$fs20maxiconperline; # default=$fs20maxiconperline
##############################################################################################
## FHT-Devices
$imgmaxxfht=450; #Size of the pictures Default: 450 for faster systems else 380
$imgmaxyfht=52;
$show_desiredtemp=1; # show the desired_temp as a graphic (0/1)
$logrotateFHTlines=4300; # automatic Logrotate; $logrotate must be 'yes'.
# Default:4300
# read docs/logrotate if you want adjust it manually!
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# from fhz1000.pl (user = ???)
##############################################################################################
## HMS-Devices
$imgmaxxhms=620; #Size of the pictures. Default: 620 for faster systems else 380
$imgmaxyhms=52;
$logrotateHMSlines=1200; # automatic Logrotate; $logrotate must be 'yes'.
# Default:1200
# read docs/logrotate if you want adjust it manually!
# otherwise the system will slow down
# pgm3 (user www-data) needs the rights to write the logs
# from fhz1000.pl (user = ???)
##############################################################################################
## KS300-Device ## KS300-Device
$imgmaxxks=620; #Size of the pictures Default: 620 for faster systems else 380 $imgmaxxks=620; #Size of the pictures Default: 620 for faster systems else 380
@ -91,21 +105,17 @@
# from fhz1000.pl (user = ???) # from fhz1000.pl (user = ???)
## FHZ-DEVICES
$show_general=1; #field to type FHZ1000-orders 0/1 Default:1
$show_fs20pulldown=1; #Pull-Down for the FS20 Devices 0/1 Default:1
$show_fhtpulldown=1; #Pull-Down for the FHT-Devices 0/1 Default:1
##############################################################################################
## misc ## misc
$taillog=1; #make shure to have the correct rights. Values: 0/1 $taillog=1; #make shure to have the correct rights. Values: 0/1
$taillogorder="/usr/bin/tail -20 $logpath/fhz1000.log"; $taillogorder="/usr/bin/tail -20 $logpath/fhz1000.log";
## show Information at startup. Activate it by deleting the '#' ## show Information at startup.
$showLOGS='no'; #show the LOGS at startup. Default: no Values: yes/no $showLOGS='no'; #show the LOGS at startup. Default: no Values: yes/no
$showAT='yes'; #show the AT_JOBS at startup. Default: yes Values: yes/no $showAT='yes'; #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
@ -113,8 +123,8 @@
$urlreload=60; # Automatic reloading page [sec]. Default fast: 60 slow:90 $urlreload=90; # Automatic reloading page [sec]. Default fast: 60 slow:90
$titel="PHP-Webmachine for fhz1000.pl :-)"; #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";
$bodybg="bgcolor='#F5F5F5'"; $bodybg="bgcolor='#F5F5F5'";
$bg1="bgcolor='#6E94B7'"; $bg1="bgcolor='#6E94B7'";

View File

@ -29,9 +29,11 @@ setlocale (LC_ALL, 'de_DE.utf8');
$bg3p = ImageColorAllocate($im, $fontcol_grap_R,$fontcol_grap_G,$fontcol_grap_B); $bg3p = ImageColorAllocate($im, $fontcol_grap_R,$fontcol_grap_G,$fontcol_grap_B);
$white = ImageColorAllocate($im, 255, 255, 255); $white = ImageColorAllocate($im, 255, 255, 255);
$gray= ImageColorAllocate($im, 133, 133, 133); $gray= ImageColorAllocate($im, 133, 133, 133);
#$lightgray= ImageColorAllocate($im, 200, 198, 222);
$red = ImageColorAllocate($im, 255, 0, 0); $red = ImageColorAllocate($im, 255, 0, 0);
$green = ImageColorAllocate($im, 0, 255, 0); $green = ImageColorAllocate($im, 0, 255, 0);
$yellow= ImageColorAllocate($im, 255, 255, 0); $yellow= ImageColorAllocate($im, 255, 255, 0);
$lightyellow= ImageColorAllocate($im, 255, 247,222 );
$orange= ImageColorAllocate($im, 255, 230, 25); $orange= ImageColorAllocate($im, 255, 230, 25);
@ -44,6 +46,7 @@ setlocale (LC_ALL, 'de_DE.utf8');
$actuator=0; $actuator=0;
$actuator_date="unknown"; $actuator_date="unknown";
$counter=count($array); $counter=count($array);
$arraydesired=array();
#echo $counter; exit; #echo $counter; exit;
@ -65,10 +68,13 @@ setlocale (LC_ALL, 'de_DE.utf8');
$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);
} }
} }
$resultreverse = array_reverse($_SESSION["arraydata"]); $resultreverse = array_reverse($_SESSION["arraydata"]);
$reversedesired = array_reverse($arraydesired);
$xold=$imgmaxxfht; $xold=$imgmaxxfht;
if ( $imgmaxxfht > count ($resultreverse) ) if ( $imgmaxxfht > count ($resultreverse) )
@ -101,15 +107,21 @@ setlocale (LC_ALL, 'de_DE.utf8');
if ( ($parts[0] != $olddate) ) if ( ($parts[0] != $olddate) )
{ {
$olddate=$parts[0]; $olddate=$parts[0];
#ImageLine($im, $imgmaxxfht-$x, 0,$imgmaxxfht-$x , $imgmaxyfht, $bg1p);
ImageLine($im, $imgmaxxfht-$x, 0,$imgmaxxfht-$x , $imgmaxyfht, $bg1p); ImageLine($im, $imgmaxxfht-$x, 0,$imgmaxxfht-$x , $imgmaxyfht, $bg1p);
}; };
$y = round($imgmaxyfht-(($resultreverse[$x][2]-$mintemp)*$fac)); $y = round($imgmaxyfht-(($resultreverse[$x][2]-$mintemp)*$fac));
$y2 = round($imgmaxyfht-(($reversedesired[$x]-$mintemp)*$fac));
#ImageLine($im, $imgmaxxfht-$x, $y2, $xold, $yold2, $bg1p);
if ($show_desiredtemp == 1) ImageLine($im, $imgmaxxfht-$x+1, $y2, $xold, $yold2, $lightyellow);
ImageLine($im, $imgmaxxfht-$x, $y, $xold, $yold, $red); ImageLine($im, $imgmaxxfht-$x, $y, $xold, $yold, $red);
$xold=$imgmaxxfht-$x; $xold=$imgmaxxfht-$x;
$yold=$y; $yold=$y;
$yold2=$y2;
}; };
#print_r($resultreverse); #print_r($resultreverse);
#print_r($reversedesired);
#exit; #exit;
ImageLine($im, $imgmaxxfht-$x, 0,$imgmaxxfht-$x , $imgmaxyfht, $yellow); ImageLine($im, $imgmaxxfht-$x, 0,$imgmaxxfht-$x , $imgmaxyfht, $yellow);
###ttf ###ttf
@ -117,8 +129,8 @@ setlocale (LC_ALL, 'de_DE.utf8');
$fontsize=7; $fontsize=7;
$txtcolor=$bg3p; $txtcolor=$bg3p;
ImageTTFText ($im, $fontsize, 0, 5, 12, $txtcolor, $fontttf, $text); ImageTTFText ($im, $fontsize, 0, 5, 12, $txtcolor, $fontttf, $text);
#setlocale (LC_ALL, 'de_DE.UTF-8');
$text=$resultreverse[0][2]." &#176;C"; $text=$resultreverse[0][2]." &#176;C";
ImageTTFText ($im, 9, 0, 90, 35, $txtcolor, $fontttfb, $text); ImageTTFText ($im, 9, 0, 90, 35, $txtcolor, $fontttfb, $text);
$text= $drawfht; $text= $drawfht;

View File

@ -7,7 +7,7 @@
"thu-to1","fri-from1","fri-to1","sat-from1","sat-to1","sun-from1","sun-to1", "thu-to1","fri-from1","fri-to1","sat-from1","sat-to1","sun-from1","sun-to1",
"mon-from2","mon-to2","tue-from2","tue-to2","wed-from2","wed-to2","thu-from2", "mon-from2","mon-to2","tue-from2","tue-to2","wed-from2","wed-to2","thu-from2",
"thu-to2","fri-from2","fri-to2","sat-from2","sat-to2","sun-from2","sun-to2", "thu-to2","fri-from2","fri-to2","sat-from2","sat-to2","sun-from2","sun-to2",
"day-temp","night-temp","desired-temp","refeshvalues","windowopen-temp" "day-temp","night-temp","desired-temp","refreshvalues","windowopen-temp"
); );
echo " echo "

View File

@ -55,7 +55,7 @@ EOD;
Case FHT: ############################################ Case FHT: ############################################
$gplotmain=" $gplotmain="
set ylabel 'Temperature (Celsius)' set ylabel 'Temperature (Celsius)'
set yrange [16:31] set yrange [15:31]
set grid ytics set grid ytics
set y2label 'Actuator (%)' set y2label 'Actuator (%)'
set y2range [0:70] set y2range [0:70]

View File

@ -39,7 +39,7 @@ include "config.php";
include "include/gnuplot.php"; include "include/gnuplot.php";
$pgm3version='0.7.0'; $pgm3version='0.7.0b';
$Action = $_POST['Action']; $Action = $_POST['Action'];
@ -156,7 +156,9 @@ switch ($Action):
Case exec: Case exec:
if ($kioskmode=='off') if ($kioskmode=='off')
{ {
$order=str_replace("FFF","+",$order); $order=str_replace("\\","",$order);
$order=str_replace("@","+",$order);
# echo $order; exit;
execFHZ($order,$fhz1000,$fhz1000port); execFHZ($order,$fhz1000,$fhz1000port);
} }
header("Location: $forwardurl&errormessage=$errormessage"); header("Location: $forwardurl&errormessage=$errormessage");
@ -189,6 +191,17 @@ if ($taillog==1) exec($taillogorder,$tailoutput);
function execFHZ($order,$machine,$port) function execFHZ($order,$machine,$port)
{ {
global $errormessage; global $errormessage;
$version = explode('.', phpversion());
if ( $version[0] == 4 )
{
include "config.php";
$order="$fhz1000_pl $port '$order'"; #PHP4, only localhost
exec($order,$errormessage);
}
else
{
$fp = stream_socket_client("tcp://$machine:$port", $errno, $errstr, 30); $fp = stream_socket_client("tcp://$machine:$port", $errno, $errstr, 30);
if (!$fp) { if (!$fp) {
echo "$errstr ($errno)<br />\n"; echo "$errstr ($errno)<br />\n";
@ -197,14 +210,26 @@ $fp = stream_socket_client("tcp://$machine:$port", $errno, $errstr, 30);
$errormessage= fgets($fp, 1024); $errormessage= fgets($fp, 1024);
fclose($fp); fclose($fp);
} }
}
return $errormessage; return $errormessage;
} }
###### make an array from the xmllist ###### make an array from the xmllist
unset($output); unset($output);
$stack = array(); $stack = array();
$output=array(); $output=array();
$version = explode('.', phpversion());
if ( $version[0] == 4 )
{
$xmllist="$fhz1000_pl $fhz1000port xmllist";
exec($xmllist,$output);
}
else
{
$fp = stream_socket_client("tcp://$fhz1000:$fhz1000port", $errno, $errstr, 30); $fp = stream_socket_client("tcp://$fhz1000:$fhz1000port", $errno, $errstr, 30);
if (!$fp) { if (!$fp) {
echo "$errstr ($errno)<br />\n"; echo "$errstr ($errno)<br />\n";
@ -216,6 +241,7 @@ return $errormessage;
} }
fclose($fp); fclose($fp);
} }
}
@ -738,14 +764,8 @@ xml_parser_free($xml_parser);
$command=$stack[0][children][$i][children][$j][attrs][command]; $command=$stack[0][children][$i][children][$j][attrs][command];
$next=$stack[0][children][$i][children][$j][attrs][next]; $next=$stack[0][children][$i][children][$j][attrs][next];
$order=$command; $order=$command;
$order=str_replace("+","\FFF",$order); #workaround $order=str_replace("+","@",$order);
$order=str_replace("*","\*",$order); $order='del at '.$order;
$order=str_replace("$","\\$",$order);
$order=str_replace("(","\(",$order);
$order=str_replace(")","\)",$order);
$order=str_replace("{","\{",$order);
$order=str_replace("}","\}",$order);
$order='del at ^'.$order.'$';
if ($next != '') {$nexttxt='('.$next .')';} else {$nexttxt='';}; if ($next != '') {$nexttxt='('.$next .')';} else {$nexttxt='';};
echo "<tr><td> AT-Job: </td><td><a href='index.php?Action=exec&order=$order$link'>del</a></td><td colspan=2>$command $nexttxt</td></tr>"; echo "<tr><td> AT-Job: </td><td><a href='index.php?Action=exec&order=$order$link'>del</a></td><td colspan=2>$command $nexttxt</td></tr>";
} }