Wetterserver

Der Wetterserver hat seit 2012 einen eigenen Bereich im Wiki. Hier liegt nur die techschnische Dokumentation.

Zur Dokumentation rund um den Wetterserver in Bereich der AGs.

Reset

Ausgeführt
20.04.2010 - spahlimi
21.01.2011 - welle

nach http://www.wviewweather.com/release-notes/wview-User-Manual.html

Installation von weewx (Stand 2016)

Installation: 26.12.2016 um 15:00 Uhr

DEB Paket von http://www.weewx.com/ herunterladen und per dpkg -i installieren. Ein apt-get install -f löst die Abhängigkeiten auf. Anzugeben sind die Geokoordinaten und die Höhe der Station, die allerdings bei unserer Hardware von der von Spahlimi 2010 vorgenommenen Einstellung (416m statt eigentlich passendere 430m) überschrieben werden. Die wview Datenbank wird in /var/lib/weewx/weewx.db abgelegt. Da wview und weewx das gleiche Datenbankformat nutzen setzt weewx die Arbeit an und in dieser schlicht fort.

Installation von WView (Stand 2011)

1.) Hinzufügen von

deb http://www.wviewweather.com/apt/lenny lenny main
deb-src http://www.wviewweather.com/apt/lenny lenny main

in die /etc/apt/sources.list bei Debian. Für Ubuntuserver sieht dies so aus:

deb http://www.wviewweather.com/apt/lucid lucid main
deb-src http://www.wviewweather.com/apt/lucid lucid main

2.) Updaten:

sudo apt-get update

3.) Installieren von WView:

sudo apt-get install wview

dabei werden installiert: apache2 apache2-mpm-prefork apache2-utils apache2.2-common binutils ca-certificates cpp cpp-4.3 gawk gcc gcc-4.3 libapache2-mod-php5 libapr1 libaprutil1 libc6-dev libcurl3 libexpat1 libfreetype6 libgd2-noxpm libgmp3c2 libgomp1 libjpeg62 libmpfr1ldbl libmysqlclient15off libpng12-0 libpq5 librad0 libsqlite0 libsqlite3-dev libssh2-1 linux-libc-dev mysql-common openssl openssl-blacklist php5-common php5-sqlite adlib-dev rsync sqlite3 ssl-cert wview

WARNUNG: Die folgenden Pakete können nicht authentifiziert werden! librad0 radlib-dev wview

Wird erstmal mit „trozdem installieren“ beruhigt.

Grundkonfiguration von WView

Ausgeführt: 20.04.2010 - Spahlimi

vorher WView stoppen:

sudo /etc/init.d/wview stop

Konfiguration starten:

#> sudo wviewconfig

dabei werden die Fragen folgendermaßen beantwortet:

################################################################################
!!!!!!!!!!!!!!!! READ THIS BEFORE PROCEEDING !!!!!!!!!!!!!!!!
--> System Configuration for wview
--> Values in parenthesis are your existing values (if they exist) or defaults -
they will be used if you just hit enter at the prompt...
--> Note: This script will save the existing wview-conf.sdb file to
/etc/wview/wview-conf.old before writing the new file
based on your answers here - if that is not what you want, hit CTRL-C now to
abort this script!
################################################################################
pausing 3 seconds ...
-------------------------------------------------------------
Run template generator to generate web/other files from templates?
PARAMETER: ENABLE_HTMLGEN
(yes): -------------------------------------------------------------
Run Alarm daemon to provide alarm script/client support?
PARAMETER: ENABLE_ALARMS
(no): -------------------------------------------------------------
Run CWOP daemon to report station data to CWOP?
PARAMETER: ENABLE_CWOP
(no):
-------------------------------------------------------------
Run HTTP daemon to report station data to Weather Underground/Weather For You?
PARAMETER: ENABLE_HTTP
(no):
-------------------------------------------------------------
Run FTP daemon to transfer web site/generated files to a remote server?
PARAMETER: ENABLE_FTP
(no):
-------------------------------------------------------------
Run SSH daemon to transfer web site/generated files to a remote server?
PARAMETER: ENABLE_SSH
(no):
-------------------------------------------------------------
Run process monitor daemon to restart failed/hung daemons?
PARAMETER: ENABLE_PROCMON
(yes):
-------------------------------------------------------------
Station type - one of Simulator, Virtual, VantagePro, WXT510, TWI, WS-2300, WMR918:
PARAMETER: STATION_TYPE
(Simulator): VantagePro
-------------------------------------------------------------
Physical interface to the weather station - one of serial or ethernet (usb is considered serial):
PARAMETER: STATION_INTERFACE
(serial):
-------------------------------------------------------------
Weather station serial device (/dev/ttyS0, /dev/ttyUSB0, etc.):
PARAMETER: STATION_DEV
(/dev/ttyUSB0):
-------------------------------------------------------------
Hostname or IP address (ethernet only):
PARAMETER: STATION_HOST
(10.10.10.10):
-------------------------------------------------------------
Host TCP port to the weather station (ethernet only):
PARAMETER: STATION_PORT
(2102):
-------------------------------------------------------------
Station rain season start month (1 - 12):
PARAMETER: STATION_RAIN_SEASON_START
(1):
-------------------------------------------------------------
Station rain storm start trigger (rainfall rate in inches/hour):
PARAMETER: STATION_RAIN_STORM_TRIGGER_START
(0.05):
-------------------------------------------------------------
Station rain storm stop time (hours without any rainfall which will end the storm):
PARAMETER: STATION_RAIN_STORM_IDLE_STOP
(12):
-------------------------------------------------------------
Station rain Year-To-Date preset (to include rain not in archive records) (x.yy inches):
PARAMETER: STATION_RAIN_YTD
(0):
-------------------------------------------------------------
Station ET Year-To-Date preset (to include ET not in archive records) (x.yyy inches, 0 disables):
PARAMETER: STATION_ET_YTD
(0):
-------------------------------------------------------------
Station rain/ET preset year (rain season start year that presets should apply to) (2000-present year, 0 disables):
PARAMETER: STATION_RAIN_ET_YTD_YEAR
(0):
-------------------------------------------------------------
Weather station elevation (feet above sea level):
PARAMETER: STATION_ELEVATION
(751): 1354
-------------------------------------------------------------
Weather station latitude (decimal degrees, NORTH is positive - SOUTH is negative):
PARAMETER: STATION_LATITUDE
(33.6): 48.446418
-------------------------------------------------------------
Weather station longitude (decimal degrees, EAST is positive - WEST is negative):
PARAMETER: STATION_LONGITUDE
(-96.9): 9.075812
-------------------------------------------------------------
Weather data archive interval (minutes, one of 5, 10, 15, 30):
PARAMETER: STATION_ARCHIVE_INTERVAL
(5): 5
-------------------------------------------------------------
Weather station sensor poll interval (seconds) - should be divisor of 60:
PARAMETER: STATION_POLL_INTERVAL
(30):
-------------------------------------------------------------
Current conditions data push interval (seconds) - for wvalarmd and possibly others:
PARAMETER: STATION_PUSH_INTERVAL
(60):
-------------------------------------------------------------
Daemon Verbose Log Mask: 00000001 - wviewd,00000010 - htmlgend,00000100 - wvalarmd,00001000 - wviewftpd,00010000 - wviewsshd,00100000 - wvcwopd,01000000 - wvhttpd:
PARAMETER: STATION_VERBOSE_MSGS
(00000011):
-------------------------------------------------------------
Generate RX check data (populate rxCheck.png chart, VP only)?
PARAMETER: STATION_DO_RCHECK
(no):
-------------------------------------------------------------
Station Name:
PARAMETER: HTMLGEN_STATION_NAME
(changeme): wetterkvfg
-------------------------------------------------------------
Station City:
PARAMETER: HTMLGEN_STATION_CITY
(changeme): Dusslingen
-------------------------------------------------------------
Station State:
PARAMETER: HTMLGEN_STATION_STATE
(changeme): Deutschland
-------------------------------------------------------------
Where to store generated html and graphics files:
PARAMETER: HTMLGEN_IMAGE_PATH
(/var/lib/wview/img):
-------------------------------------------------------------
Where to find HTML template files:
PARAMETER: HTMLGEN_HTML_PATH
(/etc/wview/html):
-------------------------------------------------------------
Generation start offset (0-4) in minutes:
PARAMETER: HTMLGEN_START_OFFSET
(0):
-------------------------------------------------------------
How often to generate (refresh interval for your site data) in minutes:
PARAMETER: HTMLGEN_GENERATE_INTERVAL
(1):
-------------------------------------------------------------
Enable metric conversion/units?
PARAMETER: HTMLGEN_METRIC_UNITS
(no): yes
-------------------------------------------------------------
If metric, use mm for rain instead of cm?
PARAMETER: HTMLGEN_METRIC_USE_RAIN_MM
(yes): yes
-------------------------------------------------------------
Display both metric and non-metric units on images?
PARAMETER: HTMLGEN_DUAL_UNITS
(yes): no
-------------------------------------------------------------
Store/process extended sensor values?
PARAMETER: HTMLGEN_EXTENDED_DATA
(no): yes
-------------------------------------------------------------
How many daily archive record browser files to keep (-1 disables archive files, 0 indicates keep all, otherwise days to keep):
PARAMETER: HTMLGEN_ARCHIVE_BROWSER_FILES_TO_KEEP
(-1):
-------------------------------------------------------------
Moon 'increasing' text:
PARAMETER: HTMLGEN_MPHASE_INCREASE
(Waxing): Zunehmend
-------------------------------------------------------------
Moon 'decreasing' text:
PARAMETER: HTMLGEN_MPHASE_DECREASE
(Waning): Abnehmend
-------------------------------------------------------------
Moon 'full' text:
PARAMETER: HTMLGEN_MPHASE_FULL
(Full): Vollmond
-------------------------------------------------------------
Local Radar Image URL (no spaces):
PARAMETER: HTMLGEN_LOCAL_RADAR_URL
(http://www.srh.noaa.gov/radar/images/DS.p19r0/SI.kfws/latest.gif):
-------------------------------------------------------------
Local Forecast URL (no spaces):
PARAMETER: HTMLGEN_LOCAL_FORECAST_URL
(http://www.wunderground.com/cgi-bin/findweather/getForecast?query=76233):
-------------------------------------------------------------
Date Format - see 'man strftime' for allowable formats; %D - US format mm/dd/yy, %d/%m/%Y - dd/mm/yyyy, %x - locale's preferred date representation:
PARAMETER: HTMLGEN_DATE_FORMAT
(%x): %d/%m/%Y
-------------------------------------------------------------
Barometer calibration multiplier:
PARAMETER: CAL_MULT_BAROMETER
(1.0):
-------------------------------------------------------------
Barometer calibration constant:
PARAMETER: CAL_CONST_BAROMETER
(0.0):
-------------------------------------------------------------
Station Pressure calibration multiplier:
PARAMETER: CAL_MULT_PRESSURE
(1.0):
-------------------------------------------------------------
Station Pressure calibration constant:
PARAMETER: CAL_CONST_PRESSURE
(0.0):
-------------------------------------------------------------
Altimeter calibration multiplier:
PARAMETER: CAL_MULT_ALTIMETER
(1.0):
-------------------------------------------------------------
Altimeter calibration constant:
PARAMETER: CAL_CONST_ALTIMETER
(0.0):
-------------------------------------------------------------
Inside Temp calibration multiplier:
PARAMETER: CAL_MULT_INTEMP
(1.0):
-------------------------------------------------------------
Inside Temp calibration constant:
PARAMETER: CAL_CONST_INTEMP
(0.0):
-------------------------------------------------------------
Outside Temp calibration multiplier:
PARAMETER: CAL_MULT_OUTTEMP
(1.0):
-------------------------------------------------------------
Outside Temp calibration constant:
PARAMETER: CAL_CONST_OUTTEMP
(0.0):
-------------------------------------------------------------
Inside Humidity calibration multiplier:
PARAMETER: CAL_MULT_INHUMIDITY
(1.0):
-------------------------------------------------------------
Inside Humidity calibration constant:
PARAMETER: CAL_CONST_INHUMIDITY
(0.0):
-------------------------------------------------------------
Outside Humidity calibration multiplier:
PARAMETER: CAL_MULT_OUTHUMIDITY
(1.0):
-------------------------------------------------------------
Outside Humidity calibration constant:
PARAMETER: CAL_CONST_OUTHUMIDITY
(0.0):
-------------------------------------------------------------
Wind Speed calibration multiplier:
PARAMETER: CAL_MULT_WINDSPEED
(1.0):
-------------------------------------------------------------
Wind Speed calibration constant:
PARAMETER: CAL_CONST_WINDSPEED
(0.0):
-------------------------------------------------------------
Wind Direction calibration multiplier:
PARAMETER: CAL_MULT_WINDDIR
(1.0):
-------------------------------------------------------------
Wind Direction calibration constant:
PARAMETER: CAL_CONST_WINDDIR
(0.0):
-------------------------------------------------------------
Rain calibration multiplier:
PARAMETER: CAL_MULT_RAIN
(1.0):
-------------------------------------------------------------
Rain calibration constant:
PARAMETER: CAL_CONST_RAIN
(0.0):
-------------------------------------------------------------
Rain Rate calibration multiplier:
PARAMETER: CAL_MULT_RAINRATE
(1.0):
-------------------------------------------------------------
Rain Rate calibration constant:
PARAMETER: CAL_CONST_RAINRATE
(0.0):
-------------------------------------------------------------
Seconds to wait before restarting a non-responsive process (0 disables):
PARAMETER: PROCMON_wviewd
(0):
-------------------------------------------------------------
Seconds to wait before restarting a non-responsive process (0 disables):
PARAMETER: PROCMON_htmlgend
(0):
-------------------------------------------------------------
Seconds to wait before restarting a non-responsive process (0 disables):
PARAMETER: PROCMON_wvalarmd
(120):
-------------------------------------------------------------
Seconds to wait before restarting a non-responsive process (0 disables):
PARAMETER: PROCMON_wvcwopd
(120):
-------------------------------------------------------------
Seconds to wait before restarting a non-responsive process (0 disables):
PARAMETER: PROCMON_wvhttpd
(120):
-------------------------------------------------------------
Destination address for email alerts:
PARAMETER: EMAIL_ADDRESS
(address@server.com): -irgendeine-
-------------------------------------------------------------
From address for email alerts:
PARAMETER: FROM_EMAIL_ADDRESS
(from_address@other_server.com):
-------------------------------------------------------------
Send system alert emails?
PARAMETER: ENABLE_EMAIL_ALERTS
(no):
-------------------------------------------------------------
Send a test email?
PARAMETER: SEND_TEST_EMAIL
(no): yes
-------------------------------------------------------------
Admin Password (md5):
PARAMETER: ADMIN_PASSWORD
(blablabla):
################################################################################
--> wview Configuration Complete!
--> Now run wviewhtmlconfig to select your site skin.
################################################################################

Für das Auslesen der md5 Summe des Adminpasswords muss echo -n "geheim" | md5sum verwendet werden statt nur echo!

Das kann man aber nachher noch alles ändern.

:~$ sudo wviewhtmlconfig
################################################################################
!!!!!!!!!!!!!!!! READ THIS BEFORE PROCEEDING !!!!!!!!!!!!!!!!
--> HTML Template Configuration for wview
--> Note: This script will save existing templates to /etc/wview/html-YYYYMMDD.HHmmSS
before writing the new files based on your answers here - if that
is not what you want, hit CTRL-C now to abort this script!
################################################################################
pausing 5 seconds .....
---------------------------------------------------------------------------
Which template skin do you want to use for your site?
wview site skins currently supported:
classic - default wview skin
chrome - classic with a chrome effect
(chrome): classic
Site skin classic selected...
With extended data graphics.
With metric units.
Saving old HTML directory to html-20100420.185037 ...
...done.
Saving old config files...
... done.
HTML setup complete:
you may now customize template files in /etc/wview/html

Ich hab mal das Klassische Design ausgewählt, kann man auch ändern.

Jetzt starten wir mal WView um zu schauen, wo es noch hakt:

:~$ sudo /etc/init.d/wview start
Starting wview daemons.

und das hier aufrufen: http://www.kvfg.info/weather/

Unter Debian war es das, weil die Links aus /var/www nun richtig gesetzt wurden. Unter Ubuntu Server 10.04 LTS liegen aber die Daten wie auch die Webdateien von wview an einem anderen Ort, was im Installationsskript von wview so nicht berücksichtigt ist. Hier müssen demnach noch ein paar Anpassungen folgen:

Der Link zu den Webdaten:

ln -s /var/lib/wview/img /var/www/wetter

Ein Link zum Adminpanel:

ln -s /var/lib/wviewmgmt/ /var/www/wieauchimmer

Sicherheit

Einige Dateien von WView sind standardmäßig für die ganze Welt schreibbar !!! Das muss natürlich sofort geändert werden:

sudo chmod -R o-w weather/
sudo chmod -R o-w wviewmgmt/

Das ging vorerst ganz gut, bis dann jemand versucht hat, eine Einstellung über das „Backend“ zu ändern. Der Versuch war zum scheitern verurteilt, da man ja keine Schreibrechte auf die Konfigurationsdateien hatte. Deshalb gehören die Konfigurationsdateien nun dem User www-data und der Gruppe www-data. Nun können wieder Einstellungen im Backend verändert werden, ohne das sich der komplette WView-Dienst abschießt. Der dazzugehörige Befehl sollte bekannt sein

HTX Dateianpassungen

In den Dateien

/etc/wview/html/index-day.htx
/etc/wview/html/index-night.htx

verändern und dann

kill -s HUP $(cat /var/lib/wview/htmlgend.pid)

für ein Neueinlesen der Templates.

<sxh> <tr>

<td width="100%" align="center" valign="middle">
<font face="Tw Cen MT" color="#000000">
Browse Archive Records:&nbsp;
</font>
<script language="JavaScript">
createDaySelect("day");
createMonthlySelect("month1");
createYearlySelect("year1");
</script>
<input type="button" value="Browse Day Records"
onclick="openARCFile(this.form.day.value, this.form.month1.value, this.form.year1.value)">
</td>
</tr>
<tr>
<td width="100%" align="center" valign="middle">
<font face="Tw Cen MT" color="#000000">
Documentation in KvFG Wiki:&nbsp;
</font>
<input type="button" value="Jump to Documentation"
onclick="window.open('https://www.kvfg.net/wiki/doku.php?id=ag:wetterserver:start')">
</td>
</tr>

</sxh>

RSS Feed Anpassungen

Dieser kann in seiner Gestalt angepasst werden. Hierzu muss die Datei

/etc/wview/html/wxrss.xtx

nach Wunsch verändert werden. Damit unsere anderen Webseiten aber mehr als nur die item Beschreibung im Feed anzeigen, nämlich auch die Wetterinformationen selbst, habe ich diese Datei wie folgt verändert:

<channel>
<title><!--stationCity--> <!--stationState--></title>
<link>http://www.kvfg.info/wetter</link>
<description>KvFG Wetterfeed. Ein Service der ComputerAG. Delivered by Karl.</description>
<language>en-us</language>
<pubDate><!--stationDate--> <!--stationTime--></pubDate>
<ttl>1</ttl>
<generator><!--wviewVersion--></generator>
<item>
<title><!--stationCity-->,<!--stationState--> Weather Conditions: <!--stationDate--> <!--stationTime--></title>
<link>http://www.kvfg.info/wetter/Current_Plus.htm</link>
<description>
<![CDATA[
<p>
Temp: <!--outsideTemp--><!--tempUnit--><br>
Wind Chill: <!--windChill--><!--tempUnit--><br>
Heat Index: <!--outsideHeatIndex--><!--tempUnit--><br>
Humidity: <!--outsideHumidity--><!--humUnit--><br>
Dewpoint: <!--outsideDewPt--><!--tempUnit--><br>
Barometer: <!--barometer--><!--barUnit--><br>
Wind: <!--windDirection--> at <!--windSpeed--><!--windUnit--><br>
Rain Today: <!--dailyRain--><!--rainUnit--><br>
Rain Rate: <!--rainRate--><!--rainUnit--><br>
</p>
]]>
</description>
</item>
</channel>

So ganz perfekt ist das nicht, weil Wview leider keine Standard-konforme Zeitangabe im Feed produziert (siehe hierzu den Check des Feeds beim W3C Validator) - aber es funktioniert mit den von mir getesteten Readern Sage, Moodle und Dokuwiki.