1
1
weewx-sdr
2
- Copyright 2016-2022 Matthew Wall
2
+ Copyright 2016-2024 Matthew Wall
3
3
Distributed under terms of the GPLv3
4
4
5
5
This is a driver for weewx that captures data from software-defined radio.
@@ -30,51 +30,67 @@ Installation
30
30
31
31
0) install pre-requisites
32
32
33
- a) install weewx
34
- http://weewx.com/docs.html
35
- b) install rtl-sdr
36
- http://sdr.osmocom.org/trac/wiki/rtl-sdr
37
- c) install rtl_433
38
- https://github.com/merbanan/rtl_433
33
+ a) install weewx
34
+ http://weewx.com/docs
35
+ b) install rtl-sdr
36
+ http://sdr.osmocom.org/trac/wiki/rtl-sdr
37
+ c) install rtl_433
38
+ https://github.com/merbanan/rtl_433
39
39
40
- 1) download the driver
40
+ 1) install the driver
41
41
42
- wget -O weewx-sdr.zip https://github.com/matthewwall/weewx-sdr/archive/master.zip
42
+ weectl extension install https://github.com/matthewwall/weewx-sdr/archive/master.zip
43
43
44
- 2) install the driver
44
+ 2) configure the driver
45
45
46
- sudo wee_extension --install weewx-sdr.zip
46
+ weectl station reconfigure --driver=user.sdr --no-prompt
47
47
48
- 3) configure the driver
48
+ 3) run the driver directly to identify the packets you want to capture
49
49
50
- sudo wee_config --reconfigure --driver=user.sdr --no-prompt
50
+ export WEEWX_BINDIR=/usr/share/weewx
51
+ export WEEWX_USRDIR=/etc/weewx/bin/user
52
+ PYTHONPATH=$WEEWX_BINDIR python3 $WEEWX_USRDIR/sdr.py --cmd="rtl_433 -M utc -F json"
51
53
52
- 4) run the driver directly to identify the packets you want to capture
53
-
54
- cd /home/weewx
55
- sudo PYTHONPATH=bin python bin/user/sdr.py --cmd="rtl_433 -M utc -F json"
56
-
57
- 5) modify the [SDR] section of weewx.conf using a text editor
54
+ 4) modify the [SDR] section of weewx.conf using a text editor
58
55
59
56
- create a [[sensor_map]] for the data you want to capture
60
57
- possibly modify the 'cmd' parameter
61
58
62
- 6 ) start weewx
59
+ 5 ) start weewx
63
60
64
- sudo /etc/init.d/weewx start
61
+ sudo systemctl start weewx
65
62
66
63
67
64
===============================================================================
68
65
How to run the driver directly
69
66
70
- Run the driver directly for testing and diagnostics. For example, if weewx
71
- was installed using setup.py:
67
+ You can run the driver directly for testing, diagnostics, and development. In
68
+ fact, you can run the driver without installing it - just invoke python on it!
69
+ In the examples elsewhere in this file, you will see this illustrated with the
70
+ generic form, which is:
71
+
72
+ python3 sdr.py
73
+
74
+ However, in most cases you must specify the location of the WeeWX modules using
75
+ PYTHONPATH. So that generic form will become something like this:
76
+
77
+ PYTHONPATH=/path/to/weewx/modules python3 sdr.py
78
+
79
+ For example, a deb/rpm installation would look like this:
80
+
81
+ export WEEWX_BINDIR=/usr/share/weewx
82
+ export WEEWX_USRDIR=/etc/weewx/bin/user
83
+ PYTHONPATH=$WEEWX_BINDIR python3 $WEEWX_USRDIR/sdr.py
72
84
73
- sudo PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/sdr.py --help
85
+ A pip/venv installation would look something like this:
74
86
75
- If weewx was installed from deb or rpm:
87
+ export WEEWX_BINDIR=~/weewx-venv
88
+ export WEEWX_USRDIR=~/weewx-data/bin/user
89
+ PYTHONPATH=$WEEWX_BINDIR python3 $WEEWX_USRDIR/sdr.py
76
90
77
- sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/sdr.py --help
91
+ Note:
92
+ You might have use 'sudo' if the user does not have permission to read/write
93
+ the USB SDR device.
78
94
79
95
80
96
===============================================================================
@@ -183,7 +199,7 @@ sudo rtl_433 -M utc -F json -R 9 -R 31
183
199
Once that is working, run the driver directly to be sure that it is collecting
184
200
data from the rtl_433 application.
185
201
186
- sudo PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/ sdr.py
202
+ python3 sdr.py --cmd="rtl_433 -M utc -F json"
187
203
188
204
Make note of the sensor identifiers. Each identifier is a three-part string
189
205
consisting of the observation, sensor id, and rf packet type, separated by
@@ -210,7 +226,7 @@ sensors are captured, recognized, and parsed.
210
226
Once you are satisfied with the output when running weewx directly, run weewx
211
227
as a daemon and configure rc script or systemd to run weewx at system startup.
212
228
213
- sudo /etc/init.d/weewx start
229
+ sudo systemctl start weewx
214
230
215
231
216
232
===============================================================================
@@ -271,7 +287,7 @@ First, shut down weewx so that you can talk to the SDR directly.
271
287
Then run the SDR driver directly, but tell it to print out information only
272
288
about sensors that you have not yet added to your weewx configuration:
273
289
274
- PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/ sdr.py --config /home/weewx/ weewx.conf --hide=out,parsed,mapped
290
+ python3 sdr.py --config weewx.conf --hide=out,parsed,mapped
275
291
276
292
As always, unless the sensor identifier is marked on the sensor itself, you
277
293
should turn on sensors one at a time, marking the outside of the sensor with
@@ -286,7 +302,7 @@ Support for new sensor types
286
302
To add support for new sensors, capture the output from rtl_433. To capture
287
303
output, run the driver directly and hide known packets:
288
304
289
- PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/ sdr.py --cmd "rtl_433 -M utc -F json" --hide parsed,out,empty
305
+ python3 sdr.py --cmd= "rtl_433 -M utc -F json" --hide parsed,out,empty
290
306
291
307
This should emit a line for each unparsed type. For example:
292
308
0 commit comments