No rain data for Acurite 5n1 - not getting parsed

103 views
Skip to first unread message

Andrew Mackey

unread,
May 20, 2020, 10:54:38 PM5/20/20
to weewx-user
After installing the rtl software and the weewx software on my Pi 4 and getting everything configured I am getting things to work as expected.   Just no rain data.   I was expecting to have this problem because the output from running the command sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/sdr.py --cmd="rtl_433 -M utc -F json" is missing the rain data in the parsed section.  Notice in the output below that there is a value in the 'rain_in' for the out section, but that rain data is not in the parsed section.


out:[u'{"time" : "2020-05-21 02:27:42", "model" : "Acurite-5n1", "subtype" : 49, "id" : 1066, "channel" : "B", "sequence_num" : 0, "battery_ok" : 1, "wind_avg_km_h" : 14.245, "wind_dir_deg" : 112.500, "rain_in" : 28.500, "mic" : "CHECKSUM"}\n', u'{"time" : "2020-05-21 02:27:42", "model" : "Acurite-5n1", "subtype" : 49, "id" : 1066, "channel" : "B", "sequence_num" : 1, "battery_ok" : 1, "wind_avg_km_h" : 14.245, "wind_dir_deg" : 112.500, "rain_in" : 28.500, "mic" : "CHECKSUM"}\n', u'{"time" : "2020-05-21 02:27:42", "model" : "Acurite-5n1", "subtype" : 49, "id" : 1066, "channel" : "B", "sequence_num" : 2, "battery_ok" : 1, "wind_avg_km_h" : 14.245, "wind_dir_deg" : 112.500, "rain_in" : 28.500, "mic" : "CHECKSUM"}\n']


parsed: {'wind_speed.042A.Acurite5n1PacketV2': 14.245, 'model.042A.Acurite5n1PacketV2': u'Acurite-5n1', 'channel.042A.Acurite5n1PacketV2': u'B', 'wind_dir.042A.Acurite5n1PacketV2': 112.5, 'battery.042A.Acurite5n1PacketV2': 1, 'dateTime': 1590028062, 'freq.042A.Acurite5n1PacketV2': None, 'mod.042A.Acurite5n1PacketV2': None, 'snr.042A.Acurite5n1PacketV2': None, 'sequence_num.042A.Acurite5n1PacketV2': 0, 'noise.042A.Acurite5n1PacketV2': None, 'protocol.042A.Acurite5n1PacketV2': None, 'rssi.042A.Acurite5n1PacketV2': None, 'msg_type.042A.Acurite5n1PacketV2': 49, 'usUnits': 1}


I have done a lot of searching on this forum and the web and I understand that there have been many changes to the labeling of rain data on the Acurite 5n1 system.  Howerver I just can't figure out where in the code I can make a change that will accept label that my version of the weather station uses for rain.


I have done a fair share of programming and I have the help of my son who is a computer science graduate.  I feel quite comfortable messing around in the code


So far the only change in code that I have tried was to change the line in sdr.py


I am running rtl_433 version 20.02-55-gc1d1f9f branch master at 202005162227


thanks for your help

gjr80

unread,
May 20, 2020, 11:55:38 PM5/20/20
to weewx-user
Hi,

Not a sdr driver or Acurite user but looking at the sdr driver as far as I can tell the sdr driver expects Acurite5n1PacketV2 rain data to be in field rain_mm whereas you appear to have rain_in. You could try adding the following two highlighted lines to /usr/share/weewx/user/sdr.py:

        if 'wind_dir_deg' in obj:
            pkt
['wind_dir'] = Packet.get_float(obj, 'wind_dir_deg')
       
if 'rain_mm' in obj:
            pkt
['rain_total'] = Packet.get_float(obj, 'rain_mm') / 25.4
        if 'rain_in' in obj:
            pkt
['rain_total'] = Packet.get_float(obj, 'rain_in')

       
if 'temperature_F' in obj:
            pkt
['temperature'] = Packet.get_float(obj, 'temperature_F')

Save sdr.py then try running sdr.py directly again.

Oh, and of course, make sure you keep a back of sdr.py before making any changes.

Gary

Gazza

unread,
May 21, 2020, 6:44:56 AM5/21/20
to weewx-user

rtl_433 version 20.02-26-ge571a05 from Feb 2020 has broken every sensor I have in lots of ways, numerous identifiers have changed names so nothing works out of the box at the moment.

The edit above fixed the rain reading on my mates new Acurite station but the battery status is still not working correctly and the problem seems to effect all sensors.

I will do a more detailed post when I get all the details sorted.


Another Gary

Andrew Mackey

unread,
May 21, 2020, 11:08:46 AM5/21/20
to weewx-user
Gary,

thank you for your post.  It has been helpful.  I have made some progress now.

First I think I might be confused about how to set up my config file as to whether I am using the SDR option or the Acurite Option when configuring my station.  I have come to the conclusion that choosing SDR is correct (I am using an SDR to read the data from my weather station as opposed to having the station directly connected to my Pi).

Using you suggestion and configuring for the Acurite option I was able to get the parser to show the total rain (rain_in) when I ran the sdr.py code.  However, when I ran the weewx in direct mode, it said it could not find the device on USB.  So I went back to choosing the SDR option.  I then went to the SDR class and found where the sensor_map section was and added a line for my rain_in fully qualified name.  Then when I re-ran the sdr.py code I was still getting the rain_in/rain_total values showing in my parsed data and when I reun weewx in direct mode it is working again, although no rain data in the loops or in the records.  So that is some progress at least.

Also, I am still not getting any rain data when I look at my generated web page.

Rob Series

unread,
May 23, 2020, 9:05:10 AM5/23/20
to weewx-user
I suspect the parsing problem is caused by update to RTL_433 in August 2019. See my post of 20 May below.
Rob Series

Andrew Mackey

unread,
May 24, 2020, 10:16:40 AM5/24/20
to weewx-user
I have my rain data showing up now.

As I was able to determine, my situation does require me to use the SDR option instead of the Acurite 5N1 option when configuring my setup.  As I had mentioned, I added the correct line to the SDR.py file which resulted in the rain data being parsed correctly.  My son is working on this as well and he figured out that this line also needed to be added to the weewx.conf file as well.

Andrew Mackey

unread,
May 24, 2020, 11:07:22 AM5/24/20
to weewx-user
Here is a little bit more detail.  Please note that the 

I updated the file: /usr/share/weewx/user/sdr.py

by adding the lines highlight by gjr80 to the section under 'class Acurite5n1PacketV2(Packet):'

This is how I fixed the first part of the problem where the out data portion of running this file had the rain data, but the parsed portion did not.


Next I updated the file: /etc/weewx/weewx.conf

 by adding the highlighted line

[SDR]

    # This section is for the software-defined radio driver.

    # The driver to use

    driver = user.sdr


   log_unknown_sensors = True

    log_unmapped_sensors = True


    #cmd = /usr/local/bin/rtl_433 -M utc -F json

    cmd = /usr/local/bin/rtl_433 -q -M UTC -F json


    [[sensor_map]]

        windDir = wind_dir.042A.Acurite5n1PacketV2

        windSpeed = wind_speed.042A.Acurite5n1PacketV2

        outTemp = temperature.042A.Acurite5n1PacketV2

        outHumidity = humidity.042A.Acurite5n1PacketV2

        rain_total = rain_total.042A.Acurite5n1PacketV2

    [[Deltas]]

        rain = rain_total

Reply all
Reply to author
Forward
0 new messages