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

random-device for one-time at-order (define <randdev> at set ...), better WS300-Support

git-svn-id: https://svn.fhem.de/fhem/trunk@32 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinhaas 2007-03-20 18:46:10 +00:00
parent 2c8f2dd2c2
commit 64a9932936
4 changed files with 83 additions and 60 deletions

View File

@ -105,7 +105,8 @@ Changelog
-- Now you can use php4 OR php5 (php5 is recommended) -- Now you can use php4 OR php5 (php5 is recommended)
-- Feature: php-Pictures of FHT now inclusive "desired-temp" -- Feature: php-Pictures of FHT now inclusive "desired-temp"
2007-03-19 (0.8.0) ==DATE== (0.8.0)
-- Feature: Now you can adjust the range of the Gnuplot-pictures of FHT in the config.php -- Feature: Now you can adjust the range of the Gnuplot-pictures of FHT in the config.php
-- Feature: WS300 is now supported -- Feature: WS300 is now supported
-- Internal: Adjusted to the new internal structure of FHEM. YOU MUST HAVE FHEM >=3.4. -- Internal: Adjusted to the new internal structure of FHEM. YOU MUST HAVE FHEM >=4.0
-- Internal: random-device for one-time at-order (define <randdev> at set ...)

View File

@ -38,4 +38,14 @@ function bft($windspeed) # wind speed in Beaufort
} }
function randdefine()
{
$rand1 = rand(500,20000);
$rand2 = rand(500,20000);
$rq = md5($rand1.$rand2);
$randdefine=substr($rq,0,5);
return ($randdefine);
}
?> ?>

View File

@ -34,6 +34,24 @@ $xrange="set xrange ['$xrange2':'$xrange1']
switch ($gnutyp): switch ($gnutyp):
Case WS300_t1: ############################################
$gplotmain="
set ylabel 'Temperature (Celsius)'
set y2label 'Humidity (%)'
plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 3,\
'$logfile' using 1:6 axes x1y2 title 'Rel. Humidity (%)' with lines
";
break;
Case WS300_t2: ############################################
$gplotmain=<<<EOD
set ylabel "Air Pressure (hPa)"
set y2label "Willi"
plot "< grep -v avg $logfile" using 1:8 axes x1y1 title 'Air Pressure' with lines, \
"< grep -v avg $logfile" using 1:10 axes x1y2 title 'Willi' with lines
EOD;
break;
Case KS300_t1: ############################################ Case KS300_t1: ############################################
$gplotmain=" $gplotmain="
set ylabel 'Temperature (Celsius)' set ylabel 'Temperature (Celsius)'

View File

@ -1,6 +1,6 @@
<?php <?php
#### pgm3 -- a PHP-webfrontend for fhem.pl #### pgm3 -- a PHP-webfrontend for fhz1000.pl
################################################################ ################################################################
# #
@ -37,6 +37,7 @@
error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL ^ E_NOTICE);
include "config.php"; include "config.php";
include "include/gnuplot.php"; include "include/gnuplot.php";
include "include/functions.php";
$pgm3version='0.8.0cvs'; $pgm3version='0.8.0cvs';
@ -158,16 +159,19 @@ switch ($Action):
{ {
$order=str_replace("\\","",$order); $order=str_replace("\\","",$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");
break; break;
Case exec2: Case exec2:
if ($atorder=='at')
{ $atorder='define '.randdefine().' '.$atorder; }
$order="$atorder $attime set $fs20dev $orderpulldown $valuetime"; $order="$atorder $attime set $fs20dev $orderpulldown $valuetime";
if ($kioskmode=='off') execFHZ($order,$fhz1000,$fhz1000port); if ($kioskmode=='off') execFHZ($order,$fhz1000,$fhz1000port);
header("Location: $forwardurl"); header("Location: $forwardurl");
Case exec3: Case exec3:
if ($atorder=='at')
{ $atorder='define '.randdefine().' '.$atorder; }
$order="$atorder $attime set $fhtdev $orderpulldown $valuetime"; $order="$atorder $attime set $fhtdev $orderpulldown $valuetime";
if ($kioskmode=='off') execFHZ($order,$fhz1000,$fhz1000port); if ($kioskmode=='off') execFHZ($order,$fhz1000,$fhz1000port);
Case execfht: Case execfht:
@ -235,7 +239,6 @@ else
echo "$errstr ($errno)<br />\n"; echo "$errstr ($errno)<br />\n";
} else { } else {
fwrite($fp, "xmllist\r\n;quit\r\n"); fwrite($fp, "xmllist\r\n;quit\r\n");
# $fp=str_replace("DEVICES","LIST",$fp);
while (!feof($fp)) { while (!feof($fp)) {
$outputvar = fgets($fp, 1024); $outputvar = fgets($fp, 1024);
array_push($output,$outputvar); array_push($output,$outputvar);
@ -640,7 +643,6 @@ xml_parser_free($xml_parser);
############################ ############################
elseif (substr($stack[0][children][$i][name],0,6)=='KS300_' or substr($stack[0][children][$i][name],0,6)=='WS300_') elseif (substr($stack[0][children][$i][name],0,6)=='KS300_' or substr($stack[0][children][$i][name],0,6)=='WS300_')
{ {
if ($stack[0][children][$i][name]=='WS300_LIST') $willi=1;
$type=$stack[0][children][$i][name]; $type=$stack[0][children][$i][name];
echo "<tr><td $bg1 colspan=4><font $fontcolor1>"; echo "<tr><td $bg1 colspan=4><font $fontcolor1>";
echo "$type</font></td></tr>"; echo "$type</font></td></tr>";
@ -650,24 +652,16 @@ xml_parser_free($xml_parser);
$room=''; $room='';
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++) for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
{ {
$check=$stack[0][children][$i][children][$j][children][$k][attrs][name]; $check=$stack[0][children][$i][children][$j][children][$k][attrs][key];
if ($check='STATE') $check2=$stack[0][children][$i][children][$j][children][$k][attrs][name];
{ if ($check=='room') $room=$stack[0][children][$i][children][$j][children][$k][attrs][value];
$name=$stack[0][children][$i][children][$j][children][$k][attrs][name];
$value=$stack[0][children][$i][children][$j][children][$k][attrs][value]; if ($check2=='avg_month') $KSavgmonth=$stack[0][children][$i][children][$j][children][$k][attrs][value];
$measured=$stack[0][children][$i][children][$j][children][$k][attrs][measured]; elseif ($check2=='avg_day') $KSavgday=$stack[0][children][$i][children][$j][children][$k][attrs][value];
if ($name=='temperature') {$KSmeasured=$measured;} elseif ($check2=='temperature') $KSmeasured=$stack[0][children][$i][children][$j][children][$k][attrs][measured];
elseif ($name=='avg_month') {$KSavgmonth=$value;} elseif ($check2=='willi') $willi=1;
elseif ($name=='avg_day') {$KSavgday=$value;};
}
if ($check='ATTR')
{
if (($stack[0][children][$i][children][$j][children][$k][attrs][key])=='room')
{
$room=$stack[0][children][$i][children][$j][children][$k][attrs][value];
}
}
} }
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room)) if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
{ {
$Xks=$imgmaxxks; $Xks=$imgmaxxks;
@ -684,25 +678,30 @@ xml_parser_free($xml_parser);
{echo "<tr valign=center><td align=center $bg2 valign=center> {echo "<tr valign=center><td align=center $bg2 valign=center>
<form action=$forwardurl method='POST'>"; <form action=$forwardurl method='POST'>";
if (! isset ($willi))
{
echo "<input type=hidden name=Action value=showks><br>Temp./Hum.<br> echo "<input type=hidden name=Action value=showks><br>Temp./Hum.<br>
<input type=radio name=kstyp value=\"1\" checked><br><br>Wind/Rain<br> <input type=radio name=kstyp value=\"1\" checked><br><br>";
<input type=radio name=kstyp value=\"2\"><br><br>"; if (! isset ($willi)) echo "Wind/Rain<br>"; else echo "Air Pressure/ Willi<br>";
} echo "<input type=radio name=kstyp value=\"2\"><br><br>";
else echo "<input type=hidden name=kstyp value=\"1\" checked>";
echo "<input type=hidden name=showroom value=$showroom> echo "<input type=hidden name=showroom value=$showroom>
<input type=hidden name=showks value=$KSdev> <input type=hidden name=showks value=$KSdev>
<input type=submit value='show'></form></td>"; <input type=submit value='show'></form></td>";
}; };
echo "<td $bg2<font $fontcolor3><b> $KSdev</font></b> </td><td $bg2 center=align colspan=2>"; echo "<td $bg2<font $fontcolor3><b> $KSdev</font></b> </td><td $bg2 center=align colspan=2>";
echo "<img src='include/ks300.php?drawks=$KSdev&room=$room&avgmonth=$KSavgmonth&avgday=$KSavgday' width='$Xks' height='$Yks'>"; echo "<img src='include/ks300.php?drawks=$KSdev&room=$room&avgmonth=$KSavgmonth&avgday=$KSavgday' width='$Xks' height='$Yks'>";
echo "</td></tr>"; echo "</td></tr>";
if (! isset ($willi)) $drawtype="KS300"; else $drawtype="WS300";
if (($showks == $KSdev) and $showgnuplot=='1') if (($showks == $KSdev) and $showgnuplot=='1')
{ {
if ($kstyp=="1")drawgnuplot($KSdev,"KS300_t1",$gnuplot,$pictype,$logpath,0,0); if ($kstyp=="1")
else drawgnuplot($KSdev,"KS300_t2",$gnuplot,$pictype,$logpath,0,0); {
drawgnuplot($KSdev,$drawtype."_t1",$gnuplot,$pictype,$logpath,0,0);
}
else
{
drawgnuplot($KSdev,$drawtype."_t2",$gnuplot,$pictype,$logpath,0,0);
}
$KSdev1=$KSdev.'1'; $KSdev1=$KSdev.'1';
echo "<tr><td colspan=5 align=center><img src='tmp/$KSdev.$pictype'><br> echo "<tr><td colspan=5 align=center><img src='tmp/$KSdev.$pictype'><br>
<img src='tmp/$KSdev1.$pictype'> <img src='tmp/$KSdev1.$pictype'>
@ -712,6 +711,7 @@ xml_parser_free($xml_parser);
} }
} }
} }
############################ ############################
elseif ($stack[0][children][$i][name]=='LOGS'or $stack[0][children][$i][name]=='FileLog_LIST') elseif ($stack[0][children][$i][name]=='LOGS'or $stack[0][children][$i][name]=='FileLog_LIST')
{ {
@ -737,8 +737,6 @@ xml_parser_free($xml_parser);
} }
} }
$name=$stack[0][children][$i][children][$j][attrs][name]; $name=$stack[0][children][$i][children][$j][attrs][name];
#$definition=$stack[0][children][$i][children][$j][attrs][definition];
#if ($definition != "")
echo "<tr><td colspan=2 border=0>Log:</td> echo "<tr><td colspan=2 border=0>Log:</td>
<td colspan=2 border=0>$value / $name </td></tr>"; <td colspan=2 border=0>$value / $name </td></tr>";
@ -787,9 +785,7 @@ xml_parser_free($xml_parser);
if (isset ($showat)) if (isset ($showat))
for($j=0; $j < count($stack[0][children][$i][children]); $j++) for($j=0; $j < count($stack[0][children][$i][children]); $j++)
{ {
#$command=$stack[0][children][$i][children][$j][attrs][command];
$command=$stack[0][children][$i][children][$j][attrs][name]; $command=$stack[0][children][$i][children][$j][attrs][name];
#$next=$stack[0][children][$i][children][$j][attrs][next];
$next=$stack[0][children][$i][children][$j][attrs][state]; $next=$stack[0][children][$i][children][$j][attrs][state];
$order=$command; $order=$command;
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++) for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
@ -801,9 +797,7 @@ xml_parser_free($xml_parser);
} }
} }
#$order=str_replace("+","@",$order);
$order='delete '.$order; $order='delete '.$order;
#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>$value / $next / $command</td></tr>"; echo "<tr><td> AT-Job: </td><td><a href='index.php?Action=exec&order=$order$link'>del</a></td><td colspan=2>$value / $next / $command</td></tr>";
} }
} }