User Tools

Site Tools


projects:weewx:restore

Build new Berry02 server. When nginx, php, mysql and phpmyadmin are in place create a new “weewx” database with a privliged user with the same name and password as in the /etc/weewx/weewx.conf.

$ sudo usermod -G www-data pi
$ sudo cat /etc/group |grep pi
$ sudo usermod -G adm pi

Make sure you install all dependency, beyond those that will get install with weewx:.

sudo apt-get install python-configobj
sudo apt-get install python-cheetah
sudo apt-get install python-imaging
        

# required if hardware is serial or USB:

sudo apt-get install python-serial
sudo apt-get install python-usb

# required if using MySQL:

sudo apt-get install mysql-client
sudo apt-get install python-mysqldb

# required if using FTP on Raspbian systems:

sudo apt-get install ftp

For Alamanc features install

$ sudo apt-get install python-pip python-dev build-essential 
$ sudo pip install --upgrade pip 
$ sudo pip install pyephem

Stop the mysql server.

$ sudo /etc/init.d/mysql stop

Copy the old database files from the crashed sd card to the new mysql application.

$ cp -R /media/pi/xxxxx/var/lib/mysql/ibdata1 /var/lib/mysql/
$ cp -R /media/pi/xxxxx/var/lib/mysql/weewx/* /var/lib/mysql/weewx

Set the ownership and privliges of the newly copied ibdata1 file and weewx directory to mysql:mysql and 760.

$ sudo chmod 760 /var/lib/mysql/ibdata1
$ sudo chmod -R 760 /var/lib/mysql/weewx
$ sudo chown -R mysql:mysql /var/lib/mysql/weewx
$ sudo chown mysql:mysql /var/lib/mysql/ibdata1 

Start the mysql server.

$ sudo /etc/init.d/mysql start

USB boot now working on Pi3

remove /boot/.firmware_revision to encourage sudo BRANCH=next rpi-update to re-install the USB MSD & PXE bootcode.

sudo apt-get update && sudo apt-get -y dist-upgrade && sudo BRANCH=next rpi-update 

Weewx generates HTML pages, but it does not update them

If you are getting a symptom that everything appears normal, that is image and HTML files are generated ((look in the log to be sure) and sent to your webserver (if you have configured FTP or rsync), but the values in the web pages are not being updated, it could be due to clock skew or corrupt station memory.

Clock skew

If the database contains a record with time stamp (the dateTime field) in the future, then records from the station that are older than that future date will be ignored. How can the database contain records from the future? Sometimes the computer clock is not set correctly. For example, the raspberry pi has no clock, so if weewx saves data before the pi has synchronized its clock with internet time servers, the records will have incorrect time stamps, some of which might be in the future.

The solution is to delete any records with time stamp in the future. For a sqlite database, the procedure looks like this:

cp /home/weewx/archive/weewx.sdb /home/weewx/archive/weewx.sdb.backup sqlite3 /home/weewx/archive/weewx.sdb sqlite> delete from archive where dateTime > X; sqlite> .exit The timestamp X is the current time as unix epoch (number of seconds since 1 January 1970), or a time a minute or two in the future.

Corrupt station memory

If you have a Vantage station, the problem might be because the data on board your console has gotten garbled. The way the Davis Vantage series works is that the software (weewx in this case) asks the console for all archive data “since” some time. The console then downloads the records one at a time. After it gets to the very last one, the memory wraps around, and the timestamp will suddenly jump backwards in time a couple weeks — this how the software knows it has downloaded the last record and so it stops.

However, if the internal memory gets garbled, the console will immediately return archives in the past, and so it looks like the timestamps have decreased in value and so weewx figures that is it: there is no more data.

I have received reports from a couple of users who have had this problem. There seems to be two fixes:

Unplug the console, take out the batteries, and wait a minute or two. This will cause the console software to internally reboot. In one case this has fixed the problem without data loss. If all else fails, clear the memory of the console using the utility wee_device. This may cause loss of data, but usually works. Adjust paths as necessary: wee_device –clear-memory

by Tinderbox (UK) » Tue Oct 11, 2016 9:44 am Sounds great, I have only had my Pi3B for a day and i have already had the microsd out a couple of dozen time and was starting to worry about the microsd card reader getting damaged, booting the OS from an usb port would be amazing.

projects/weewx/restore.txt · Last modified: 2017/06/27 15:41 by 127.0.0.1