Please add to sdr.py

169 views
Skip to first unread message

raadi...@gmail.com

unread,
Oct 19, 2020, 7:10:35 PM10/19/20
to weewx-user
Hello! Recently discovered new weather station signal with json output
weewx[14512] DEBUG user.sdr: punt unrecognized line '{"time" : "2020-10-19 22:41:24", "model" : "WS2032", "id" : 11768, "temperature_C" : 3.800, "humidity" : 48, "wind_dir_deg" : 315.000, "wind_avg_km_h" : 7.740, "wind_max_km_h" : 15.480, "maybe_flags" : 0, "maybe_rain" : 256, "mic" : "CRC"}#012'. Can anybody add to sdr.py support of WS2032. Thanks!

Tom Keffer

unread,
Oct 19, 2020, 7:14:43 PM10/19/20
to weewx-user
A PR ("Pull Request") to the SDR github site is the most efficient way to do this.

Unfortunately, it looks like you'd have to get in line. There are quite a few PRs backed up.

On Mon, Oct 19, 2020 at 4:10 PM raadi...@gmail.com <raadi...@gmail.com> wrote:
Hello! Recently discovered new weather station signal with json output
weewx[14512] DEBUG user.sdr: punt unrecognized line '{"time" : "2020-10-19 22:41:24", "model" : "WS2032", "id" : 11768, "temperature_C" : 3.800, "humidity" : 48, "wind_dir_deg" : 315.000, "wind_avg_km_h" : 7.740, "wind_max_km_h" : 15.480, "maybe_flags" : 0, "maybe_rain" : 256, "mic" : "CRC"}#012'. Can anybody add to sdr.py support of WS2032. Thanks!

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/7b75c103-f6b3-4634-b3ba-970083d80ecdn%40googlegroups.com.

Andy

unread,
Oct 20, 2020, 10:24:21 AM10/20/20
to weewx-user
Try this. What are "maybe_rain" and "maybe_flags"?

Andy
sdr.py

raadi...@gmail.com

unread,
Oct 20, 2020, 2:25:53 PM10/20/20
to weewx-user
Hello! Well works like charm!
Oct 20 21:16:09 andy-HP-Compaq-dc7900-Convertible-Minitower weewx[17755] DEBUG user.sdr: lines=[u'{"time" : "2020-10-20 18:16:05", "model" : "WS2032", "id" : 11768, "temperature_C" : 0.500, "humidity" : 20, "wind_dir_deg" : 337.500, "wind_avg_km_h" : 0.000, "wind_max_km_h" : 0.000, "maybe_flags" : 0, "maybe_rain" : 256, "mic" : "CRC"}\n']
Oct 20 21:16:09 andy-HP-Compaq-dc7900-Convertible-Minitower weewx[17755] DEBUG user.sdr: packet={'dateTime': 1603217765, u'windDir': 337.5, u'windSpeed': 0.0, u'windGust': 0.0, u'rainRate': 256.0, 'usUnits': 16}
My weewx.conf added
[SDR]
    # This section is for the software-defined radio driver.
    
    # The driver to use
    driver = user.sdr
    # cmd = rtl_433 -g 19.7 -p -20 -f 433920000 -M utc -F json
    cmd = rtl_433 -d 1 -g 49.6 -p 50 -f 433920000 -M utc -F json
    path = /usr/local/bin
    ld_library_path = /usr/share/weewx/lib:/home/andy/rtl-sdr/build/src
    log_unknown_sensors = True
    log_unmapped_sensors = True
    [[sensor_map]]
        outTemp = temperature.1:None.TFATwinPlusPacket
        outHumidity = humidity.1:None.TFATwinPlusPacket
        outBatteryStatus = battery.1:None.TFATwinPlusPacket
        # humidity.1:none.TFATwinPlus303049Packet
        # temperature.1:None.TFATwinPlus303049Packet
          
        inTemp = temperature.1:5.HidekiTS04Packet
        
        # inBatteryStatus = battery.1:None.SolightTE44Packet
        # inHumidity = humidity.181.ProloguePacket
        # inBatteryStatus = battery.181.ProloguePacket
        # extraTemp1 = temperature.1:None.SolightTE44Packet
    windDir = wind_dir.11768.WS2032Packet
        windGust = wind_gust.11768.WS2032Packet
        rainRate = total_rain.11768.WS2032Packet
        windSpeed = wind_speed.11768.WS2032Packet


# inHumidity = humidity.1:5.HidekiTS04Packet
inBatteryStatus = battery.1:5.HidekiTS04Packet


By the way earlier I asked adding TFA - twinplus - on my weewx 4.11
i had to modify sdr.py like this for TFA - twinplus sensor
class TFATwinPlusPacket(Packet):
    # 2019-09-25 17:15:12 :   TFA-Twin-Plus-30.3049
    # Channel: 1
    # Battery: OK
    # Temperature: 8.40 C
    # Humidity: 91 %

    # {"time" : "2019-09-25 17:15:12", "model" : "TFA-Twin-Plus-30.3049", "id" : 13, "channel" : 1, "battery" : "OK", "temperature_C" : 8.400, "humidity" : 91, "mic" : "CHECK  SUM"}
   
    IDENTIFIER = "TFA-TwinPlus"
    PARSEINFO = {
        'Rolling Code': ['rolling_code', None, lambda x: int(x)],
        'Channel': ['channel', None, lambda x: int(x)],
        'Battery': ['battery', None, lambda x: 0 if x == 'OK' else 1],
        'Temperature': [
            'temperature', re.compile('([\d.-]+) C'), lambda x: float(x)],
        'Humidity': ['humidity', re.compile('([\d.]+) %'), lambda x: float(x)]}

    @staticmethod
    def parse_text(ts, payload, lines):
        pkt = dict()
        pkt['dateTime'] = ts
        pkt['usUnits'] = weewx.METRIC
        pkt.update(Packet.parse_lines(lines, TFATwinPlusPacket.PARSEINFO))
        return Hideki.insert_ids(pkt, TFATwinPlusPacket.__name__)

Original was
class TFATwinPlus303049Packet(Packet):
    # 2019-09-25 17:15:12 :   TFA-Twin-Plus-30.3049
    # Channel: 1
    # Battery: OK
    # Temperature: 8.40 C
    # Humidity: 91 %

    # {"time" : "2019-09-25 17:15:12", "model" : "TFA-Twin-Plus-30.3049", "id" : 13, "channel" : 1, "battery" : "OK", "temperature_C" : 8.400, "humidity" : 91, "mic" : "CHECK  SUM"}

    IDENTIFIER = "TFA-Twin-Plus-30.3049"
    PARSEINFO = {
        'Rolling Code': ['rolling_code', None, lambda x: int(x)],
        'Channel': ['channel', None, lambda x: int(x)],
        'Battery': ['battery', None, lambda x: 0 if x == 'OK' else 1],
        'Temperature': [
            'temperature', re.compile('([\d.-]+) C'), lambda x: float(x)],
        'Humidity': ['humidity', re.compile('([\d.]+) %'), lambda x: float(x)]}

    @staticmethod
    def parse_text(ts, payload, lines):
        pkt = dict()
        pkt['dateTime'] = ts
        pkt['usUnits'] = weewx.METRIC
        pkt.update(Packet.parse_lines(lines, TFATwinPlus303049Packet.PARSEINFO))
        return Hideki.insert_ids(pkt, TFATwinPlus303049Packet.__name__)

вторник, 20 октября 2020 г. в 17:24:21 UTC+3, Andy:
Reply all
Reply to author
Forward
0 new messages