From 09c5edb703e357387e37a24103e3a2693eb6a747 Mon Sep 17 00:00:00 2001 From: martinhaas <> Date: Fri, 21 Dec 2007 12:27:09 +0000 Subject: [PATCH] HMS100-CO added, Dewpoint for ks300, webcam/picture-support git-svn-id: https://svn.fhem.de/fhem/trunk@125 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/webfrontend/pgm3/CHANGED | 6 +++ fhem/webfrontend/pgm3/HISTORY | 4 ++ fhem/webfrontend/pgm3/config.php | 12 ++++++ fhem/webfrontend/pgm3/include/functions.php | 23 ++++------- fhem/webfrontend/pgm3/include/ks300.php | 16 ++++++++ fhem/webfrontend/pgm3/index.php | 43 ++++++++++++++++++++- 6 files changed, 88 insertions(+), 16 deletions(-) diff --git a/fhem/webfrontend/pgm3/CHANGED b/fhem/webfrontend/pgm3/CHANGED index cbb12783a..ec65993ec 100644 --- a/fhem/webfrontend/pgm3/CHANGED +++ b/fhem/webfrontend/pgm3/CHANGED @@ -159,3 +159,9 @@ It is not necessary to tell fhem that there are other logs. -- bugfix: Wrong display in MS IE. (Reported and solved by Boris) -- Feature: Drewpoint im HMS100TF (Boris) -- Feature: RSS-Feeds now new arranged + + +2007-12-21 (071221) + -- Feature: HMS-CO supported (Peter A.) ==> hms100.php + -- Feature: Webcams or local pictures added ==>index.php. config.php + -- Feature: ks300 mit Drewpoint (Boris) ==>functions.php, ks300.php, config.php diff --git a/fhem/webfrontend/pgm3/HISTORY b/fhem/webfrontend/pgm3/HISTORY index a4183a654..645f04728 100644 --- a/fhem/webfrontend/pgm3/HISTORY +++ b/fhem/webfrontend/pgm3/HISTORY @@ -61,3 +61,7 @@ -- Feature: Drewpoint im HMS100TF (Boris) -- Feature: RSS-Feeds now new arranged +- Martin 2007-12-21 + -- Feature: HMS-CO supported (Peter A.) + -- Feature: Webcams or local pictures added + -- Feature: ks300 mit Drewpoint (Boris) diff --git a/fhem/webfrontend/pgm3/config.php b/fhem/webfrontend/pgm3/config.php index fb7e44ab4..6360b027c 100644 --- a/fhem/webfrontend/pgm3/config.php +++ b/fhem/webfrontend/pgm3/config.php @@ -37,6 +37,17 @@ $kioskmode='off'; +## Webcams + $showwebcam=0; #shows webcam-Urls or other pictures + $webcamwidth='150'; # the width of the shown picture + $wgetpath="/usr/bin/wget"; # you need the package wget for http, ftp... + $webcam[0]='http://webcam/IMAGE.JPG'; + #$webcam[1]='IMAGE.PNG'; # Supported are Webcams with http:// ftp:// .... + # and Images wich must be copied to /tmp/ + +# $webcam[2]='http://...'; +# ... + ############################################################################################## @@ -114,6 +125,7 @@ $imgmaxyks=52; $showbft=1; # Display values additionaly in Beafort. Values: 0 /1 Default:1 $maxcountKS='575'; # Maximum count of pixel (from right to left) (Default:575) + $showdewpointks300='yes'; # Dewpoint (german: taupunkt) $XcorrectMainTextKS=45; # Text of main text from the right side (Default: 35) $logrotateKS300lines=2100; # automatic Logrotate; $logrotate must be 'yes'. diff --git a/fhem/webfrontend/pgm3/include/functions.php b/fhem/webfrontend/pgm3/include/functions.php index e6e2ac708..f452b4819 100644 --- a/fhem/webfrontend/pgm3/include/functions.php +++ b/fhem/webfrontend/pgm3/include/functions.php @@ -37,26 +37,19 @@ 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 +# see http://de.wikipedia.org/wiki/Taupunkt, http://en.wikipedia.org/wiki/Dewpoint +# The dew point (or dewpoint) is the temperature to which a given parcel of air must be cooled, at constant +# barometric pressure, for water vapor to condense into water. The condensed water is called dew. The dew point +# is a saturation point. +# approximation valid for -30°C < $temp < 70°C 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)); + $log= log($hum/100.0); + return( (241.2*$log+(4222.03716*$temp)/(241.2+$temp))/(17.5043-$log-(17.5043*$temp)/(241.22+$temp)) ); } + function randdefine() { $rand1 = rand(500,20000); diff --git a/fhem/webfrontend/pgm3/include/ks300.php b/fhem/webfrontend/pgm3/include/ks300.php index 3f74de67e..65a938385 100755 --- a/fhem/webfrontend/pgm3/include/ks300.php +++ b/fhem/webfrontend/pgm3/include/ks300.php @@ -147,6 +147,7 @@ $avgmonth=$_GET['avgmonth']; ImageTTFText ($im, $fontsize, 0, 3, 10, $txtcolor, $fontttf, $text); $fontsize=9; $text=$temp." °C"; + $tvalue= $temp; ImageTTFText ($im, $fontsize, 0, 90-$XcorrectMainTextKS, 37, $txtcolor, $fontttfb, $text); $text= $drawks; ImageTTFText ($im, 8, 0, 90-$XcorrectMainTextKS, 22, $txtcolor, $fontttfb, $text); @@ -207,6 +208,7 @@ $avgmonth=$_GET['avgmonth']; ImageTTFText ($im, $fontsize, 0, 3, 10, $txtcolor, $fontttf, $text); $fontsize=9; $text=$temp." %"; + $hvalue= $temp; ImageTTFText ($im, $fontsize, 0, 90-$XcorrectMainText, 37, $txtcolor, $fontttfb, $text); $fontsize=7; $text="min= $min max= $max"; @@ -214,6 +216,20 @@ $avgmonth=$_GET['avgmonth']; $imh=$im; + + # dewpoint + if ($showdewpointks300='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); + } + #wind/Air Pressure $im = ImageCreateTrueColor($imgmaxxks,$imgmaxyks); ImageFill($im, 0, 0, $bg2p); diff --git a/fhem/webfrontend/pgm3/index.php b/fhem/webfrontend/pgm3/index.php index 179800b50..336fce6e0 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='071208'; +$pgm3version='071221'; $Action = $_POST['Action']; @@ -472,6 +472,47 @@ xml_parser_free($xml_parser);
v$pgm3version
"; + ###################### Webcam + + if ($showwebcam==1) + { + echo " + + + + + + +
+ WEBCAM + + "; + for($i=0; $i < count($webcam); $i++) + { + $webcam1=$webcam[$i]; + $pos = strpos($webcam1,'://'); # e.g. http://.. + if ($pos === false) # picture instead of an URL + { + $webcamname=$webcam[$i]; + } + else + { + $webcamname=str_replace("/","",$webcam1); + $webcamname=str_replace(":","",$webcamname); + $order="$wgetpath -O tmp/$webcamname $webcam1"; + exec($order,$res); + $errormessage = $res[0]; + echo $errormessage; + } + echo""; + } + echo" +
+ + + "; + + }; ############################ FHZ if ($show_fs20pulldown==1 or $show_general==1 or $show_fhtpulldown==1) {