weewx time is wrong

1,889 views
Skip to first unread message

zkab

unread,
Sep 11, 2017, 10:51:38 AM9/11/17
to weewx-user
I run Standard weewx on a RPi and the weewx-time is wrong.
The RPi gets the time from a ntp-server and the 'date' gives my a correct time.
How can I get weewx to fetch the right system time?
I have fake-hwclock installed on RPi ...
Have read several solutions but don't know how to proceed ... one solution suggest to remove fake clock (sudo apt-get purge fake-hwclock)

zkab

unread,
Sep 11, 2017, 1:13:19 PM9/11/17
to weewx-user
I did following:
sudo wee_device --set-time 
Using configuration file /etc/weewx/weewx.conf
Using Vantage driver version 3.0.10 (weewx.drivers.vantage)
Setting time on console...
Current console time is 2017-09-11 19:05:13 CEST (1505149513)
which is correct time.

And then I issued following command:
sudo wee_device --info
Using configuration file /etc/weewx/weewx.conf
Using Vantage driver version 3.0.10 (weewx.drivers.vantage)
Querying...
Davis Vantage EEPROM settings:
    
    CONSOLE TYPE:                   VantageVue
    
    CONSOLE FIRMWARE:
      Date:                         Feb  3 2015
      Version:                      4.18
    
    CONSOLE SETTINGS:
      Archive interval:             300 (seconds)
      Altitude:                     31 (meter)
      Wind cup type:                large
      Rain bucket type:             0.2 MM
      Rain year start:              1
      Onboard time:                 2017-09-11 19:06:47

which also seems to be correct time. But weewx/standard displays wrong time '11-Sep-2017 09:30'
Can't figure out what is wrong ... but something is very wrong

vince

unread,
Sep 11, 2017, 3:03:25 PM9/11/17
to weewx-user
Hard to help much without knowing which os and version you're runnning, but in general you should be running ntp on your pi and not running fake-hwclock.   Try "ntpq -pn" to see your offset from the NTP reference time servers.

mwall

unread,
Sep 11, 2017, 3:19:59 PM9/11/17
to weewx-user
as vince suggested, you should remove fake-hwclock

weewx includes a mechanism to delay its processing if the clock returns a wonky time.  'wonky' in this case means anything before 1 jan 2000.

i have found that some arm-based systems with no hardware clock will still somehow get to a time later than 1 jan 2000, but not the correct time.  then at some later point they correct the time using ntp.

of course, this causes weewx to start reporting data, and if the weather station hardware does not have its own clock, or if you use software record generation, you end up with archive records with bogus timestamps.

one way to fix it is to change the definition of 'wonky' to something more recent.

in bin/weewx/engine.py, change this:

    # be sure that the system has a reasonable time (at least 1 jan 2000).     
    # log any problems every minute.                                           
    n = 0
    while weewx.launchtime_ts < 946684800:

to this

    while weewx.launchtime_ts < 1504224000:

now weewx will wait to do anything until the time is after 00:00 on 1 sep 2017.

sometimes i see a clock that jumps *backward* in time before stabilizing on ntp time.  fixing that is left as an exercise to the reader (merge requests welcome :)

m

zkab

unread,
Sep 14, 2017, 10:59:10 AM9/14/17
to weewx-user
I was pretty fed up with the fake-hwclock so I discarded RPi that ran weewx and began from scratch by installing weewx on a Gigabyte Brix computer.
The Brix has Ubuntu 16.04.3 LTS with all updates installed and on that computer I installed weewx Standard v3.7.1 (DEB version).
Still I don't get the time correct ... the fake-hwclock can't be an issue since I have a RTC in the computer.
All time commands give me correct time except weewx (see the attached image) ... weewx time doesn't change ... it seems to be hard-wired into the system ...
I have also given the command 'sudo wee_device /etc/weewx/weewx.conf --set-time'
I have a ntp-server in my network that Brix uses.
Immediately after a reboot 'ntpq -pn' gives following:

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 192.168.0.1     94.246.113.189   3 u   42   64    1    2.943  -132.26   0.000

What more can I do ?
More info is below:

$ wee-stop.sh; date; wee-vantage-info.sh; wee-start.sh 
tor 14 sep 2017 16:11:22 CEST
Using configuration file /etc/weewx/weewx.conf
Using Vantage driver version 3.0.10 (weewx.drivers.vantage)
Querying...
Davis Vantage EEPROM settings:
    
    CONSOLE TYPE:                   VantageVue
    
    CONSOLE FIRMWARE:
      Date:                         Feb  3 2015
      Version:                      4.18
    
    CONSOLE SETTINGS:
      Archive interval:             300 (seconds)
      Altitude:                     31 (meter)
      Wind cup type:                large
      Rain bucket type:             0.2 MM
      Rain year start:              1
      Onboard time:                 2017-09-14 16:11:24
      
    CONSOLE DISPLAY UNITS:
      Barometer:                    hPa
      Temperature:                  degree_C
      Rain:                         mm
      Wind:                         meter_per_second
      
    CONSOLE STATION INFO:
      Latitude (onboard):           +59.2
      Longitude (onboard):          +18.2
      Use manual or auto DST?       MANUAL
      DST setting:                  OFF
      Use GMT offset or zone code?  GMT_OFFSET
      Time zone code:               N/A
      GMT offset:                   +2.0 hours
        
    TRANSMITTERS: 
      Channel 1:                    iss 
      Channel 2:                    (N/A) 
      Channel 3:                    (N/A) 
      Channel 4:                    (N/A) 
      Channel 5:                    (N/A) 
      Channel 6:                    (N/A) 
      Channel 7:                    (N/A) 
      Channel 8:                    (N/A) 

    RECEPTION STATS:
      Total packets received:       22709
      Total packets missed:         4
      Number of resynchronizations: 0
      Longest good stretch:         18497
      Number of CRC errors:         0
      
    BAROMETER CALIBRATION DATA:
      Current barometer reading:    29.114 inHg
      Altitude:                     102 feet
      Dew point:                    53 F
      Virtual temperature:          54 F
      Humidity correction factor:   28
      Correction ratio:             1.004
      Correction constant:          +0.000 inHg
      Gain:                         0.000
      Offset:                       -9.000
      
    OFFSETS:
      Wind direction:               +0 deg
      Inside Temperature:           +0.0 F
      Inside Humidity:              +0%
      Outside Temperature:          +0.0 F
      Outside Humidity:             +0%

zkab

unread,
Sep 14, 2017, 11:00:48 AM9/14/17
to weewx-user
Sorry I forgot the attached image ...
Time-weewx.png

vince

unread,
Sep 14, 2017, 11:15:36 AM9/14/17
to weewx-user
On Thursday, September 14, 2017 at 8:00:48 AM UTC-7, zkab wrote:
Sorry I forgot the attached image ...

At this point I have no idea what problem you think you're seeing....
  • What is the system time according to the 'date' command ?
  • What is true time according to https://www.time.gov/ ?
  • Where do you think the time is incorrect ?
  • By how much ?
  • Where are you located - which timezone ?

Andrew Milner

unread,
Sep 14, 2017, 11:18:58 AM9/14/17
to weewx-user
weewx just uses the system time - so the fault will not be with the clock itself.

rather than attaching the image of the wrong time, it may be mopre useful to attach the log froom start up until after the second archive period to ensure that the pages are being generated correctly.

zkab

unread,
Sep 17, 2017, 9:47:32 AM9/17/17
to weewx-user
It seems to me that weewx don't get updates from the console ... I have the same time at all labels  (2017-09-11 09:30:00) and the same values in Current Conditions'
Down below is how my installation worked ... don't understand what is wrong ... appreciate how to proceed.

*** Log after install weewx ***

rajan@weather:~$ sudo tail -f /var/log/syslog
Sep 17 14:20:42 weather weewx[2511]: manager: Added record 2017-09-10 00:45:00 CEST (1504997100) to database 'weewx.sdb'
Sep 17 14:20:42 weather weewx[2511]: manager: Added record 2017-09-10 00:45:00 CEST (1504997100) to daily summary in 'weewx.sdb'
Sep 17 14:20:42 weather weewx[2511]: manager: Added record 2017-09-10 00:50:00 CEST (1504997400) to database 'weewx.sdb'
Sep 17 14:20:42 weather weewx[2511]: manager: Added record 2017-09-10 00:50:00 CEST (1504997400) to daily summary in 'weewx.sdb'

...

Sep 17 14:21:06 weather weewx[2511]: manager: Added record 2017-09-11 22:00:00 CEST (1505160000) to database 'weewx.sdb'
Sep 17 14:21:06 weather weewx[2511]: manager: Added record 2017-09-11 22:00:00 CEST (1505160000) to daily summary in 'weewx.sdb'
Sep 17 14:21:06 weather weewx[2511]: manager: Added record 2017-09-11 22:05:00 CEST (1505160300) to database 'weewx.sdb'
Sep 17 14:21:06 weather weewx[2511]: manager: Added record 2017-09-11 22:05:00 CEST (1505160300) to daily summary in 'weewx.sdb'
Sep 17 14:21:06 weather weewx[2511]: engine: Starting main packet loop.
^C

*** Delete database & restore backup ***

rajan@weather:~$ sudo service weewx stop
rajan@weather:~$ ls -la /var/lib/weewx/weewx.sdb
-rw-r--r-- 1 root root 300032 sep 17 14:21 /var/lib/weewx/weewx.sdb
rajan@weather:/var/lib/weewx$ sudo rm weewx.sdb 
rajan@weather:/var/lib/weewx$ sudo cp -auv /nfs/WEATHER/weewx.sdb .
'/nfs/WEATHER/weewx.sdb' -> './weewx.sdb'
rajan@weather:~$ ls -la /var/lib/weewx/weewx.sdb
-rw-r--r--  1 root root 17323008 sep 11 09:30 weewx.sdb
rajan@weather:/var/lib/weewx$ sudo service weewx restart

*** Log after restore  weewx.sdb ***

rajan@weather:/var/lib/weewx$ sudo tail -f /var/log/syslog
Sep 17 14:27:26 weather weewx[2830]: manager: Starting backfill of daily summaries
Sep 17 14:27:26 weather weewx[2830]: restx: StationRegistry: Registration not requested.
Sep 17 14:27:26 weather weewx[2830]: restx: Wunderground: Posting not enabled.
Sep 17 14:27:26 weather weewx[2830]: restx: PWSweather: Posting not enabled.
Sep 17 14:27:26 weather weewx[2830]: restx: CWOP: Posting not enabled.
Sep 17 14:27:26 weather weewx[2830]: restx: WOW: Posting not enabled.
Sep 17 14:27:26 weather weewx[2830]: restx: AWEKAS: Posting not enabled.
Sep 17 14:27:26 weather weewx[2830]: engine: Starting up weewx version 3.7.1
Sep 17 14:27:26 weather weewx[2830]: engine: Clock error is -0.82 seconds (positive is fast)
Sep 17 14:27:28 weather weewx[2830]: engine: Starting main packet loop.

*** Time for system (which is correct) ***

rajan@weather:~$ date
sön 17 sep 2017 14:47:32 CEST

*** Another log after some time ***

rajan@weather:~$ sudo tail -f /var/log/syslog
Sep 17 14:41:21 weather dbus[710]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Sep 17 14:41:21 weather systemd[1]: Starting Network Manager Script Dispatcher Service...
Sep 17 14:41:21 weather dhclient[1257]: bound to 192.168.0.39 -- renewal in 1558 seconds.
Sep 17 14:41:21 weather dbus[710]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 17 14:41:21 weather systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 17 14:41:21 weather nm-dispatcher: req:1 'dhcp4-change' [enp0s31f6]: new request (1 scripts)
Sep 17 14:41:21 weather nm-dispatcher: req:1 'dhcp4-change' [enp0s31f6]: start running ordered scripts...
Sep 17 14:45:17 weather weewx[2830]: cheetahgenerator: Generated 14 files for report StandardReport in 0.32 seconds
Sep 17 14:45:17 weather weewx[2830]: imagegenerator: Generated 12 images for StandardReport in 0.13 seconds
Sep 17 14:45:17 weather weewx[2830]: copygenerator: copied 0 files to /var/www/html/weewx
^C

*** Additional information ***

rajan@weather:~$ sudo service weewx stop; sudo wee_device --info; sudo service weewx start
Using configuration file /etc/weewx/weewx.conf
Using Vantage driver version 3.0.10 (weewx.drivers.vantage)
Querying...
Davis Vantage EEPROM settings:
    
    CONSOLE TYPE:                   VantageVue
    
    CONSOLE FIRMWARE:
      Date:                         Feb  3 2015
      Version:                      4.18
    
    CONSOLE SETTINGS:
      Archive interval:             300 (seconds)
      Altitude:                     31 (meter)
      Wind cup type:                large
      Rain bucket type:             0.2 MM
      Rain year start:              1
      Onboard time:                 2017-09-17 14:56:45
      
    CONSOLE DISPLAY UNITS:
      Barometer:                    hPa
      Temperature:                  degree_C
      Rain:                         mm
      Wind:                         meter_per_second
      
    CONSOLE STATION INFO:
      Latitude (onboard):           +59.2
      Longitude (onboard):          +18.2
      Use manual or auto DST?       MANUAL
      DST setting:                  OFF
      Use GMT offset or zone code?  GMT_OFFSET
      Time zone code:               N/A
      GMT offset:                   +2.0 hours
        
    TRANSMITTERS: 
      Channel 1:                    iss 
      Channel 2:                    (N/A) 
      Channel 3:                    (N/A) 
      Channel 4:                    (N/A) 
      Channel 5:                    (N/A) 
      Channel 6:                    (N/A) 
      Channel 7:                    (N/A) 
      Channel 8:                    (N/A) 

    RECEPTION STATS:
      Total packets received:       20955
      Total packets missed:         9
      Number of resynchronizations: 0
      Longest good stretch:         18139
      Number of CRC errors:         0
      
    BAROMETER CALIBRATION DATA:
      Current barometer reading:    29.955 inHg
      Altitude:                     102 feet
      Dew point:                    52 F
      Virtual temperature:          53 F
      Humidity correction factor:   25
      Correction ratio:             1.004
      Correction constant:          +0.000 inHg
      Gain:                         0.000
      Offset:                       -9.000
      
    OFFSETS:
      Wind direction:               +0 deg
      Inside Temperature:           +0.0 F
      Inside Humidity:              +0%
      Outside Temperature:          +0.0 F
      Outside Humidity:             +0%

*** Also I get some errors from the log ***

$ cat /var/log/syslog | grep -i error

Sep 17 14:20:23 weather weewx[2511]: engine: Clock error is -1.02 seconds (positive is fast)
Sep 17 14:27:14 weather weewx[2777]: engine: Clock error is -1.34 seconds (positive is fast)
Sep 17 14:27:26 weather weewx[2830]: engine: Clock error is -0.82 seconds (positive is fast)
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/NOAA/NOAA-2017.txt.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/NOAA/NOAA-2017-09.txt.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/week.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/smartphone/temp_outside.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/mobile.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/smartphone/radar.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/smartphone/wind.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/month.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/smartphone/rain.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/year.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/smartphone/barometer.html.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/smartphone/index.html.tmp'
Sep 17 14:52:55 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:55 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/index.html.tmp'
Sep 17 14:52:55 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:55 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/RSS/weewx_rss.xml.tmp'
Sep 17 14:52:55 weather wee_reports[3076]:         ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/backgrounds/band.gif'
Sep 17 14:56:47 weather weewx[3210]: engine: Clock error is -0.83 seconds (positive is fast)
Sep 17 15:32:39 weather snap-repair[3370]: error: cannot use snap-repair on a classic system



Thomas Keffer

unread,
Sep 17, 2017, 11:07:37 AM9/17/17
to weewx-user

2. Whatever user is running wee_reports does not have the necessary permission to write to /var/www/HTML/weewx/html and subdirectories. Either run as sudo, or change the permissions on the directory.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vince

unread,
Sep 17, 2017, 11:09:13 AM9/17/17
to weewx-user

On Sunday, September 17, 2017 at 6:47:32 AM UTC-7, zkab wrote:
It seems to me that weewx don't get updates from the console ... I have the same time at all labels  (2017-09-11 09:30:00) and the same values in Current Conditions'
Down below is how my installation worked ... don't understand what is wrong ... appreciate how to proceed.

*** Log after install weewx ***

rajan@weather:~$ sudo tail -f /var/log/syslog
Sep 17 14:20:42 weather weewx[2511]: manager: Added record 2017-09-10 00:45:00 CEST (1504997100) to database 'weewx.sdb'
Sep 17 14:20:42 weather weewx[2511]: manager: Added record 2017-09-10 00:45:00 CEST (1504997100) to daily summary in 'weewx.sdb'


So clearly weewx is working and saving data to the database

 
*** Also I get some errors from the log ***

$ cat /var/log/syslog | grep -i error

Sep 17 14:20:23 weather weewx[2511]: engine: Clock error is -1.02 seconds (positive is fast)
Sep 17 14:27:14 weather weewx[2777]: engine: Clock error is -1.34 seconds (positive is fast)
Sep 17 14:27:26 weather weewx[2830]: engine: Clock error is -0.82 seconds (positive is fast)

I wouldn't worry about these, eventually ntp will sync the clock up

 
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/NOAA/NOAA-2017.txt.tmp'
Sep 17 14:52:54 weather wee_reports[3076]: cheetahgenerator: Generate failed with exception '<type 'exceptions.IOError'>'
Sep 17 14:52:54 weather wee_reports[3076]: ****  IOError: [Errno 13] Permission denied: '/var/www/html/weewx/NOAA/NOAA-2017-09.txt.tmp'


These are your problem - you have a permission problem with your /var/www/html/weewx tree and the files cannot be saved.

Your clock is fine.


zkab

unread,
Sep 19, 2017, 12:13:09 PM9/19/17
to weewx-user
OK - I followed the section WeeWX generates HTML pages, but it does not update them and now it works.
Thanks for your help ...
Reply all
Reply to author
Forward
0 new messages