jeudi 5 septembre 2013

Installation & Configuration de WVIEW - Votre Station Météo connectée via le Raspberry PI

Installation & Configuration de Wview 

sur un Raspberry PI

Temps d'installation entre 50 et 90 minutes.


ETAPE 0 - download Raspbian (armhf)
Downloader ce torrent ou utilisez le lien direct suivant download et placé le sur une SDCARD d'au minimum 2 Go


ETAPE 1 - Placer les repositories

$ sudo nano /etc/apt/sources.list ou $ sudo vi /etc/apt/sources.list
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi


$ sudo apt-get update


ETAPE 2 - installation

Maintenant, vous pouvez soit utiliser un script d'installation ou faire une installation "manuelle"



Méthode avec le script d'installation ( méthode recommandée )
$ wget http://goo.gl/yiaz0 -O wview-install-raspbian.sh
$ chmod +x wview-install-raspbian.sh ; ./wview-install-raspbian.sh


Méthode "manuelle"
$ sudo apt-get install --yes build-essential zlib1g-dev libpng12-dev libreadline-dev gawk libsqlite3-dev sqlite3 libgd2-xpm libgd2-xpm-dev libssl-dev sendmail sendemail libcurl4-openssl-dev libusb-1.0-0 libusb-1.0-0-dev apache2 php5 php5-sqlite libapache2-mod-php5 ntp tnftp wget
$ wget http://downloads.sourceforge.net/radlib/radlib-2.12.0.tar.gz
$ tar zxvf radlib-2.12.0.tar.gz
$ cd radlib-2.12.0
$ ./configure --enable-sqlite --prefix=/ --bindir=/usr/bin --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib
$ sudo make install
$ cd ..


$ wget http://downloads.sourceforge.net/wview/wview-5.20.2.tar.gz
$ tar zxvf wview-5.20.2.tar.gz
$ cd wview-5.20.2
$ ./configure --prefix=/ --bindir=/usr/bin --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib
$ sudo make install
$ cd ..


$ sudo wget http://goo.gl/H13iS -O /etc/init.d/wview
$ sudo chmod +x /etc/init.d/wview
$ sudo update-rc.d wview defaults 99
$ sudo ln -s /var/lib/wview/img/ /var/www/weather
$ sudo ln -s /var/lib/wviewmgmt/ /var/www/wviewmgmt



Si tout c'est bien passé, il faut maintenant configurer votre station météo
$ wviewconfig  ou http://your_raspi_ip/wviewmgmt (via votre navigateur préféré)



Vérification de votre configuration
$ wviewhtmlconfig


ATTENTION !! Avant de démarrer votre site WEB
$ sudo /etc/init.d/wview stop ; sudo rm /var/lib/wview/*.pid
$ sudo wviewcleardata



ETAPE 3 - un petit nettoyage

Effacement des fichiers inutiles
$ sudo rm -r radlib* ; sudo rm -r wview*
$ sudo apt-get clean




Etape 4 - Quelques réglages nécessaires :

Si vous désirez avoir le contrôle de wview pour effectuer un "Start/Stop" à partir de l'interface Web de Contrôle, (et que vous autorisez l'utilisateur du serveur web d'avoir les privilèges sudo), ajoutez l'utilisateur http au groupe sudo.

Ajouter l'utilisateur http au groupe sudo
$ sudo adduser www-data sudo
Modifier /etc/sudoers pour autoriser le contrôle "START/STOP"
$ sudo visudo ( Ajouter les lignes suivantes à la fin du fichier)
Cmnd_Alias WVIEW = /etc/init.d/wview
www-data ALL= NOPASSWD: WVIEW



ETAPE 5 - Configuration de wview 

PREREQUIS : 
  1. Avoir les coordonnées Longitude/Latitude de la station météo
  2. Avoir l'altitude en pieds ( via par exemple le site http://www.le-convertisseur.com/convertisseur-distances.html)
  3. Connaître le type de station Météo et comment elle se connecte (USB, RESEAU,  ...)
  4. Générer un password MD5 ( via par exemple le site http://www.cryptage-md5.com/)
  5. PRENDRE ATTENTION AUX PARAMETRES CI-DESSOUS EN ROUGE
  6. LES PARAMETRES EN BLEU SONT DONNES A TITRE D'EXEMPLE 
  7. LES PARAMETRES EN VERT SONT A RETENIR (DESTINATION DES FICHIERS) 

wviewconfig
root@raspberrypi:~# wviewconfig
################################################################################
 !!!!!!!!!!!!!!!!         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, WMRUSB, WH1080, TE923:
PARAMETER: STATION_TYPE
(WMRUSB):
-------------------------------------------------------------
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
(22222):
-------------------------------------------------------------
Enable WeatherlinkIP interface:
PARAMETER: STATION_WLIP
(no):
-------------------------------------------------------------
Retrieve archive records from console (if no, they will be autogenerated):
PARAMETER: STATION_RETRIEVE_ARCHIVE
(yes):
-------------------------------------------------------------
Toggle DTR line during serial initialization:
PARAMETER: STATION_DTR
(yes):
-------------------------------------------------------------
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): 524.96
-------------------------------------------------------------
Weather station latitude (decimal degrees, NORTH is positive - SOUTH is negative):
PARAMETER: STATION_LATITUDE
(33.6): 50.5
-------------------------------------------------------------
Weather station longitude (decimal degrees, EAST is positive - WEST is negative):
PARAMETER: STATION_LONGITUDE
(-96.9): 4.1
-------------------------------------------------------------
Weather data archive interval (minutes, one of 5, 10, 15, 30):
PARAMETER: STATION_ARCHIVE_INTERVAL
(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): BEL_LEROEULX
-------------------------------------------------------------
Station City:
PARAMETER: HTMLGEN_STATION_CITY
(changeme): LE ROEULX
-------------------------------------------------------------
Station State:
PARAMETER: HTMLGEN_STATION_STATE
(changeme): BELGIUM
-------------------------------------------------------------
Show interface details:
PARAMETER: HTMLGEN_STATION_SHOW_IF
(yes):
-------------------------------------------------------------
Where to store generated html and graphics files:
PARAMETER: HTMLGEN_IMAGE_PATH
(/usr/local/var/wview/img):
-------------------------------------------------------------
Where to find HTML template files:
PARAMETER: HTMLGEN_HTML_PATH
(/usr/local/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):
-------------------------------------------------------------
Default Wind Units:
PARAMETER: HTMLGEN_WIND_UNITS
(mph): kph
-------------------------------------------------------------
Display both metric and non-metric units on images?
PARAMETER: HTMLGEN_DUAL_UNITS
(yes):
-------------------------------------------------------------
Store/process extended sensor values?
PARAMETER: HTMLGEN_EXTENDED_DATA
(no):
-------------------------------------------------------------
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): Croissante
-------------------------------------------------------------
Moon 'decreasing' text:
PARAMETER: HTMLGEN_MPHASE_DECREASE
(Waning): Decroissante
-------------------------------------------------------------
Moon 'full' text:
PARAMETER: HTMLGEN_MPHASE_FULL
(Full): Pleine
-------------------------------------------------------------
Local Radar Image URL (no spaces):
PARAMETER: HTMLGEN_LOCAL_RADAR_URL
(http://www.srh.noaa.gov/radar/images/DS.p19r0/SI.kfws/latest.gif): http://www.buienradar.be/image/
-------------------------------------------------------------
Local Forecast URL (no spaces):
PARAMETER: HTMLGEN_LOCAL_FORECAST_URL
(http://www.wunderground.com/cgi-bin/findweather/getForecast?query=76233): http://belgique.lachainemeteo.com/meteo-belgique/ville/previsions-meteo-le-roeulx-88566-0.php
-------------------------------------------------------------
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):
-------------------------------------------------------------
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): admin@leroeulxmeteo.no-ip.org
-------------------------------------------------------------
From address for email alerts:
PARAMETER: FROM_EMAIL_ADDRESS
(from_address@other_server.com): admin@leroeulxmeteo.no-ip.org
-------------------------------------------------------------
Send system alert emails?
PARAMETER: ENABLE_EMAIL_ALERTS
(no):
-------------------------------------------------------------
Send a test email?
PARAMETER: SEND_TEST_EMAIL
(no):
-------------------------------------------------------------
Admin Password (md5):
PARAMETER: ADMIN_PASSWORD
(71d6e40c9cdxxxxxxxxx9c214598f6): 71d6e40c9cd
xxxxxxxxx9c214598f6
################################################################################
--> wview Configuration Complete!
--> Now run wviewhtmlconfig to select your site skin.
################################################################################
root@raspberrypi:~#

ETAPE 6 : Configuration du style du site

wviewhtmlconfig
root@raspberrypi:~# 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
    exfoliation - a clean implementation by Matthew Wall
(chrome):
Site skin chrome selected...
With NO extended data graphics.
With metric units.
Saving old HTML directory to html-20130904.220235 ...
...done.
Saving old config files...
... done.
cp: target `/usr/local/var/wview/img' is not a directory
HTML setup complete:
you may now customize template files in /etc/wview/html

ETAPE 7 - Les fichiers "template .htx" pour avoir votre site complètement en Français:
  ( fichier se trouvant sur une connection personnelle, et sur mon instance wview soyez donc patient )
 $ sudo wget http://leroeulxmeteo.no-ip.org/download/htx_FRENCH.tar.gz

$ tar -xzv htx_FRENCH.tar.gz  -C /etc/wview/html

 



ETAPE X - Mise à jour:


sudo apt-get update && sudo apt-get install raspi-config libraspberrypi*









EXEMPLE EN FRANCAIS :

http://leroeulxmeteo.no-ip.org

Source & Traduction de : https://docs.google.com/document/d/1HRJyqlyyQM84JW2t04f3XcNQT-P3KT53uo5pVQuwhVo/edit
Si vous désirez utiliser l'icone changée Raspi WVIEW :
$ sudo wget https://dl.dropbox.com/u/2427470/raspberry/wview/wview-100x100.png -O /var/lib/wviewmgmt/wview-100x100.png