From a333fd213cecfa912948ef7ea08749d5165d1ef9 Mon Sep 17 00:00:00 2001 From: martinhaas <> Date: Sat, 8 Dec 2007 20:16:34 +0000 Subject: [PATCH] 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 --- fhem/webfrontend/pgm3/CHANGED | 6 ++- fhem/webfrontend/pgm3/HISTORY | 5 ++ fhem/webfrontend/pgm3/config.php | 1 + fhem/webfrontend/pgm3/include/functions.php | 21 +++++++- fhem/webfrontend/pgm3/include/hms100.php | 23 ++++---- fhem/webfrontend/pgm3/include/rssfeeds.php | 58 ++++++++++++++++++--- fhem/webfrontend/pgm3/index.php | 6 +-- 7 files changed, 99 insertions(+), 21 deletions(-) diff --git a/fhem/webfrontend/pgm3/CHANGED b/fhem/webfrontend/pgm3/CHANGED index 2401f8c73..cbb12783a 100644 --- a/fhem/webfrontend/pgm3/CHANGED +++ b/fhem/webfrontend/pgm3/CHANGED @@ -153,5 +153,9 @@ It is not necessary to tell fhem that there are other logs. -- feature: RSS-Feeds added 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 diff --git a/fhem/webfrontend/pgm3/HISTORY b/fhem/webfrontend/pgm3/HISTORY index 40004ba79..a4183a654 100644 --- a/fhem/webfrontend/pgm3/HISTORY +++ b/fhem/webfrontend/pgm3/HISTORY @@ -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 -- 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 + diff --git a/fhem/webfrontend/pgm3/config.php b/fhem/webfrontend/pgm3/config.php index b81f802c8..fb7e44ab4 100644 --- a/fhem/webfrontend/pgm3/config.php +++ b/fhem/webfrontend/pgm3/config.php @@ -99,6 +99,7 @@ $imgmaxyhms=52; $maxcountHMS='575'; # Maximum count of pixel (from right to left) (Default:575) $XcorrectMainTextHMS=25; # Text of main text from the right side (Default:) + $showdewpoint='yes'; # Dewpoint (german: taupunkt) $logrotateHMSlines=1200; # automatic Logrotate; $logrotate must be 'yes'. # Default:1200 # read docs/logrotate if you want adjust it manually! diff --git a/fhem/webfrontend/pgm3/include/functions.php b/fhem/webfrontend/pgm3/include/functions.php index 696e2c513..e6e2ac708 100644 --- a/fhem/webfrontend/pgm3/include/functions.php +++ b/fhem/webfrontend/pgm3/include/functions.php @@ -37,6 +37,25 @@ function bft($windspeed) # wind speed in Beaufort 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() { @@ -44,7 +63,7 @@ function randdefine() $rand2 = rand(500,20000); $rq = md5($rand1.$rand2); $randdefine=substr($rq,0,5); -return ($randdefine); + return ($randdefine); } diff --git a/fhem/webfrontend/pgm3/include/hms100.php b/fhem/webfrontend/pgm3/include/hms100.php index b32c55eff..d169009f7 100755 --- a/fhem/webfrontend/pgm3/include/hms100.php +++ b/fhem/webfrontend/pgm3/include/hms100.php @@ -194,15 +194,6 @@ if ( $type == "HMS100TF") ## hms100tf-Device. 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]; 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 $txtcolor=$bg3p; diff --git a/fhem/webfrontend/pgm3/include/rssfeeds.php b/fhem/webfrontend/pgm3/include/rssfeeds.php index a86126eb9..5193c303d 100644 --- a/fhem/webfrontend/pgm3/include/rssfeeds.php +++ b/fhem/webfrontend/pgm3/include/rssfeeds.php @@ -38,6 +38,10 @@ header("Content-Type: text/xml"); + +$fs20list=array(); + + echo " @@ -56,7 +60,6 @@ echo " ############################ if (substr($stack[0][children][$i][name],0,5)=='FS20_') { - echo "\n************* FS20 state *************\n$forwardurl\n"; $type=$stack[0][children][$i][name]; $counter=0; for($j=0; $j < count($stack[0][children][$i][children]); $j++) @@ -87,7 +90,8 @@ echo " echo $url; if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room)) { - echo "\n$fs20 $state\n$url\n\n"; +# echo "\n$fs20 $state\n$url\n\n"; + array_push( $fs20list,array($fs20,$state,$room,$measured,$url)); }; } } @@ -107,6 +111,9 @@ echo " {$room=$stack[0][children][$i][children][$j][children][$k][attrs][value]; } if ( $check=="measured-temp") {$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,' '); $measuredtemp=substr($measuredtemp,0,$pos); } @@ -114,7 +121,7 @@ echo " if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room)) { $FHTdev=$stack[0][children][$i][children][$j][attrs][name]; - echo "\n$FHTdev $measuredtemp\n$forwardurl\n\n"; + echo "\n$FHTdev $measuredtemp $measured\n$forwardurl\n\n"; } } @@ -127,6 +134,8 @@ echo " for($j=0; $j < count($stack[0][children][$i][children]); $j++) { $room=""; + unset($state); + unset($humidity); 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") @@ -134,13 +143,24 @@ echo " } if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="type") {$type=$stack[0][children][$i][children][$j][children][$k][attrs][value];}; - if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="STATE") - {$state=$stack[0][children][$i][children][$j][children][$k][attrs][value];}; + if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="humidity") + {$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)) { $HMSdev=$stack[0][children][$i][children][$j][attrs][name]; - echo "\n$HMSdev $state\n$forwardurl\n\n"; + echo "\n$HMSdev $state $measured\n$forwardurl\n\n"; } @@ -160,8 +180,12 @@ echo " { if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="STATE") {$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 "\n$KSdev $state\n$forwardurl\n\n"; + $pos=strpos($measured,' '); + $measured=substr($measured,$pos,strlen($measured)); + echo "\n$KSdev $state $measured\n$forwardurl\n\n"; } } @@ -170,6 +194,26 @@ echo " } +# now the FS20-Devices + if (count($fs20list) > 0 ) + echo "\n************* FS20 state *************\n$forwardurl\n"; + + 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 "\n $fs20 $state $measured\n$url\n\n"; + + + } + + + echo " diff --git a/fhem/webfrontend/pgm3/index.php b/fhem/webfrontend/pgm3/index.php index 8f98a1e9b..179800b50 100644 --- a/fhem/webfrontend/pgm3/index.php +++ b/fhem/webfrontend/pgm3/index.php @@ -41,7 +41,7 @@ include "include/gnuplot.php"; include "include/functions.php"; -$pgm3version='071203'; +$pgm3version='071208'; $Action = $_POST['Action']; @@ -690,11 +690,11 @@ xml_parser_free($xml_parser); - "; + "; } else - {echo " ";} + {echo " ";} echo " ";