rtl_433 not found when run at boot or as service

573 views
Skip to first unread message

dvdhns

unread,
May 9, 2021, 11:58:31 PM5/9/21
to weewx-user
I recently had to rebuild my weewx raspberry pi. I can no longer get weewx to run using sdr/rtl_433 as a service or on boot. But it works when I run weewx manually. I am trying to use weewx 4.5.1 but was using 4.2 without issue.

when I run

sudo weewxd 

this is what I see in log (it works!)

May 10 04:52:29 raspberrypi weewx[2016] INFO __main__: Initializing weewx version 4.5.1

May 10 04:52:29 raspberrypi weewx[2016] INFO __main__: Using Python 2.7.16 (default, Oct 10 2019, 22:02:15) #012[GCC 8.3.0]

May 10 04:52:29 raspberrypi weewx[2016] INFO __main__: Platform Linux-5.10.17-v7+-armv7l-with-debian-10.8

May 10 04:52:29 raspberrypi weewx[2016] INFO __main__: Locale is 'en_GB.UTF-8'

May 10 04:52:29 raspberrypi weewx[2016] INFO __main__: Using configuration file /etc/weewx/weewx.conf

May 10 04:52:29 raspberrypi weewx[2016] INFO __main__: Debug is 0

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.engine: Loading station type SDR (user.sdr)

May 10 04:52:29 raspberrypi weewx[2016] INFO user.sdr: driver version is 0.78

May 10 04:52:29 raspberrypi weewx[2016] INFO user.sdr: sensor map is {}

May 10 04:52:29 raspberrypi weewx[2016] INFO user.sdr: deltas is {'strikes': 'strikes_total', 'rain': 'rain_total'}

May 10 04:52:29 raspberrypi weewx[2016] INFO user.sdr: startup process 'rtl_433 -M utc -F json'

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.engine: StdConvert target unit is 0x1

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.engine: Archive will use data binding wx_binding

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.engine: Record generation will be attempted in 'hardware'

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.engine: Using archive interval of 300 seconds (specified in weewx configuration)

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.restx: StationRegistry: Registration not requested.

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.restx: Wunderground: Posting not enabled.

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.restx: PWSweather: Posting not enabled.

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.restx: CWOP: Posting not enabled.

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.restx: WOW: Posting not enabled.

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.restx: AWEKAS: Posting not enabled.

May 10 04:52:29 raspberrypi weewx[2016] INFO __main__: Starting up weewx version 4.5.1

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.manager: Starting backfill of daily summaries

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.manager: Empty database

May 10 04:52:29 raspberrypi weewx[2016] INFO weewx.engine: Starting main packet loop.

May 10 04:52:29 raspberrypi kernel: [ 1072.337730] r820t 12-001a: destroying instance

May 10 04:52:29 raspberrypi kernel: [ 1072.338432] dvb_usb_v2: 'Realtek RTL2832U reference design:1-1.4.3' successfully deinitialized and disconnected

When I run it as a service ...

sudo /etc/init.d/weewx start

This is what I see in the log (it fails)

May 10 04:55:12 raspberrypi weewx[2065] INFO __main__: Initializing weewx version 4.5.1

May 10 04:55:12 raspberrypi weewx[2065] INFO __main__: Using Python 2.7.16 (default, Oct 10 2019, 22:02:15) #012[GCC 8.3.0]

May 10 04:55:12 raspberrypi weewx[2065] INFO __main__: Platform Linux-5.10.17-v7+-armv7l-with-debian-10.8

May 10 04:55:12 raspberrypi weewx[2065] INFO __main__: Locale is 'en_GB.UTF-8'

May 10 04:55:12 raspberrypi weewx[2065] INFO __main__: PID file is /var/run/weewx.pid

May 10 04:55:12 raspberrypi weewx[2069] INFO __main__: Using configuration file /etc/weewx/weewx.conf

May 10 04:55:12 raspberrypi weewx[2069] INFO __main__: Debug is 0

May 10 04:55:12 raspberrypi weewx[2054]: Starting weewx weather system: weewx.

May 10 04:55:12 raspberrypi systemd[1]: Started LSB: weewx weather system.

May 10 04:55:12 raspberrypi weewx[2069] INFO weewx.engine: Loading station type SDR (user.sdr)

May 10 04:55:12 raspberrypi weewx[2069] INFO user.sdr: driver version is 0.78

May 10 04:55:12 raspberrypi weewx[2069] INFO user.sdr: sensor map is {}

May 10 04:55:12 raspberrypi weewx[2069] INFO user.sdr: deltas is {'strikes': 'strikes_total', 'rain': 'rain_total'}

May 10 04:55:12 raspberrypi weewx[2069] INFO user.sdr: startup process 'rtl_433 -M utc -F json'

May 10 04:55:12 raspberrypi weewx[2069] ERROR weewx.engine: Import of driver failed: failed to start process 'rtl_433 -M utc -F json': [Errno 2] No such file or directory (<class 'weewx.WeeWxIOError'>)

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****  Traceback (most recent call last):

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/engine.py", line 119, in setupStation

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/sdr.py", line 147, in loader

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****      return SDRDriver(**config_dict[DRIVER_NAME])

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/sdr.py", line 2674, in __init__

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****      self._mgr.startup(cmd, path, ld_library_path)

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/sdr.py", line 207, in startup

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****      (cmd, e))

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL weewx.engine:     ****  WeeWxIOError: failed to start process 'rtl_433 -M utc -F json': [Errno 2] No such file or directory

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL __main__: Unable to load driver: failed to start process 'rtl_433 -M utc -F json': [Errno 2] No such file or directory

May 10 04:55:12 raspberrypi weewx[2069] CRITICAL __main__:     ****  Exiting...

I get the same result when I try to run weewx at boot. Running sudo rtl_433 also works, so I think its installed correctly.

Any ideas? 

vince

unread,
May 10, 2021, 12:18:02 AM5/10/21
to weewx-user
Quick guess is $PATH for the boot sequence script does not include the path to find the rtl_433 executable.

Where is your rtl_433 executable located in the filesystem ?

Try:
  • which rtl_433
  • sudo which rtl_433
And let us see what those commands return....

dvdhns

unread,
May 10, 2021, 12:29:17 AM5/10/21
to weewx-user

pi@raspberrypi:~ $ which rtl_433

/usr/local/bin/rtl_433

pi@raspberrypi:~ $ sudo which rtl_433

/usr/local/bin/rtl_433


vince

unread,
May 10, 2021, 12:01:14 PM5/10/21
to weewx-user
Just for a test, try putting a symlink in /usr/bin that points to the binary's location in /usr/local/bin and see if that helps any.
    sudo ln -s /usr/local/bin/rtl_433 /usr/bin/rtl_433

Normally I'd suggest putting the pathname to the binary in whatever config file is defining it (weewx.conf perhaps?) but I don't run that driver so I don't know where it would be defined.   I see one HOWTO at https://www.oneeyedman.net/posts/2020052301-weatherstation.html that seems to say editing the startup file will help (see item 5 in the link), but just symlinking in the os should have the same effect. 

dvdhns

unread,
May 11, 2021, 11:06:11 PM5/11/21
to weewx-user
Not much luck.
The symlinks sorta worked - but then I was getting errors that showed the RTL was already being used, it was like it was calling it twice.
I tried putting the full path in the command line in the SDR section of the weewx.conf. That made weewx produce no errors, but nothing was being collected. Yet, when I set debug in weewx.conf >0 it looked like it was seeing data, but not writing it. 
Totally confused, at this point. I started from scratch, installed weewx using Python3 and had same results.
I had this hardware setup working for 11 months - just burned out my microSD card on the RPi. If only I realized it would be this hard to get things working again. 

Graham Eddy

unread,
May 11, 2021, 11:33:01 PM5/11/21
to weewx...@googlegroups.com
you probably have, but it doesn’t hurt reminding: before even considering weewx, make sure you repeated *all* the installation steps for rtl433, not just dropped stuff in, and from a blank slate not from an earlier attempt. i have had to do this several times (migrating hosts), and i have made this mistake with rtl433 twice - leaving out a step, doesn’t work, continue build instead of wiping it, still won’t work

dvdhns

unread,
May 20, 2021, 10:52:59 PM5/20/21
to weewx-user
I think I got things mostly fixed. Here's what I think fixed it.
  • started from scratch (multiple times) ended up going with the Raspberry Pi Lite version 
  • in the weewx.conf file I have:
    [SDR]   
    driver = user.sdr
    cmd = "sudo /usr/local/bin/rtl_433 -M utc -F json"
  • Note the full path to the rtl_433 file. I dont think the sudo is necessary, but its working so Im not messing with it. I tried this multiple times, and it didn't seem to work, because....
  • It seems the sdr.py version I'm using does not reflect the names of the sensors that rtl_433 is reporting out. So I modified sdr.py to reflect the actual names, and now I'm getting data! Example of sdr.py change:
    changing
    IDENTIFIER = "Acurite 606TX Sensor"
    to
    IDENTIFIER = "Acurite-606TX
  • I'm not sure why I had to change sdr.py, because I tried both the current version, and the version I was using, and neither worked. So I'm thinking at some point, I did the above modification and didn't keep track of it. 
Lot of time waste on this. I also will be building a routine to backup my RPi so that all I need to do is reflash an SD card and all is restored. 

I ended up purchasing a new RPi and SDR dongle. Maybe I'll setup the extra to setup a DEV system so I can experiment as desired. 



vince

unread,
May 21, 2021, 2:11:21 PM5/21/21
to weewx-user
I have the same sensor so I just did your experiment...

I would agree the sensor seems to now report a model of Acurite-606TX today, or at least mine does.   If you set debug=2 and run weewx you'll see syslog entries like the following that pretty clearly indicates that the model isn't known to the driver:

    May 21 09:50:05 pi4p2 weewx[10114] DEBUG user.sdr: lines=['{"time" : "2021-05-21 17:50:01", "model" : "Acurite-606TX", "id" : 240, "battery_ok" : 0, "temperature_C" : 15.000, "mic" : "CHECKSUM"}\n']
    May 21 09:50:05 pi4p2 weewx[10114] DEBUG user.sdr: parse_json: unknown model Acurite-606TX
    May 21 09:50:05 pi4p2 weewx[10114] DEBUG user.sdr: punt unrecognized line '{"time" : "2021-05-21 17:50:01", "model" : "Acurite-606TX", "id" : 240, "battery_ok" : 0, "temperature_C" : 15.000, "mic" : "CHECKSUM"}#012'

The docs for the driver also pretty clearly indicate what to do if you see this.  Either add a new stanza to the driver or edit the one that is there.   What I did was change the IDENTIFIER in the Acurite606TxPacket(Packet) routine in sdr.py to match what my hardware was emitting.   Worked fine for me..

I was also picking up lots of other sensors and stations around me so I limited what the driver was listening for by using the -R 55 option in my config ala:

    [SDR]
         # This section is for the software-defined radio driver.
    
       #--- check the radio is working ---
       # sudo PYTHONPATH=bin python3 bin/user/sdr.py --cmd="rtl_433 -M utc -F json"
       #
       #   out:['{"time" : "2021-05-21 17:30:23", "model" : "Acurite-606TX", "id" : 240, "battery_ok" : 0, "temperature_C" : 14.600, "mic" : "CHECKSUM"}\n']
       #   parsed: {'dateTime': 1621618223, 'usUnits': 16, 'temperature.240.Acurite606TXPacket': 14.6, 'battery.240.Acurite606TXPacket': 1}
       #
       # (this sensor is '-R 55' as reported by rtl_433 if you add the -R option above and let it find the Acurite 606TX model identifier)
       #

        # The driver to use
        driver = user.sdr
        cmd = rtl_433 -M utc -F json -R 55
    
        [[sensor_map]]
            outTemp = temperature.240.Acurite606TXPacket

Lastly the docs for the driver also definitely say what to do in the Environment section of the readme file so that weewx can find rtl_433 on startup.   I added /usr/local/bin to the PATH at the top of /etc/init.d/weewx (I used the old init.d startup for my test) and it worked fine.   I also ran the unmodified init.d file after adding a symlink in /usr/bin to point to the rtl_433 binary in /usr/local/bin and 'that' woked too....so normal $PATH rules apply for your initial problem report.

I did not specify sudo in my weewx.conf as system startup things run as root anyway, so no sudo is required.

Bottom line - I don't see anything that's not documented in the driver instructions, but it does take a little fiddling to get it set up.

Save your weewx.conf offsite someplace for the next time and comment the heck out of it to explain to future-you what you did and why :-)

Reply all
Reply to author
Forward
0 new messages