matthewwall / weewx-sdr

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

Bresser 5in1 under-reporting accumulated rain #96

Closed ComradeTurtle closed 3 years ago

ComradeTurtle commented 3 years ago

I have been using weewx-sdr for quite a while now and I have noticed that weewx-sdr under reports accumulated rain by around 50%, sometimes way more. Other times rain is not reported at all.

I have checked - rtl_433's total rain data is indeed correct. The problem is somewhere between weewx and weewx_sdr. I am happy to provide further information if needed. TIA!

Weewx sensor map:

[SDR]
    driver = user.sdr
    cmd = /usr/local/bin/rtl_433 -M utc -F json -f 868.2M -R 119
    [[sensor_map]]
        windDir = wind_dir.8.Bresser5in1Packet
        windSpeed = wind_speed.8.Bresser5in1Packet
        windGust = gust_speed.8.Bresser5in1Packet
        outTemp = temperature.8.Bresser5in1Packet
        outHumidity = humidity.8.Bresser5in1Packet
        rain_total = rain_total.8.Bresser5in1Packet
        [[deltas]]
        rain = rain_total
andylittle commented 3 years ago

Is the rain value from the sdr driver in mm?

ComradeTurtle commented 3 years ago

Yes, the SDR returns the total rain the station has measured in mm.

stefkal7 commented 3 years ago

I have the same issue ..My station is Bresser 5in1 7002580.... I am using rpi4 with weewx 4.2.0 and noolec sdr .... The sdr delivered to weewx the rain_total packet but weewx in my case doesn't make the deltas calculations so the rain is always 0.00mm ... I have tried almost everything in weewx.conf (because i think that something have to trigger weewx to calculate the rain value with rain_total packet ) but no rain ... Only pain ... Both sdr.py and weewx.conf are set up correctly (i think) and i have in the [sdr] field [[deltas ]] rain = rain_total the station sends 2 partial packets ... fisrt has the rain and wind values and the second all except rain my log raspberrypi weewx[12220] DEBUG user.sdr: lines=['{"time" : "2020-12-07 15:27:56", "model" : "Bresser-6in1", "id" : 411043787, "channel" : 0, "battery_ok" : 1, "sensor_type" : 1, "wind_max_m_s" : 0.200, "wind_avg_m_s" : 0.200, "wind_dir_deg" : 248, "rain_mm" : 80.800, "mic" : "CRC"}\n'] Dec 7 17:27:59 raspberrypi weewx[12220] DEBUG user.sdr: packet={'windDir': 248.0, 'windSpeed': 0.2, 'windGust': 0.2, 'outTemp': None, 'outHumidity': None, 'barometer': 1009.1999999999999, 'rain_total': 80.8, 'dateTime': 1607354876, 'usUnits': 17} 7 17:27:47 raspberrypi weewx[12220] DEBUG user.sdr: lines=['{"time" : "2020-12-07 15:27:44", "model" : "Bresser-6in1", "id" : 411043787, "channel" : 0, "battery_ok" : 1, "temperature_C" : 10.700, "humidity" : 97, "sensor_type" : 1, "wind_max_m_s" : 0.200, "wind_avg_m_s" : 0.200, "wind_dir_deg" : 248, "mic" : "CRC"}\n'] Dec 7 17:27:47 raspberrypi weewx[12220] DEBUG user.sdr: packet={'windDir': 248.0, 'windSpeed': 0.2, 'windGust': 0.2, 'outTemp': 10.7, 'outHumidity': 97.0, 'barometer': 1009.1999999999999, 'rain_total': None, 'dateTime': 1607354864, 'usUnits': 17}

Probably you will notice that in log the station appears like 6in1 .... i dont know why but i modified (with a big help of my friend) the sdr.py and returns bresser5in1.packets.... all the others values transmitted to weather sites without any problem... sensor map [SDR]

# This section is for the software-defined radio driver.    
# The driver to use
driver = user.sdr
cmd = /usr/local/bin/rtl_433 -M utc -F json -f 868.2M -R 172       
[[sensor_map]]        
    windDir = wind_dir.411043787.Bresser5in1Packet
    windSpeed = wind_speed.411043787.Bresser5in1Packet
    windGust = wind_gust.411043787.Bresser5in1Packet
    outTemp = temperature.411043787.Bresser5in1Packet
    outHumidity = humidity.411043787.Bresser5in1Packet
    barometer = pressure.411043787.Bresser5in1Packet         
    rain_total = rain_total.411043787.Bresser5in1Packet 
 [[deltas]]
    rain = rain_total

Thank you in advanced if any help provided

stefkal7 commented 3 years ago

[SOLVED] For Bresser 5in1 7002580 i leave it here if anyone needs it.... The Weewx conf file should be like

[[sensor_map]]
windDir = wind_dir.411043787.Bresser5in1Packet windSpeed = wind_speed.411043787.Bresser5in1Packet windGust = wind_gust.411043787.Bresser5in1Packet outTemp = temperature.411043787.Bresser5in1Packet outHumidity = humidity.411043787.Bresser5in1Packet
rain_total = rain_total.411043787.Bresser5in1Packet [[deltas]] rain = rain_total

and the sdr.py :

class Bresser5in1Packet(Packet): {"time" : "2020-11-21 14:17:00", "model" : "Bresser-6in1", "id" : 411043787, "channel" : 0, "battery_ok" : 1, "sensor_type" : 1, "wind_max_m_s" : 2.000, "wind_avg_m_s" : 1.700, "wind_dir_deg" : 68, "rain_mm" : 11.600, "mic" : "CRC"}

IDENTIFIER = "Bresser-6in1"

@staticmethod def parse_json(obj): pkt = dict()
pkt['dateTime'] = Packet.parse_time(obj.get('time')) pkt['usUnits'] = weewx.METRICWX pkt['station_id'] = obj.get('id') if 'temperature_C' in obj: pkt['temperature'] = Packet.get_float(obj, 'temperature_C') if 'humidity' in obj: pkt['humidity'] = Packet.get_float(obj, 'humidity')
pkt['wind_dir'] = Packet.get_float(obj, 'wind_dir_deg') pkt['wind_speed'] = Packet.get_float(obj, 'wind_avg_m_s') pkt['wind_gust'] = Packet.get_float(obj, 'wind_max_m_s')
if 'rain_mm' in obj: pkt['rain_total'] = Packet.get_float(obj, 'rain_mm')
return Bresser5in1Packet.insert_ids(pkt)

@staticmethod
def insert_ids(pkt):
    station_id = pkt.pop('station_id', '0000')
    pkt = Packet.add_identifiers(pkt, station_id, Bresser5in1Packet.__name__)
    return pkt

Greetings from Greece ..!!

ComradeTurtle commented 3 years ago

The problem has been solved for me too; I'll go ahead and close the issue.