I've had a Pi and SDR earmarked for 'getting weather data from my weather station' for a long time now. I don't know why I waited so long, because it was shockingly easy.
I have a Acurite 5-in-1 weather station (with separate lightning detector) mounted about 15' in the air in my back yard. It comes with a fancy little LCD display to show all the stats it transmits over the 433 MHz wireless frequency.
But I want to ingest that data into my Home Assistant installation, so I can have better access to historical data, set up alerts (like if wind speed is above 50 mph, or there's lightnining less than 10 miles away), etc.
I'll work on the HA integration later, likely using MQTT. But for now, just getting the data to decode on a Raspberry Pi 5 was quick:
- Plug my Nooelec NESDR into my Pi, and the cheap dipole antenna that came in the kit into the NESDR's antenna jack
- Install
rtl_433
on the Pi:sudo apt install -y rtl-433
- Run it:
rtl_433
Bingo! It automatically picked up both of my Acurite sensors, and started displaying the data every few seconds:
It's a rare treat to just install something and have it work immediately. Especially if it uses RF!
I will still be working to integrate into Home Assistant, but at least for now, I'm running WeeWX on my Pi so I have a full web dashboard for the Acurite sensors. Installation was easy, following the WeeWX documentation for Debian:
# Add the WeeWX GPG key.
sudo apt install -y wget gnupg
wget -qO - https://weewx.com/keys.html | \
sudo gpg --dearmor --output /etc/apt/trusted.gpg.d/weewx.gpg
# Set up the WeeWX apt repository.
echo "deb [arch=all] https://weewx.com/apt/python3 buster main" | \
sudo tee /etc/apt/sources.list.d/weewx.list
# Install WeeWX.
sudo apt update
sudo apt install -y weewx
The installer has a few prompts for setup. Complete those steps manually. I just entered the defaults for location; if you want to place it on a map, get the coordinates and altitude using a tool like Elevation.place.
You can reconfigure weewx later with sudo systemctl stop weewx
, then weectl station reconfigure
(then systemctl start
it again). Configuration is stored in /etc/weewx/weewx.conf
.
To get WeeWX to use rtl_433
to get sensor data, install the weewx-sdr
plugin:
sudo weectl extension install https://github.com/matthewwall/weewx-sdr/archive/master.zip
Confirm that you want to install it, then once it's done, configure the driver and restart WeeWX:
sudo weectl station reconfigure --driver=user.sdr --no-prompt
sudo systemctl restart weewx
At this point, WeeWX will have the plugin running but no data will get captured until you manually configure which sensors you want to use, in a [[sensor_map]]
in the /etc/weewx/weewx.conf
file. Follow the directions in the Installation section of the weewx-sdr README to do that.
Here is the configuration I used after monitoring my station to get the ID values (which... apparently can change when you change batteries, so beware!):
[SDR]
driver = user.sdr
[[sensor_map]]
windDir = wind_dir.0C2D.Acurite5n1PacketV2
windSpeed = wind_speed.0C2D.Acurite5n1PacketV2
rain_total = rain_total.0C2D.Acurite5n1PacketV2
outTemp = temperature.0C2D.Acurite5n1PacketV2
outHumidity = humidity.0C2D.Acurite5n1PacketV2
lightning_distance = distance.0008.AcuriteLightningPacket
strikes_total = strikes_total.0008.AcuriteLightningPacket
If you have an Acurite lightning detector like I do, you may also need to configure an Accumulator
and Corrections
to the data so it displays correctly in WeeWx.
Even after all that, weewx
will run under a weewx
user account, which may not have access to the USB hardware you're using for rtl_433
, so you need to add a udev
rule to give permission.
Create a udev rule file with sudo nano /etc/udev/rules.d/sdr.rules
, and put the following inside:
SUBSYSTEM=="usb",ATTRS{idVendor}=="0bda",ATTRS{idProduct}=="2832",MODE="0664",GROUP="weewx"
SUBSYSTEM=="usb",ATTRS{idVendor}=="0bda",ATTRS{idProduct}=="2838",MODE="0664",GROUP="weewx"
(The vendor and product IDs may differ depending on your SDR stick — the above values are for most cheap RTL-SDR and Nooelec sticks. Check yours with lsusb
.)
Then restart the Pi entirely. You can live reload udev rules but restarting is honestly easier than remembering how to do that :)
Finally, after all that (and waiting 5+ minutes for the first report to be generated, we get a weather dashboard! On the same Pi, load up the /var/www/html/weewx/index.html
file in your web browser, and you can browse the report locally:
If you want to serve it up to the local network, you can use Apache or another webserver, but that exercise is left to the reader.