User Tools

Site Tools


doc:howto:wview

wview HowTo

wview is a collection of unix daemons which interface with a supported weather station to retrieve archive records (if generated by the station) and current conditions. More info on www.wviewweather.com

If the station does not generate archive records internally, wview will auto-generate archive records based on the sensor readings collected for that interval. The archive records and High/Low (HILOW) data are stored in SQLite3 databases. At a configurable interval, wview will utilize the archive history and current conditions to generate weather images (buckets, dials and graphs) and HTML web pages based on user-configurable HTML templates.

So you can have a perfect weather information page on your router :-)

Preparation

Prerequisites

As an example I use a TP-Link TL-WDR4300 and a TFA Nexus weather station which is a derivate of Hideki. (AKA Hideki, Nexus, Mebus, Irox, Honeywell, Cresta TE923, TE923W, TE821W, WXR810, DV928). More stations on www.wviewweather.com

I took the TL-WDR4300 because of RAM, FLASH and 2 USB Ports. One for storage (I used USB Stick with 1 GB, but less is also good) and second port for the Nexus. If your router has only one USB port you can use a HUB… :-)

I used OpenWRT version ATTITUDE ADJUSTMENT (12.09, r36088)

You have to follow/need to know this upfront:

  1. follow usb.essentials for a basic USB support (Do not explain this again! Link to it, and you're done)
  2. follow usb.storage for USB storage support
  3. follow Mounting.Filesystems to mount any filesystem.

And you should know how to login via ssh to your OpenWRT…

But now an overview of all packages and basic installation.

Required Packages

Server (OpenWRT)

  • wview Package which installs some programs, daemons and sample config files

Please install also the following packages, because wview depends on it. Maybe some are already installed.

  • zlib - compression library
  • libpng - png image library
  • libreadline - command line functions
  • gawk - GNU awk
  • libgd - graphics drawing library
  • libsqlite3 - SQLite3 database library
  • radlib - rapid application development library - must be installed with SQLite support (–enable-sqlite)
  • libcurl - "C" URL HTTP library - optional, required for Weather Underground

Of course we need a kernel module for communication with the weather station. To check which driver you have to install you need to know the Vendor and ProdID.

Helpful is this package

  • usbutils - USB devices listing utilities

You can now check the Vendor and ProdID with

# lsusb 

You will get something like this:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 003: ID 1130:6801 Tenx Technology, Inc.
Bus 001 Device 004: ID 4146:ba01 USBest Technology Intuix Flash Drive

The Nexus has the ID 1130:6801.

To check which driver you need you can take a look into

# cat /proc/bus/usb/devices

You will get something like this:

...
T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=1.5  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=1130 ProdID=6801 Rev= 3.02
S:  Product= 
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=10ms
...

As you can see in line I: we need a HID driver for the Nexus.

  • kmod-usb-hid - Kernel support for USB HID devices such as keyboards and mice

If you have not a Nexus weather station you may need a different driver, but I assume that many will work with HID. (Please confirm your station here…)

I installed also some kernel modules for NLS (Native Language Support). Maybe not necessary.

  • kmod-nls-cp437
  • kmod-nls-iso8859-1
  • kmod-nls-utf8

wview Source tarball

You will need also some files from the latest wview Weather System package from Sourceforge because not all needed files are included in the OpenWRT wview package.

Please unpack the tarball Sourceforge and search for he following directory:

wview.x.x.x./examples/html/*.*

You have to copy this directory later to your USB-stick.

Installation

Packages installation

opkg

# opkg install wview zlib libpng libreadline gawk libgd libsqlite3 radlib libcurl

Additional tool

# opkg install usbutils

And now the driver for the weather station.

# opkg install kmod-usb-hid kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8

USB-Stick files

You can prepare the external memory upfront with your PC… it saves some time. I used a Linux system and a USB stick with ext4 filesystem… but vfat will also work.

This is the structure of the directories on the USB Stick that you have to generate:

wview-data/measurements-archive
wview-html
wview-img

Because the wview package is lacking some files you have to copy the html files of the source tarball wview.x.x.x./examples/html/*.* to wview-html on the USB stick.

The USB stick is now ready.

Configuration

Now, please mount the prepared USB Stick on /mnt/extusb/ If you do not have the dir extusb, just make it…

If you don't know how to mount the stick, just check Mounting.Filesystems to mount any filesystem.

Server configuration

If you have installed all packages above, prepared and mounted the USB stick… you are ready to config.

First you have to create the databases for archive and config.

# cd /mnt/extusb/wview-data/measurements-archive/
# sqlite3 wview-archive.sdb '.read /etc/wview/wview-archive.sql'

# cd /etc/wview/
# sqlite3 wview-conf.sdb '.read /etc/wview/wview-conf.sql'

Second you have to start wview config program with:

# wviewconfig
Now answer all questions … :-)

No, not really… for a first test you can leave all parameters default except the following:

Important questions and answers for Nexus are

  • Station type - one of Simulator, Virtual, VantagePro, WXT510, TWI, WS-2300, WMR918, WMRUSB, WH1080, TE923: TE923
  • Physical interface to the weather station - one of serial or ethernet (usb is considered serial): serial
  • Weather station serial device (/dev/ttyS0, /dev/ttyUSB0, etc.): /dev/usb/hiddev0

You will find the interface for your weather station in /dev. The best is you check /dev before you connect your weather station and directly after. A /dev/new file or maybe /dev/dir/new file show you the name of the device.

Important directories are

  • Where to store generated html and graphics files: /mnt/extusb/wview-img
  • Where to find HTML template files: /etc/wview/html

Third: We need one additional link for the generated html files.

# ln -snf /mnt/extusb/wview-img /www/weather

Fourth: Last config to do is to choose a html template. I prefer classic :-)

# wviewhtmlconfig

If everything worked fine you will get something like this

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-20131012.232546 ...
...done.
Saving old config files...
... done.
HTML setup complete:
you may now customize template files in /etc/wview/html

If it is not looking like this and if you got some error messages… please check this Howto and proof that you have mounted the USB stick, have all directories, made all steps and if this not helps read and amend /etc/init.d/wview appropriately for your particular setup! Here you have to check especially the directories and devices.

OK, I hope everything is fine and you have no errors…

Start & Stop

Now we are ready to start…

/etc/init.d/wview start to start all daemons

Check system log for messages.

If everything is fine you can reach your weather page with

http://your-openwrt-ip/weather

To stop, just type

/etc/init.d/wview stop to stop all daemons

Start on boot

To enable/disable start on boot:
/etc/init.d/wview enable this simply creates a symlink: /etc/rc.d/S99wview → ../init.d/wview
/etc/init.d/wview disable this removes the symlink again

Troubleshooting

If you find some errors in this Howto or have additional info… just edit this Howto. Thank you.

Notes

Have fun! Maik

doc/howto/wview.txt · Last modified: 2013/10/13 00:03 by maikst