Open nrostedt opened 3 years ago
Hi, When python3 is used the PYTHONPATH will be: sudo PYTHONPATH=/usr/share/weewx python3 /usr/share/weewx/user/rtldavis.py --help
Weewx driver rtldavis.py intercepts the output of GO-program rtldavis, so when the GO-program is runned standalone, you should see messages that data is collected from your ISS. Luc Heijst
Hello, Many Thanks for quick response. Now looking better and I see Init and Hop messages indicating that the RTL-SDR stick is alive. However, two issues still cause concern:
pi@raspberrypi:~ $ sudo tail -f /var/log/syslog
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.restx: StationRegistry: Registration not requested.
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.restx: Wunderground: Posting not enabled.
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.restx: PWSweather: Posting not enabled.
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.restx: CWOP: Posting not enabled.
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.restx: WOW: Posting not enabled.
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.restx: AWEKAS: Posting not enabled.
Dec 18 19:12:28 raspberrypi weewx[11451] INFO main: Starting up weewx version 4.2.0
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.manager: Starting backfill of daily summaries
Dec 18 19:12:28 raspberrypi weewx[11451] INFO weewx.engine: Starting main packet loop.
Dec 18 19:15:28 raspberrypi weewx[11451] INFO weewx.manager: Added record 2020-12-18 19:15:00 EET (1608311700) to database 'weewx.sdb'
Dec 18 19:15:28 raspberrypi weewx[11451] INFO weewx.manager: Added record 2020-12-18 19:15:00 EET (1608311700) to daily summary in 'weewx.sdb'
Dec 18 19:15:30 raspberrypi weewx[11451] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 1.98 seconds
Dec 18 19:15:34 raspberrypi weewx[11451] INFO weewx.imagegenerator: Generated 45 images for report SeasonsReport in 4.31 seconds
Dec 18 19:15:34 raspberrypi weewx[11451] INFO weewx.reportengine: Copied 5 files to /var/www/html/weewx
Dec 18 19:17:01 raspberrypi CRON[11496]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Dec 18 19:20:15 raspberrypi weewx[11451] INFO weewx.engine: Main loop exiting. Shutting engine down.
Dec 18 19:20:15 raspberrypi weewx[11451] INFO weewx.engine: Shutting down StdReport thread
Dec 18 19:20:15 raspberrypi weewx[11451] INFO user.rtldavis: shutdown process /home/pi/work/bin/rtldavis [options] -tf EU -tr 1
Dec 18 19:20:15 raspberrypi weewx[11451] INFO user.rtldavis: rtldavis with pid 11459 killed
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: Caught unrecoverable exception:
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: must be real number, not NoneType
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: Traceback (most recent call last):
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 210, in run
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: self.dispatchEvent(weewx.Event(weewx.CHECK_LOOP, packet=packet))
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 241, in dispatchEvent
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: callback(event)
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 630, in check_loop
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: raise BreakLoop
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: weewx.engine.BreakLoop
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main:
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: During handling of the above exception, another exception occurred:
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main:
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: Traceback (most recent call last):
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 646, in post_loop
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: self._catchup(self.engine.console.genArchiveRecords)
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 690, in _catchup
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: for record in generator(lastgood_ts):
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/drivers/init.py", line 30, in genArchiveRecords
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: raise NotImplementedError("Method 'genArchiveRecords' not implemented")
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: NotImplementedError: Method 'genArchiveRecords' not implemented
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main:
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: During handling of the above exception, another exception occurred:
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main:
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: Traceback (most recent call last):
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewxd", line 154, in main
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: engine.run()
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 217, in run
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: self.dispatchEvent(weewx.Event(weewx.POST_LOOP))
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 241, in dispatchEvent
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: callback(event)
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 648, in post_loop
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: self._software_catchup()
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 710, in _software_catchup
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: origin='software'))
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 241, in dispatchEvent
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: callback(event)
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/user/rtldavis.py", line 949, in new_archive_record
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: self._update_summaries() # calculate summaries
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: File "/usr/share/weewx/user/rtldavis.py", line 938, in _update_summaries
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: (total_max_count, total_count, total_missed, self.stats['pct_good_all']))
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: TypeError: must be real number, not NoneType
Dec 18 19:20:15 raspberrypi weewx[11451] CRITICAL main: Exiting.
Any advice is helpful, thanks!
The crash of weewx is in fact a bug in rtldavis.py. It will only occur when no single message is received during an archive period. The calculation of pct_good_all will then fail.
You got no single message because of the "Allocating 1 zero-copy buffers" error.
Solution for “Allocating 1 zero-copy buffers” Find location of librtlsdr.so with: cd / find -name librtlsdr.so ... ./home/pi/librtlsdr/build/src/librtlsdr.so Give command: export LD_LIBRARY_PATH=/home/pi/librtlsdr/build/src
Also in the [Rtldavis] section of weewx.conf set the following lines:
ld_library_path = /home/pi/librtlsdr/build/src
Another error that may occur is described below. Solution for error: “Kernel driver is active, or device is claimed by second instance of librtlsdr”. usb_claim_interface error -6 12:47:50.630484 resource busy In the first case, please either detach or blacklist the kernel module (dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
nano /etc/modprobe.d/blacklist.conf blacklist dvb_usb_rtl28xxu rmmod dvb_usb_rtl28xxu
Luc Heijst
Hi, back after the xmas break. Thanks for advice, but I'm still struggling with the basics . I now have two test setups, one RPI3 away at the weather station site and one RPI4 at home, both with 2838 rtl-sdr sticks. Running rtldavis, the RPI4 seems OK, see here (zero-copy message probably because no ISS in range?):
But the RPI3 at the actual weather station site reports:
As a remedy, on the RPI3 I have created a
file according to instructions in the rtldavis repository, but I still get the error. The lsusb command does find the rtl-sdr stick, so it sees the stick, but rtldavis reports error 3.
Is there any way to fix the permissions on the RPI3 to make rtldavis detect the rtl-sdr stick and enable reception and weewx logging, without needing to physically remove and reattach the rtl-sdr stick (or swap RPIs)?
Many thanks in advance!
I don’t know. Sorry, I can’t help you.
Progress: Using the sudo prefix I was able to connect to the rtl-sdr stick! However, the hopping data does not change.
pi@raspberrypi:~ $ sudo $GOPATH/bin/rtldavis 21:15:41.235560 rtldavis.go VERSION=0.15 21:15:41.236301 tr=1 fc=0 ppm=0 gain=0 maxmissed=51 ex=0 receiveWindow=300 actChan=[0] maxChan=1 ..... 21:15:41.238063 BufferLength: 2048 Detached kernel driver Found Rafael Micro R820T tuner 21:15:41.823939 Hop: {ChannelIdx:0 ChannelFreq:868077250 FreqError:0 Transmitter:0} Exact sample rate is: 268800.001367 Hz 21:15:42.005922 GetTunerGain: 0 Db 21:15:42.005993 SetFreqCorrection 0 ppm Successful Allocating 1 zero-copy buffers 21:15:42.010329 Init channels: wait max 17 seconds for a message of each transmitter 21:15:59.948485 Init channels: wait max 17 seconds for a message of each transmitter 21:15:59.948642 Hop: {ChannelIdx:0 ChannelFreq:868077250 FreqError:0 Transmitter:0} 21:16:17.887481 Init channels: wait max 17 seconds for a message of each transmitter
Now next challenge is to find the transmissions from the Vantage Vue ISS. Apparently some experimenting with the rtldavis parameters is necessary - any hints are welcome!
Wee_device --info shows this interesting data:
Pleased to report success in receiving data from the Vantage Vue ISS. I finally got the rtldavis driver to work and have now run it under weewxd for more than 24 hours without hiccups. Loop packet output works, as well as html generation.
This being my first non-trivial app on Linux/Raspberry, I encountered my share of problems and things I had misunderstood. But reading all various forum threads brought help. I decided to recompile protocol.go with frequencies obtained by a test run, (as advised in a forum post over at wxforum.net) and this enabled the data reception.
Thanks to Luc as well as to all other old and new contributors to this project for your efforts!
Hi, All,
regarding to https://github.com/lheijst/weewx-rtldavis/issues/8
a reason why the driver stopped parsing data could be the Allocating 1 zero-copy buffers error because I didn't configured the things @lheijst Luc wrote
Solution for “Allocating 1 zero-copy buffers” the location of librtlsdr.so is: ./home/pi/librtlsdr/build/src/librtlsdr.so
Give command: export LD_LIBRARY_PATH=/home/pi/librtlsdr/build/src
MainQuestion: can I add the export rule to the profilepath ?
i even made additions to weewx.conf:
and in the [Rtldavis] section ld_library_path=/home/pi/librtlsdr/build/src
after a save, I rebooted the system..... saw still the usb_claim_interface error -6 when I run $GOPATH/bin/rtldavis (I think the error appears because the auto start of weewx) Allocating 1 zero-copy buffers does not disappear
thanks for the advice / feedback regarding the steps I made
Hello! Thanks for your work, weewx-rtlsdr appears to be the perfect solution for my needs, but some help is appreciated. I am installing weewx-rtldavis on a fresh RPI4 with weewx and simulator running. Problems at step 5: no home/pi/work folder present. I took advice from issue #4, but compilation failed: o get -v github.com/lheijst/rtldavis github.com/lheijst/rtldavis (download) github.com/lheijst/rtldavis/vendor/github.com/jpoirier/gortlsdr github.com/lheijst/rtldavis/crc github.com/lheijst/rtldavis/dsp
github.com/lheijst/rtldavis/vendor/github.com/jpoirier/gortlsdr
work/src/github.com/lheijst/rtldavis/vendor/github.com/jpoirier/gortlsdr/exports.go:17:10: fatal error: rtl-sdr.h: No such file or directory
include
compilation terminated. github.com/lheijst/rtldavis/protocol
I have got a /home/pi/work/src/github.com/lheijst/weewx-rtldavis/bin/user folder with rtldavis.py, as well as a /home/pi/work/src/github.com/lheijst/rtldavis folder with main.go and other files, but no /home/pi/work/bin folder. An attempt to compile as per 5b) fails as above.
Any help is appreciated Cheers,
EDIT: After installing the library sudo apt-get install librtlsdr-dev, the compilation was successful. I can now test the rtlsdr as per section 6 in the instruction, However, trying the Section 7 I get the error: sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/rtldavis.py --help Traceback (most recent call last): File "/usr/share/weewx/user/rtldavis.py", line 94, in
import weewx.engine
File "/usr/share/weewx/weewx/engine.py", line 20, in
import configobj
ImportError: No module named configobj
Furthermore, I have not found a way to verify that the connected RTL-SDR stick is listened to by weewx. When using the weewxd command I get LOOP packets which do not contain the data I expected: pi@raspberrypi:~ $ weewxd LOOP: 2020-12-18 16:37:14 EET (1608302234) consBatteryVoltage: 0, dateTime: 1608302234, maxSolarRad: None, rainRate: 0.0, usUnits: 1 LOOP: 2020-12-18 16:37:32 EET (1608302252) consBatteryVoltage: 0, dateTime: 1608302252, maxSolarRad: None, rainRate: 0.0, usUnits: 1
Any advice? Please note I am at the moment away from the Davis Vantage Vue ISS, so I can't get a real radio signal, but I'd like to verify that the RTL-SDR stick is working. Thanks in advance.