Skip to content

Commit 807b615

Browse files
author
Matthew Wall
committed
update readme to v5 semantics. clarify a few tidbits.
1 parent 889fe9d commit 807b615

File tree

1 file changed

+46
-30
lines changed

1 file changed

+46
-30
lines changed

readme

+46-30
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
weewx-sdr
2-
Copyright 2016-2022 Matthew Wall
2+
Copyright 2016-2024 Matthew Wall
33
Distributed under terms of the GPLv3
44

55
This is a driver for weewx that captures data from software-defined radio.
@@ -30,51 +30,67 @@ Installation
3030

3131
0) install pre-requisites
3232

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
3939

40-
1) download the driver
40+
1) install the driver
4141

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
4343

44-
2) install the driver
44+
2) configure the driver
4545

46-
sudo wee_extension --install weewx-sdr.zip
46+
weectl station reconfigure --driver=user.sdr --no-prompt
4747

48-
3) configure the driver
48+
3) run the driver directly to identify the packets you want to capture
4949

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"
5153

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
5855

5956
- create a [[sensor_map]] for the data you want to capture
6057
- possibly modify the 'cmd' parameter
6158

62-
6) start weewx
59+
5) start weewx
6360

64-
sudo /etc/init.d/weewx start
61+
sudo systemctl start weewx
6562

6663

6764
===============================================================================
6865
How to run the driver directly
6966

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
7284

73-
sudo PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/sdr.py --help
85+
A pip/venv installation would look something like this:
7486

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
7690

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.
7894

7995

8096
===============================================================================
@@ -183,7 +199,7 @@ sudo rtl_433 -M utc -F json -R 9 -R 31
183199
Once that is working, run the driver directly to be sure that it is collecting
184200
data from the rtl_433 application.
185201

186-
sudo PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/sdr.py
202+
python3 sdr.py --cmd="rtl_433 -M utc -F json"
187203

188204
Make note of the sensor identifiers. Each identifier is a three-part string
189205
consisting of the observation, sensor id, and rf packet type, separated by
@@ -210,7 +226,7 @@ sensors are captured, recognized, and parsed.
210226
Once you are satisfied with the output when running weewx directly, run weewx
211227
as a daemon and configure rc script or systemd to run weewx at system startup.
212228

213-
sudo /etc/init.d/weewx start
229+
sudo systemctl start weewx
214230

215231

216232
===============================================================================
@@ -271,7 +287,7 @@ First, shut down weewx so that you can talk to the SDR directly.
271287
Then run the SDR driver directly, but tell it to print out information only
272288
about sensors that you have not yet added to your weewx configuration:
273289

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
275291

276292
As always, unless the sensor identifier is marked on the sensor itself, you
277293
should turn on sensors one at a time, marking the outside of the sensor with
@@ -286,7 +302,7 @@ Support for new sensor types
286302
To add support for new sensors, capture the output from rtl_433. To capture
287303
output, run the driver directly and hide known packets:
288304

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
290306

291307
This should emit a line for each unparsed type. For example:
292308

0 commit comments

Comments
 (0)