matthewwall / weewx-sdr

weewx driver for software-defined radio
GNU General Public License v3.0
114 stars 74 forks source link

Acurite Atlas - getting phantom rain data in weewx database #127

Closed mrneutron42 closed 3 years ago

mrneutron42 commented 3 years ago

This week, I got my Acurite Atlas data coming into weewx for the first time. I'm using rtl_433 and weewx-sdr. The Atlas is inside my house while I set up weewx and test all the pieces of the system, so there is no rain entering the unit.

To test the rain counter in the Atlas, I tipped its teeder-todder back and forth a few times and that did register a fraction of an inch of rain. It amounted to about 0.17 inches of rain. Which I saw reported in the data that is produced from running sdr.py: sudo PYTHONPATH=/home/weewx/bin python3 /home/weewx/bin/user/sdr.py --cmd="rtl_433 -R 40 -M utc -F json" Captured file attached. Atlas-data.txt Here's a section of the captured data.

out:['{"time" : "2021-04-27 19:55:57", "model" : "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 0, "battery_ok" : 1, "message_type" : 38, "wind_avg_mi_h" : 0.000, "wind_dir_deg" : 183.000, "rain_in" : 0.170, "strike_count" : 3, "strike_distance" : 0, "exception" : 0, "raw_msg" : "c0116600055c11006009"}\n', '{"time" : "2021-04-27 19:55:57", "model" : "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 1, "battery_ok" : 1, "message_type" : 38, "wind_avg_mi_h" : 0.000, "wind_dir_deg" : 183.000, "rain_in" : 0.170, "strike_count" : 3, "strike_distance" : 0, "exception" : 0, "raw_msg" : "c4116600055c1100600d"}\n', '{"time" : "2021-04-27 19:55:57", "model" : "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 2, "battery_ok" : 1, "message_type" : 38, "wind_avg_mi_h" : 0.000, "wind_dir_deg" : 183.000, "rain_in" : 0.170, "strike_count" : 3, "strike_distance" : 0, "exception" : 0, "raw_msg" : "c8116600055c11006011"}\n'] parsed: {'dateTime': 1619553357, 'usUnits': 1, 'model.0011.AcuriteAtlasPacket': 'Acurite-Atlas', 'channel.0011.AcuriteAtlasPacket': 'A', 'sequence_num.0011.AcuriteAtlasPacket': 0, 'message_type.0011.AcuriteAtlasPacket': 38, 'wind_speed.0011.AcuriteAtlasPacket': 0.0, 'wind_dir.0011.AcuriteAtlasPacket': 183.0, 'rain_total.0011.AcuriteAtlasPacket': 0.17, 'battery.0011.AcuriteAtlasPacket': 0}

You can see that 'rain_total.0011.AcuriteAtlasPacket' is only 0.17. This value is sent over and over, all day, and I have never seen it reset to 0. I guess this is the Atlas cumulative rain amount?

The mystery: I am seeing large amounts of rain being registered in the weewx webpage, and can't understand how! hourly rain graph insane rain numbers When I look into the /home/weewx/bin/weewx.sdb file, I see rain and rain rate numbers! How? Atlas phantom rain I have the [sensor_map] section of weewx.conf is assigning the rain_total.0011.AcuriteAtlasPacket data to the 'rain' variable taken from the wview_extended.py schema in /home/weewx/bin/schemas

######################################## [SDR]

This section is for the software-defined radio driver.

# collect data from Acurite Atlas sensor 0011

# The driver to use
driver = user.sdr
cmd = rtl_433 -R 40 -M utc -F json

[[sensor_map]]
    outTemp = temperature.0011.AcuriteAtlasPacket
    outHumidity = humidity.0011.AcuriteAtlasPacket
    windSpeed = wind_speed.0011.AcuriteAtlasPacket
    windDir = wind_dir.0011.AcuriteAtlasPacket
    UV = uv.0011.AcuriteAtlasPacket
    lux = lux.0011.AcuriteAtlasPacket
    rain = rain_total.0011.AcuriteAtlasPacket
    lightning_strike_count = strike_count.0011.AcuriteAtlasPacket
    lightning_distance = strike_distance.0011.AcuriteAtlasPacket
    windBatteryStatus = battery.0011.AcuriteAtlasPacket

What is going wrong here?

andylittle commented 3 years ago

I think this my fix it, you will have to delete some erroneous rain data from your database. Look at sdr.py around line 32 for the explanation:

    driver = user.sdr
    [[sensor_map]]
        inTemp = temperature.25A6.AcuriteTowerPacket
        outTemp = temperature.24A4.AcuriteTowerPacket
        rain_total = rain_total.A52B.Acurite5n1Packet

If no sensor_map is specified, no data will be collected.

The deltas stanza indicates which observations are cumulative measures and
how they should be split into delta measures.

[SDR]
    ...
    [[deltas]]
        rain = rain_total

change to rain_total = rain_total.0011.AcuriteAtlasPacket.

mrneutron42 commented 3 years ago

Thanks for the pointers!

  1. Do I need to do this with lightning_strike_count also? From what I've seen of the raw data coming from the Atlas, that lightning_strike_count number never resets to 0, either.
  2. How do I edit data in the database? That DB Browser for SQLite application?
  3. When I'm done testing the system, is there an easy way to wipe the database and reset ALL the data in it?
andylittle commented 3 years ago
  1. I need to revisit this one, mine is broke.

        lightning_distance = distance.3C47.AcuriteLightningPacket
        strikes_total = strikes_total.3C47.AcuriteLightningPacket
    [[deltas]]
        lightning_strike_count = strikes_total
  2. I use the sqlite comand line.

  3. you can delete the db file and on a restart a new db will be created.

mrneutron42 commented 3 years ago

Adding the [[deltas]] section fixed the phantom rain problem! Thanks! image