Hi Andy,

try this one (untesteted):

-------------------------------
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__)

    @staticmethod
    def parse_json(obj):
        pkt = dict()
        pkt['dateTime'] = Packet.parse_time(obj.get('time'))
        pkt['usUnits'] = weewx.METRIC
        pkt['rolling_code'] = obj.get('rc')
        pkt['channel'] = obj.get('channel')
        pkt['temperature'] = Packet.get_float(obj, 'temperature_C')
        pkt['humidity'] = Packet.get_float(obj, 'humidity')
        pkt['battery'] = 0 if obj.get('battery') == 'OK' else 1
        return Hideki.insert_ids(pkt, TFATwinPlus303049Packet.__name__) 
---------------------------------------------

and add this 

TFATwinPlus303049Packet

under 
class PacketFactory(object): 


Michael


Am Mittwoch, 25. September 2019 19:29:10 UTC+2 schrieb Andrei Volkov:
>
> Hello!
> After long work with setting weewx with sdr I had to add to configuration 
> path for rtl_433(running ubuntu 14.04). It started working and I discovered 
> that weewx doesnt support my outside temp/humidity sensor.
> Json format output from it
> {"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" : "CHECKSUM"}
> For somebody tring to tune weewx
> my addons for weewx.conf(/etc/weewx/weewx.conf)
> [SDR]
>     # This section is for the software-defined radio driver.
>     
>     # The driver to use
>     driver = user.sdr
>     cmd = rtl_433 -g 19.7 -p -100 -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
>     
>
>
> and path settings running sdr.py with python wich finally worked
>
> sudo PYTHONPATH=/usr/share/weewx python /etc/weewx/bin/user/sdr.py 
> --cmd="rtl_433 -g 19.7 -p -100 -f 433920000 -M utc -F json -R 31"
>
> Best Wishes!
> Andy
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/d717c6b8-4501-45fc-b95f-3f903383d01a%40googlegroups.com.

Reply via email to