2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

Bugfixes for IE, Drewpoint for HMS100TF, better arrangement of RSS-Feeds

git-svn-id: https://svn.fhem.de/fhem/trunk@122 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinhaas 2007-12-08 20:16:34 +00:00
parent 9461ca352c
commit a333fd213c
7 changed files with 99 additions and 21 deletions

View File

@ -153,5 +153,9 @@ It is not necessary to tell fhem that there are other logs.
-- feature: RSS-Feeds added -- feature: RSS-Feeds added
2007-12-03 (071203) 2007-12-03 (071203)
-- minor: rebuild picture of fht on every entry in the log (not only on change of measured-temp. -- change: rebuild picture of fht on every entry in the log (not only on change of measured-temp.
2007-12-08 (071208)
-- bugfix: Wrong display in MS IE. (Reported and solved by Boris)
-- Feature: Drewpoint im HMS100TF (Boris)
-- Feature: RSS-Feeds now new arranged

View File

@ -56,3 +56,8 @@
-- minor bugfix: rebuild picture of fht on every entry in the log (not only on change of measured-temp. Changes in fht.php -- minor bugfix: rebuild picture of fht on every entry in the log (not only on change of measured-temp. Changes in fht.php
-- logrotate: better warning if there are wrong rights for the pgm3-logrotate -- logrotate: better warning if there are wrong rights for the pgm3-logrotate
- Martin 2007-12-08
-- bugfix: Wrong display in MS IE. (Reported and solved by Boris)
-- Feature: Drewpoint im HMS100TF (Boris)
-- Feature: RSS-Feeds now new arranged

View File

@ -99,6 +99,7 @@
$imgmaxyhms=52; $imgmaxyhms=52;
$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)
$logrotateHMSlines=1200; # automatic Logrotate; $logrotate must be 'yes'. $logrotateHMSlines=1200; # automatic Logrotate; $logrotate must be 'yes'.
# Default:1200 # Default:1200
# read docs/logrotate if you want adjust it manually! # read docs/logrotate if you want adjust it manually!

View File

@ -37,6 +37,25 @@ function bft($windspeed) # wind speed in Beaufort
return($bft); return($bft);
} }
# saturation vapour pressure, approximation for
# temperature range 0°C .. +100,9°C
# see http://www.umnicom.de/Elektronik/Projekte/Wetterstation/Sensoren/SattDruck/SattDruck.htm
function svp($temperature) # saturation vapour pressure in hPa
{
$c1= 6.10780; # hPa
$c2= 17.09085;
$c3= 234.175; # °C
return($c1*exp(($c2*$temperature)/($c3+$temperature)));
}
# see http://www.umnicom.de/Elektronik/Projekte/Wetterstation/Sensoren/Taupunkte/Taupunkte.htm
function dewpoint($temp,$hum) # dew point and temperature in °C, humidity in %
{
$svp= svp($temp);
$log= log10($svp*$hum/100.0);
return( (234.67*$log-184.2)/(8.233-$log));
}
function randdefine() function randdefine()
{ {
@ -44,7 +63,7 @@ function randdefine()
$rand2 = rand(500,20000); $rand2 = rand(500,20000);
$rq = md5($rand1.$rand2); $rq = md5($rand1.$rand2);
$randdefine=substr($rq,0,5); $randdefine=substr($rq,0,5);
return ($randdefine); return ($randdefine);
} }

View File

@ -194,15 +194,6 @@ if ( $type == "HMS100TF") ## hms100tf-Device.
ImageTTFText ($im, $fontsize, 0, 182, 47, $txtcolor, $fontttf, $text); ImageTTFText ($im, $fontsize, 0, 182, 47, $txtcolor, $fontttf, $text);
# Taupunkt
# $tp = Taupunkt($tvalue,$hvalue);
# $fontsize=9;
# $text=$tp." °C";
# ImageTTFText ($im, $fontsize, 0, 350, 35, $bg1p, $fontttfb, $text);
# $txtcolor=$orange;
# $fontsize=7;
# $text="Taupunkt";
# ImageTTFText ($im, $fontsize, 0, 350, 47, $bg1p, $fontttf, $text);
}; };
@ -228,6 +219,20 @@ if ( $type == "HMS100T" or $type == "HMS100TF" )
$text=$resultreverse[0][0]; $text=$resultreverse[0][0];
ImageTTFText ($im, $fontsize, 0, $imgmaxxhms-127, 13, $txtcolor, $fontttf, $text); ImageTTFText ($im, $fontsize, 0, $imgmaxxhms-127, 13, $txtcolor, $fontttf, $text);
}; };
#############################################################################
## dew point
if ( $type == "HMS100TF" and $showdewpoint=='yes' )
{
$dp = sprintf("%3.1f", dewpoint($tvalue,$hvalue));
$fontsize=9;
$text=$dp." °C";
ImageTTFText ($im, $fontsize, 0, 350, 35, $bg1p, $fontttfb, $text);
$txtcolor=$orange;
$fontsize=7;
$text="Dewpoint";
ImageTTFText ($im, $fontsize, 0, 350, 47, $bg1p, $fontttf, $text);
}
############################################################################# #############################################################################
## general ## general
$txtcolor=$bg3p; $txtcolor=$bg3p;

View File

@ -38,6 +38,10 @@
header("Content-Type: text/xml"); header("Content-Type: text/xml");
$fs20list=array();
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?> echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
@ -56,7 +60,6 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
############################ ############################
if (substr($stack[0][children][$i][name],0,5)=='FS20_') if (substr($stack[0][children][$i][name],0,5)=='FS20_')
{ {
echo "<item>\n<title>************* FS20 state *************</title>\n<link>$forwardurl</link>\n</item>";
$type=$stack[0][children][$i][name]; $type=$stack[0][children][$i][name];
$counter=0; $counter=0;
for($j=0; $j < count($stack[0][children][$i][children]); $j++) for($j=0; $j < count($stack[0][children][$i][children]); $j++)
@ -87,7 +90,8 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
echo $url; echo $url;
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room)) if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
{ {
echo "<item>\n<title>$fs20 $state</title>\n<link>$url</link>\n</item>\n"; # echo "<item>\n<title>$fs20 $state</title>\n<link>$url</link>\n</item>\n";
array_push( $fs20list,array($fs20,$state,$room,$measured,$url));
}; };
} }
} }
@ -107,6 +111,9 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
{$room=$stack[0][children][$i][children][$j][children][$k][attrs][value]; } {$room=$stack[0][children][$i][children][$j][children][$k][attrs][value]; }
if ( $check=="measured-temp") if ( $check=="measured-temp")
{$measuredtemp=$stack[0][children][$i][children][$j][children][$k][attrs][value]; {$measuredtemp=$stack[0][children][$i][children][$j][children][$k][attrs][value];
$measured=$stack[0][children][$i][children][$j][children][$k][attrs][measured];
$pos=strpos($measured,' ');
$measured=substr($measured,$pos,strlen($measured));
$pos=strpos($measuredtemp,' '); $pos=strpos($measuredtemp,' ');
$measuredtemp=substr($measuredtemp,0,$pos); $measuredtemp=substr($measuredtemp,0,$pos);
} }
@ -114,7 +121,7 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room)) if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
{ {
$FHTdev=$stack[0][children][$i][children][$j][attrs][name]; $FHTdev=$stack[0][children][$i][children][$j][attrs][name];
echo "<item>\n<title>$FHTdev $measuredtemp</title>\n<link>$forwardurl</link>\n</item>\n"; echo "<item>\n<title>$FHTdev $measuredtemp $measured</title>\n<link>$forwardurl</link>\n</item>\n";
} }
} }
@ -127,6 +134,8 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
for($j=0; $j < count($stack[0][children][$i][children]); $j++) for($j=0; $j < count($stack[0][children][$i][children]); $j++)
{ {
$room=""; $room="";
unset($state);
unset($humidity);
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++)
{ {
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="room") if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="room")
@ -134,13 +143,24 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
} }
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="type") if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="type")
{$type=$stack[0][children][$i][children][$j][children][$k][attrs][value];}; {$type=$stack[0][children][$i][children][$j][children][$k][attrs][value];};
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="STATE") if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="humidity")
{$state=$stack[0][children][$i][children][$j][children][$k][attrs][value];}; {$humidity=$stack[0][children][$i][children][$j][children][$k][attrs][value];
};
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="temperature")
{
$state=$stack[0][children][$i][children][$j][children][$k][attrs][value];
$pos=strpos($state,'(');
$state=substr($state,0,$pos);
$measured=$stack[0][children][$i][children][$j][children][$k][attrs][measured];
$pos=strpos($measured,' ');
$measured=substr($measured,$pos,strlen($measured));
$state=$humidity.$state;
};
} }
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room)) if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
{ {
$HMSdev=$stack[0][children][$i][children][$j][attrs][name]; $HMSdev=$stack[0][children][$i][children][$j][attrs][name];
echo "<item>\n<title>$HMSdev $state</title>\n<link>$forwardurl</link>\n</item>\n"; echo "<item>\n<title>$HMSdev $state $measured</title>\n<link>$forwardurl</link>\n</item>\n";
} }
@ -160,8 +180,12 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
{ {
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="STATE") if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="STATE")
{$state=$stack[0][children][$i][children][$j][children][$k][attrs][value];}; {$state=$stack[0][children][$i][children][$j][children][$k][attrs][value];};
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="temperature")
$measured=$stack[0][children][$i][children][$j][children][$k][attrs][measured];
} }
echo "<item>\n<title>$KSdev $state</title>\n<link>$forwardurl</link>\n</item>\n"; $pos=strpos($measured,' ');
$measured=substr($measured,$pos,strlen($measured));
echo "<item>\n<title>$KSdev $state $measured</title>\n<link>$forwardurl</link>\n</item>\n";
} }
} }
@ -170,6 +194,26 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
} }
# now the FS20-Devices
if (count($fs20list) > 0 )
echo "<item>\n<title>************* FS20 state *************</title>\n<link>$forwardurl</link>\n</item>";
for ($x = 0; $x < count($fs20list); $x++)
{
$parts = explode(" ", $fs20list[$x]);
$fs20= $fs20list[$x][0];
$state= $fs20list[$x][1];
$measured= $fs20list[$x][3];
$pos=strpos($measured,' ');
$measured=substr($measured,$pos,strlen($measured));
$url= $fs20list[$x][4];
echo "<item>\n<title> $fs20 $state $measured</title>\n<link>$url</link>\n</item>\n";
}
echo " echo "
</channel> </channel>
</rss> </rss>

View File

@ -41,7 +41,7 @@ include "include/gnuplot.php";
include "include/functions.php"; include "include/functions.php";
$pgm3version='071203'; $pgm3version='071208';
$Action = $_POST['Action']; $Action = $_POST['Action'];
@ -690,11 +690,11 @@ xml_parser_free($xml_parser);
<input type=hidden name=Action value=showhmsgnu> <input type=hidden name=Action value=showhmsgnu>
<input type=hidden name=showroom value=$showroom> <input type=hidden name=showroom value=$showroom>
<input type=hidden name=showhmsgnu value=$gnuvalue> <input type=hidden name=showhmsgnu value=$gnuvalue>
<input type=submit value='$formvalue'></form></td><td $bg2 colspan=2>"; <input type=submit value='$formvalue'></form></td><td $bg2 colspan=3>";
} }
else else
{echo "<tr><td $bg2><td $bg2 colspan=2> ";} {echo "<tr><td $bg2><td $bg2 colspan=3> ";}
echo "<img src='include/hms100.php?drawhms=$HMSdev&room=$room&type=$type' width='$imgmaxxhms' height='$imgmaxyhms'></td> </tr>"; echo "<img src='include/hms100.php?drawhms=$HMSdev&room=$room&type=$type' width='$imgmaxxhms' height='$imgmaxyhms'></td> </tr>";