After some years, when I tried to update my Weewx weather station on a Raspberry pi to latest version all hell let loose. The main problem is that while Weewx 4.x ran as root, Weewx 5.x now creates and runs in its own user acccount ‘weewx’. This causes all manner of problems with permissions and user groups. In contrast the upgrade from Python 2 to Python 3 and the fact there are two ways to install and manage software on Debian (the newer ‘apt’ system and the older ‘pip’ package manager) seems quite minor. The only way forward seemed to be a complete rebuild of the RP.
Before you start I suggest you read this article carefully: https://github.com/weewx/weewx/wiki/Understanding-permissions
I strongly advise using Weewx 5, rather then version 4. Although its extra work to set the permissions, the risk of getting hacked is very real and the damage may well extend to all machines on your network, not just the raspberry pi.
Build the RP
0) First set use the Raspberry pi imager tool to set up a SD card for the Pi. I’m using the image for Raspberry Pi Desktop 64bit ‘bookworm’ 2025/05/13′ and running the RP in ‘headless mode’ (ie connect from Windows pc via a console interface using Putty). When you come to burn the SD card, on the ‘OS Customisation’ screen set the following options:
-
- Hostname: PiWeewx
- Username/password: pi/xxxx
- Consigure wireless lan with SSID and password for your wifi.
- On the ‘Services’ tab enable SSH with password authentication.
Insert the card and open a console window on your PC and check you can ping the RP with ‘ping PiWeewx.local’. If all is well you should get a response from the RP.
Start Weewx installation
On your PC download and install Putty from here. You can now connect via SSH console to the RP using Putty. The first job is to update all software on the RP. We will then install Nginx to host the web site and check its working.
pi@PiWeewx:~ $ sudo apt update .... pi@PiWeewx:~ $ sudo apt full-upgrade ... pi@PiWeewx:~ $ sudo apt remove apache2 ... pi@PiWeewx:~ $ sudo apt install nginx ... pi@PiWeewx:~ $ sudo systemctl start nginx ### Check webserver is running from your PC.
Install Weewx. Full instructions here.
# 1st time only configure apt sudo apt install -y wget gnupg wget -qO - https://weewx.com/keys.html | \ sudo gpg --dearmor --output /etc/apt/trusted.gpg.d/weewx.gpg echo "deb [arch=all] https://weewx.com/apt/python3 buster main" | \ sudo tee /etc/apt/sources.list.d/weewx.list ## Install and start Weewx in simulator mode sudo apt update sudo apt install weewx sudo systemctl start weewx ## Configure for testing # When weewx start you will need to enter station details # Just keep pressing return to accept the defaults for the # built in simulation mode. ## Now look at the log file # If all is well you should see web pages being written # to /var/www/html/weewx journalctl -f --follow -u weewx # After a few minutes you should be able to see the # web site at http://weewx.local/weewx # Reboot the computer and wait a few minutes to check # weewx starts automatically. Check the time in the top left corner # of the web page and confirm the page updates every few minutes and graphs are being plotted.
In my case the weather station gets its data from a Bresser weather station mounted on a pole in the garden. This transmitts a signal in the 433Mhz band which can be received and decoded on the RP using a software defined radio (SDR). This thread tries to collate the various attempts to
Install SDR extension for Weewx. This is a bit undocumented at present so some experimentation gives:.
pi@PiWeewx:~ $ sudo systemctl stop weewx pi@PiWeewx:~ $ wget -O weewx-sdr.zip https://github.com/matthewwall/weewx-sdr/archive/master.zip pi@PiWeewx:~ $ sudo weectl extension install weewx-sdr.zip ... ## Install drivers pi@PiWeewx:~ $ sudo apt-get install rtl-433 ... ## Free up the USB port sudo rmmod rtl2832_sdr dvb_usb_rtl28xxu rtl2832 ... # Later you will need the Vendor ID and product ID for USB stick # With USB stick inserted the command is lsusb -v pi@PiWeewx:$> lsusb -v Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T ... idVendor 0x0bda Realtek Semiconductor Corp. idProduct 0x2838 RTL2838 DVB-T ...
pi@PiWeewx:sudo rtl_433 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ time : 2024-02-13 16:48:08 brand : OS model : Oregon-PCR800 House Code: 9 Channel : 0 Battery : 0 Rain Rate : 0.0 in/h Total Rain: 6.2 in _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ time : 2024-02-13 16:48:11 brand : OS model : Oregon-THGR810 House Code: 176 Channel : 1 Battery : 1 Celsius : 17.30 C Humidity : 60 % _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ time : 2024-02-13 16:48:55 brand : OS model : Oregon-PCR800 House Code: 9 Channel : 0 Battery : 0 Rain Rate : 0.0 in/h Total Rain: 6.2 in _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ time : 2024-02-13 16:49:04 brand : OS model : Oregon-THGR810 House Code: 176 Channel : 1 Battery : 1 Celsius : 17.30 C Humidity : 60 % _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ time : 2024-02-13 16:49:42 brand : OS model : Oregon-PCR800 House Code: 9 Channel : 0 Battery : 0 Rain Rate : 0.0 in/h Total Rain: 6.2 in _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ time : 2024-02-13 16:49:57 brand : OS model : Oregon-THGR810 House Code: 176 Channel : 1 Battery : 1 Celsius : 17.30 C Humidity : 60 %
Run sdr.py to examine parsed output:
pi@PiWeewx:$ cd /etc/weewx pi@PiWeewx:$ sudo PYTHONPATH=/usr/share/weewx python bin/user/sdr.py --cmd="rtl_433 -M utc -F json"
# If using USB stick you may need to give the user weewx permission to accesss the USB port
sudo usermod -aG plugdev weewx
Now the BME280 drivers. First activate the I2C and spi interfaces:
pi@PiWeewx:~ $sudo raspi-config # Select interface options->I2C->Yes # Select interface options->SPI->Yes # Reboot computer sudo reboot.
You may need to install pip, the python package installer before you can install the BME drivers.:
pi@PiWeewx:~ $ sudo apt install python3-pip
I2C & SDR Permissions for Ver 5.1
I expect that this may be documented somewhere else, if so please can someone post a link for others who may be looking?
I’ve recently made the move from ver 4.x to 5.1 and like a few others on here hit problems with permissions. I use a Bresser station via SDR & a BME280 for internal measurements.
In the end I only needed to make 2 changes:
SDR
sudo usermod -aG plugdev weewx
I2C
sudo usermod -aG i2c weewx
A suggestion for the user guide – monitoring section
journalctl –follow -u weewx