Zur Darstellung der Messdaten verwendete ich das wetter.cgi aus dem Paket WS 2500 von Rainer Krinke.
Speziell für die Darstellung der Sonnenscheinwerte (sofern man bei dieser Station davon sprechen kann ) hat Rainer eine spezielle Version des wetter.cgi Scriptes geschrieben. Bei Bedarf einfach bei ihm Anfragen.
Der Konfigurationsteil aus dem Script für meine Station war:
# -------- START CONFIG VARIABLES --------------------------------------------- # $driver="mysql"; $sysDbName="mysql"; $dbServer="sqlhost"; $dbUser="sqluser"; $dbPassword="sqlpassword"; $database="database"; $defaultPort="3306"; # This variable controls if the *output* is in GMT or in Local time # Internally very date and time value is in GMT. User input is converted to GMT. $timeIsGMT=0; # This variable controls if the script time # input as well as output is in # GMT or in Local time. Internally every date and # time value is in GMT. User input is converted # to GMT if needed. $colGrfxTable=2; # Number of columns in HTML table for graphics $initialDisplayDays=7; # range ofdays to be initially displayed $doAutoBaseData=185; # If the date range to be displayed has more than # this number of days we automatically use average # values on hourly basis for display. If you don't # want this, set this variable to 0 $navPanelPos="top"; # Position where the navigation panel (Darstellungsparameter) is # displayed. May be "top" (above graphics) or "bottom" (beneath graphics) # If you assign a URL to this variable the target (should be a .css text file) # is used to get all the css definitions instead of the internal definitions # made below (search for variable $docCss). If you leave $externalCssUrl # empty the internal definitions are used. #$externalCssUrl="https://localhost/mypath/wetter.css"; #$externalCssUrl=""; # Unit of Windspeed to be displayed # 0: km/h, 1: Knots, 10: Knots and Km/h $latestWindSpeedType="0"; # TH=Temp/Hum; PR=Pressure; WI=Wind; LI=Light; RA=Rain; PY=Pyranometer # Which sensor to display in Latest data section of display # Only add Sensors you really have!!! # eg: $latestSens="TH,PR,WI,RA,LI,LD"; # By default for each sensor the sensor with its default Id is used # usually "1". If you want to display the latest data of another # sensor (except for the type TH) with a # different sensorId, then set the Variable %latestSensId like: # $latestSensId{"RA"}=2 # meaning, that the rain sensor with the sensorId 2 will be displayed # instead of the rain sensor with id 1. For a TH-sensor see $latest_th below. #$latestSens="TH,WI,PR,RA,LI"; $latestSens="TH,WI,PR,RA,LD"; $latest_th=[1]; $latestSensId{"WI"}=30; $latestSensId{"PR"}=20; $latestSensId{"RA"}=40; $latestSensId{"LD"}=50; # If you secifies sensor type TH above, you can say here which T/H sensors # should be displayed inlatest sensor display $latest_th=[10,9,2,1]; #$latest_th=[10,9,2,1]; # LATEST T/H VALS only from inside sens (id: 17) # You may list more ids here like # $latest_th=[1,17,2,3,4,5,6,7,8] # *** You HAVE TO specify sens ids that *** # *** really exist *** # Some options that can be used to display data that is calculated from the # original data values. The value on the right side is a list of logical names # that can be calculated like WindChill and Dewpoint. # The latest_do variable defines for the sensor type and sensor id that is noted on # the left side, what shall be calculated with which another additional sensor id # noted on the right side. . # So $latest_do->{"wind"}->{"1"}="WindChill(1)"; means that we want to display the # windchill temperature for the windsensor with id 1, based on the temperature # sensor (right side) with sensor id 1 # $latest_do->{"th"}->{"1"}="DewPoint,absHum"; means that we want to calculate # dewpoint and the abolute humidity based on data of temp/hum sensor 1. undef %latest_do; #$latest_do->{"wind"}->{"1"}="WindChill(1)"; #$latest_do->{"th"}->{"1"}="DewPoint,absHum"; $latest_do{"30"}="WindChill(9)"; $latest_do{"9"}="DewPoint,absHum"; # This variable lets you omit some values from the latest data display of one sensor # If you want eg not to display the Humidity value of a TH sensor but only the # temperature in the latest data section of this sensor # the following will do the job for a sensor with sensor id 1 # The value ("H") is the name of the database column to be omitted. #$latest_omit{"1"}="H"; $latest_omit{"1"}="H"; # For rain and pressure sensors you can activate the trendData display. Doing this # shows at *most* 3 older values from these sensors (as well as the current value anyway) # in the latest display. Note: Only *3* values are allowed since there is no more room for more # values. You have to specify the number of hours for each of the three values of each sensor. # If you e.g. say: 1h,6h,12h this means that for this sensor the value one/six/12 hour(s) ago will be # displayed. Please keep the format: eg "6h" not "6" nor "360Minutes"!!! If you do not want these # values to be displayed say eg: $latest_trendRain=[ ]; $latest_trendRain=[ "1h", "12h", "24h" ]; $latest_trendPressure=[ "3h", "12h", "24h" ]; $latest_trendLight=[ "1h", "3h", "5h" ]; # # Watch out this is for a trend sign (up or downarrow) for temperature/humidity # sensors. The left value is the sensorid, the right value the time in *MINUTES* # to look back in order to compare this value with the current one. # So "17:10" means that for temp/hum sensor with id 17 we look for a value that # is 10 minutes old. For each sensor only one value is allowed here. # Be sure to choose a time that is long enough. If eg your station collects data at an # interval of 15 minutes it does not make sense to use eg 10 minutes below. # You can define it here for all sensors it will be used only for those you # add below using addSensor() $latest_trendTemp=[ "17:30", "1:30", "2:30", "3:30", "4:30", "5:30", "6:30", "7:30", "8:30"]; # The threshold values for sensors which show trends by an arrow sign. If the difference # of the current value of such a sensor and an older value is larger than the first value # given below an arrow (up or down) will be displayed. # The values given below define ranges for the value difference. For example the # values 0.1, 0.2, 0.4 define three ranges: 0.1->0.2[, 0.2->0.4[, 0.4 ->.... # Differencevalues smaller than the first value (here:0.1) will not be decorated # with a trend sign. Depending on which range the current difference fits in, a different # symbol for "small change", "more change" and "big change" will be displayed. # Exactly three values a,b,c (defining three ranges) are allowed. $latest_trendThresholdT=["0.1", "0.3", "0.5"]; # Tempdifference values little, some, a lot $latest_trendThresholdH=["1", "3", "5"]; # Humidity difference $latest_trendThresholdPres=["1", "2", "3"]; # Pressure difference # The trend-symbol definition. There are three up and three down symbols that indicate # a week, average and a strong thrend up or down. $latest_trendSymbDown= ['<FONT color="black">↓</FONT>', # a little '<FONT color="darkRed">↓</FONT>', # somewhat more '<FONT color="red">↓</FONT>' ]; # a lot # $latest_trendSymbUp=['<FONT color="black">↑</FONT>', # a little '<FONT color="darkRed">↑</FONT>', # somewhat more '<FONT color="red">↑</FONT>' ]; # a lot # You may choose if a trend symbol or the symbol and the difference value or # only the difference value without a symbol should be printed. $latest_trendSymbMode="symbol+value"; #$latest_trendSymbMode="symbol"; #$latest_trendSymbMode="value"; # # The colors for different amounts of the difference. Corresponds to # $latest_trendSymbDown[123] and $latest_trendSymbUp[123] $latest_trendSymbTextCol=["black", "darkRed","red"]; # Relative text size: Allowed are values like -1, -2, ... which makes the text size # used for printing the value one, two, ... steps smaller than regular text. $latest_trendSymbTextSize="-2"; # This variable controls whether in the latest data output a sensors errors # will be displayed. If its !=0 then if a sensor had more dropouts in the last # hours (given by $latestAlertHours) the sensors name will be printed in # the color $latestAlertColor, to show the user that this sensor had # to much errors (==drop outs) in this period of time. # The numbers of errors is taken from the error table in the database. # So, for example # you could say, that if any of sensors displayed in the latest data section # had more than 10 errors in the last 12 hours then display its name in red: # $latestAlertErrCount=10; $latestAlertHours=12; # $latestAlertColor="red"; # Value has to be html conform $tmpName="$$"; # Path where the created images are stored #$basePath="/home/admin/www/wetter"; $basePath="/srv/www/htdocs/weather"; #$imgPath="$basePath/images"; $imgPath="$basePath/Graphiken"; # URL to access the images in Path "$imgPath" via the web-server #$baseImgUrl="https://www.uni-koblenz.de/~krienke/wetter/images"; $baseImgUrl="https://ws500.dynalias.org/weather/Graphiken"; # Default Id for wether station. 1 ist the id for the first one # You may add a different station ID to each individual sensor description # created by addSensor() below by simply adding eg: "stationId" => 2 # to the addSensor call. $defaultStationId=1; # Next you define all the sensor graphics that will be displayed in a HTML table # For each sensor you want to add, you have to write down a addSensor() call # with appropriate paramters. Bevor the first call to addSensor() you have to create # an object of Class "sensDisplayData". This is done by exactly using the first line # see below) with sensDisplayData->new() before the first addSensor() demo call. # This has to be done excatly ONE time, and then you can place calls to addSensor() # using the just created object. The minimum of information in the first parameter # (the first hash, surrounded by {}) in addSensor() is the sensor # type which may be one of TH, PR, WI, WD, WA, RA, LI. # TH is a Temperature Himidity display # PR is the air pressure display # WI is the wind display sowing the windspeed over time # WD is the wind display, showing the direction and speed in a polar # coordinate system # WA is the winddisplay showing the winddirection and varince over time # LI is the light display. #All Parameters are given in a anonymous # hash ({"NAME1"=>"value1", "NAME2"="VALUE2", ...}). Besides the type of sensor you # can specify all the parameters defined in the set??defaults() functions defined below, # where ?? is one of the Types from above (TH, ...). You probably want to specify # the sensorid of the sensor to be displayed, else the default sensorId for each # type is used. To specify one or more sensorids for one graphics simply add # the ids like {"sensType"=>"TH", "sensIds" => [1,2,17]}. This example would then # display T/H sensors with id 1,2 and 17 in one graphic. # Especially for TH sensors where temperature and humidity can be printed # it might be useful to be able to display just one of both or even none of # both but just the windchill value (a virtual sensor) based on this sensor. # To do so just set the omit array to the values that should not be printed. eg: # "omit"=>["T", "H"] would not display temp and hum of a TH sensor. So if there was no # virtual sensor defined you would'nt see anything but an error message the there are # no output values to be displayed! So always take care that there is at least one value left # one of a T, H value or a virtual sensor value. # # For some sensors it might be useful to let gnuplot automatically calculate # the Y-range. Usually the lower value is set by the script to a fix value. # For TH-Sensors this is eg 0". If you would like to let gnuplot # determine the Y bounds by itself set "lowYbounds"=>"auto" in the # addsensor() call like shown below. # # If you do not like the default sizes of the graphics you can modify them for each sensor # by adding non default values to the addSensorCall like #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [3]}, # "xSmallScale"=>0.75, "ySmallScale"=>0.75, # "xNormalScale"=>1.5, "yNormalScale"=>1.5, # { } ); # the Smallscale Variables desscribes the relative size of a graphic in the overview, whereas # the NormalScale Variables determine the relative size in the detailed sensor graphics # The default for SmallScale is 0.5, the default for NormalScale is 1.1. These values are multiplied # with the default width/height that gnuplot generates. So a value of 0.5 means "half of the normal size" # The "normal" size is given by what gnuplot generates for the PNG terminal. # # By default all sensors (exepct WA, WD) defined by addSensor() will also be used in the # statisticsMode. This may lead to a strange looking statistics table in # case that one real sensor is shown in two graphics for example with # different virtual sensor values. In the statistics display this would lead to the fact # that the same sensor beeing shown twice with the same statistic values since # the statistic display only shows stats of real sensor values not of virtual. # If a sensor that is defined by addSensor shall NOT be visible in the statistics overview # then one may set the attribute "statistics" => "0" like this: # #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [3]}, # "statistics"=>"0", # "xSmallScale"=>0.75, "ySmallScale"=>0.75, # "xNormalScale"=>1.5, "yNormalScale"=>1.5, # { } ); # # It is even possible to define sensors only for statistic evaluation that will # never be displayed in a graphics. This can be done by setting the "graphics" # flag to "0" like in: # #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [3]}, # "graphics"=>"0", {} ); # # In this case the sensor will not be visible as a graphics but will appear in the # statistics display. # # In such a case the sensor is shown in the graphics mode but is hidden in the # statistics mode. # # The addSensor() function actually has two Parameters. The first one has been descibed just above. # The second one describes which virtual sensors (if there are any defined in the # set*defaults() functions) should be active. # At the moment only for TH-sensors there are virtual sensors for windchill, # absolute humidity and dewpoint calculation. To activate one of them for a # TH-sensor the second parameter for addSensor() is a hash like: # {"windChill" =>"1", "absHumidity"=>"1", "dewPoint" =>"1" } # In this hash virtual sensors can be turned on by assigning them a "1" as showed above. # If left undefined ({}) or even omitted no virtual sensors will be displayed. # Please take care of the spelling of the virtual sensor names given above # Only one or all in the three (windChill, absHumidity, dewPoint) can be used. # # The wind sensor can be configured to plot data in kts instead of km/h # To do so simply put the directive "windSpeedType"=>1 in the definition of the windsensor. # The example below. "windSpeedType"=>0 is the default and means plot in km/h. # You can set this option for every WI (Windspeed) and WD (Winddirection/speed) # plot type individually. # # Attention. Either define the sensors here NOT using a config file or # comment out the demo defs below and put the real definitions into # your config file. But DONT put addSensor()-calls and the creation of # the sensDisplayData object in both the script and # your config file, since this will result in nonesense or even an error! # Values you might find useful to change are marked as USER in function # setTHdefaults(). The same is of course true for the other sensor types not # only for T/H. #$sensorData=sensDisplayData->new($imgPath, $baseImgUrl, $tmpName); # #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [17,2], # "grfxName" => "My graphics Name"}, # "lowYbounds"=>"auto", # { } ); # No virtual sensors activated # # Now we want to define a TH sensor with virtual sensors windChill and # dewPoint activated: #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [1]}, # {"windChill" =>"1", "dewPoint" =>"1" } ); # Virtual Sensors # The same like above but we only want to print the virtual sensor values # not temperature or Humidity #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [1], "omit"=>["T", "H"] }, # {"windChill" =>"1", "dewPoint" =>"1" } ); # Virtual Sensors # # Defined a TH sensor with sensid 3 but do not activate any virtual sensors # for it, so only temp and humidity will be displayed #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [3]}, { } ); #$sensorData->addSensor( {"sensType" => "PR"}, {} ); #$sensorData->addSensor( {"sensType" => "WI"}, {} ); # Plot unit is km/h #$sensorData->addSensor( {"sensType" => "WI", "windSpeedType"=>1}, {} ); # Plot unit is kts #$sensorData->addSensor( {"sensType" => "WI"}, {} ); #$sensorData->addSensor( {"sensType" => "RA"}, {} ); #$sensorData->addSensor( {"sensType" => "WD"}, {} ); #$sensorData->addSensor( {"sensType" => "WA"}, {} ); #$sensorData->addSensor( {"sensType" => "LI"}, {} ); $sensorData=sensDisplayData->new($imgPath, $baseImgUrl, $tmpName); $tmp=$sensorData->addSensor( {"sensType"=>"TH", "sensIds"=>[9], "grfxName" => "Temperatur/Feuchte Außen (in 2m Höhe)"}, {"dewPoint"=>"1"} ); $sensorData->setVirtSensAttrib($tmp, "dewPoint", "doPrintMma", 2); #$sensorData->addSensor( {"sensType" => "TH", "sensIds" => [1], "statistics"=>"0", "grfxName" => "Außentemperatur (-80cm)" }, { } ); $tmp=$sensorData->addSensor( {"sensType"=>"TH", "sensIds"=>[9], "omit"=>["H"], "mmaOmit"=>["H"], "statistics" => "0", "grfxName" => "Temp/Windchill Außen/Feuchte"}, {"windChill" =>"1", "absHumidity"=>"1", }); $sensorData->setVirtSensAttrib($tmp, "absHumidity", "doPrintMma", 2); $sensorData->setVirtSensAttrib($tmp, "windChill", "doPrintMma", 2); $tmp=$sensorData->addSensor( {"sensType"=>"TH", "sensIds"=>[2], "statistics" => "0", "grfxName" => "Temperatur/Feuchte Saustall"}, {"absHumidity"=>"1", }); $tmp=$sensorData->addSensor( {"sensType"=>"TH", "sensIds"=>[10], "statistics" => "0", "grfxName" => "Temperatur/Feuchte Innen"}, {"absHumidity"=>"1", }); $sensorData->setVirtSensAttrib($tmp, "absHumidity", "doPrintMma", 2); $sensorData->addSensor( {"sensType" => "PR", "sensIds" => [20], "lowYbounds"=>"auto", "grfxName" => "rel. Luftdruck" }, { } ); #$sensorData->addSensor( {"sensType" => "LI", "sensIds" => [50], "lowYbounds"=>"auto", "grfxName" => "Sonnenschein" }, { } ); $sensorData->addSensor( {"sensType"=>"LD", "sensIds"=>[50]}, {} ); $sensorData->addSensor( {"sensType" => "RA", "sensIds" => [40], "lowYbounds"=>"auto", "grfxName" => "Niederschläge" }, { } ); $sensorData->addSensor( {"sensType" => "WI", "sensIds" => [30], "lowYbounds"=>"auto", "grfxName" => "Windgeschwindigkeiten" }, { } ); $sensorData->addSensor( {"sensType" => "WD", "sensIds" => [30], "lowYbounds"=>"auto", "grfxName" => "Windgeschwindigkeiten / -richtungen" }, { } ); $sensorData->addSensor( {"sensType" => "WA", "sensIds" => [30], "grfxName" => "Windrichtungen / -schwankungen" }, { } ); $position="Standort: Pliening, 502m über NN.\n"; $pageTitle="Wetterdaten aus PLIENING"; $pageAuthors='krienke@uni-koblenz.de,tdressler@tdressler.net,joerg@alcatraz.shacknet.nu,philip.marien@pandora.be'; $pageDescription="linux ws500 based weather data display"; #$position="Standort: Koblenz Lay, 125m über NN.\n"; #$pageTitle="Wetterdaten aus Koblenz"; #$pageAuthors='krienke@uni-koblenz.de,tdressler@tdressler.net,joerg@alcatraz.shacknet.nu,philip.marien@pandora.be'; #$pageDescription="linux ws2500 based weather data display"; # Your contact address $contact='Kontakt: Django <A href="mailto:django@mnet-mail.de">django@mnet-mail.de</A>'; $pageMetaKeywords="wetter, Pliening"; $pageBackgroundPicture="../wetter/sky.jpg"; #$contact='Kontakt: Mr. X <A href="mailto:mrx@y.de">mrx@y.de</A>'; #$pageMetaKeywords="wetter, Koblenz"; #$pageBackgroundPicture="sky.jpg"; $pageBackgroundColor="#F0F8FF"; $pageTextColor="#000000"; $pageLinkColor="red"; $pageVisitedLinkColor="blue"; # Gnuplot background colors for graphics $bgColorNormal="xEAF0FF"; $bgColorAverage="xE3e8F8"; # DST config, values are set by checkDst() no need to change this $dstStart="2004-03-29 02:00:00"; # When dst starts $deltaIsDst=2; # Difference in h from GMT->DST time $dstEnd="2004-10-31 03:00:00"; # When DST ends $deltaNoDst=1; # Difference in h from GMT-> localtime # Some queries may be optimized by using SQL subqueries. Subqueries are # available since MYSQL Server Version 4.1. They seem to work really # efficiently starting with MYSQL 5.0 # The variable below determines if the script should use subqueries # for MMA determination. Usually this variable is set automatically # to 0 or 1 depending on the MYSQL server version. If this is > 5.0 it # is set to 1 else to 0. You can however overwrite this automatic here by # manually setting this variable to either 0 or 1. # If you want to use the automatic # setting put a comment sign (#) at the beginning of the line. # Note: You need at leaset MYSQL version 4.1 if you want to use subqueries # else you will see SQL errors. # $useSqlSubQueries=1; # *** You can copy all the variables between START CONFIG and END CONFIG # *** into a file that can be reached by your web-server unter the path # *** given below in $configpath. $configPath is set to the value of the # *** scriptname (eg wetter.cgi) with ".conf" appended. The scriptname # *** and path are retrieved from the webservers environment variable # *** named SCRIPT_FILENAME. apache on linux does provide this variable. # *** If the given file exists and is readable # *** the scripts config will be read from there overriding the variables # *** set above. So then you do not have to modify # *** further entries in the script itself e.g. for new versions. # *** Take care that your config file contains a valid perl-script if # *** unsure use perl -c wetter.cgi.conf to check the syntax, because # *** running wetter.cgi you won't see an error if your config file is # *** wrong!!!!! You will just see, that wetter.cgi is not showing any # *** output. # *** Please take care that your config file is readable only by you and your # *** web server but not to anyone else! # *** If this method fails you can still hard code a value for # *** $configPath in the last else-branch of the if staement. # R.K. # #$scriptBasename=`basename $0`; #chomp($scriptBasename); #if( defined($ENV{"SCRIPT_FILENAME"}) && -r $ENV{"SCRIPT_FILENAME"} ){ # $configPath=$ENV{"SCRIPT_FILENAME"}. ".conf"; #}elsif( defined($ENV{"SCRIPT_NAME"}) && -r $ENV{"SCRIPT_NAME"} ){ # $configPath=$ENV{"SCRIPT_NAME"} . ".conf"; #}else{ # if( -r "${scriptBasename}.conf" ){ # $configPath="${scriptBasename}.conf" # }elsif(-r "/etc/ws2500/wetter.cgi.conf" ){ # $configPath="/etc/ws2500/wetter.cgi.conf"; # }else{ # $configPath="/home/krienke/wetter/wetter.cgi.conf" # } #} $scriptBasename=`basename $0`; chomp($scriptBasename); if( defined($ENV{"SCRIPT_FILENAME"}) && -r $ENV{"SCRIPT_FILENAME"} ){ $configPath=$ENV{"SCRIPT_FILENAME"}. ".conf"; }elsif( defined($ENV{"SCRIPT_NAME"}) && -r $ENV{"SCRIPT_NAME"} ){ $configPath=$ENV{"SCRIPT_NAME"} . ".conf"; }else{ if( -r "${scriptBasename}.conf" ){ $configPath="${scriptBasename}.conf" }elsif(-r "/etc/ws2500/wetter.cgi.conf" ){ $configPath="/etc/ws2500/wetter.cgi.conf"; }else{ $configPath="/home/krienke/wetter/wetter.cgi.conf" } } # # -------- END CONFIG VARIABLES ---------------------------------------------