Weewx SDR - Can anyone tell me what I'd put in the [[sensor_map]] section for this packet?

86 views
Skip to first unread message

Stephen Hocking

unread,
Sep 1, 2021, 11:05:33 PM9/1/21
to weewx-user
Hi all,

I'm attempting to pull data off two sources at once via the SDR driver - an Acurite (which works) and an el-cheapo device for the inside temperature & humidity which puts out packets that look like this:

out:[u'{"time" : "2021-09-02 02:57:42", "model" : "Prologue-TH", "subtype" : 5, "id" : 70, "channel" : 3, "battery_ok" : 1, "temperature_C" : 22.300, "humidity" : 42, "button" : 0}\n', u'{"time" : "2021-09-02 02:57:42", "model" : "TFA-TwinPlus", "id" : 10, "channel" : 1, "battery_ok" : 1, "temperature_C" : -25.100, "humidity" : 51, "mic" : "CHECKSUM"}\n']

In my [[sensor_map]] entries, I have for this device (Acurite stuff elided)

        inTemp = temperature_C.0046.PrologueTHPacket
        inHumidity = humidity.0046.PrologueTHPacket

What am I doing wrong?

gjr80

unread,
Sep 1, 2021, 11:50:50 PM9/1/21
to weewx-user
Unless you are using a modified version of the the SDR driver it should be .ProloguePacket not .PrologueTHPacket.

You will likely have to modify the SDR driver code (sdr.py circa line 2278) as follows so that it will decode your Prologue sensor data:

class ProloguePacket(Packet):
    # 2017-03-19 : Prologue Temperature and Humidity Sensor
    # {"time" : "2017-03-15 20:14:19", "model" : "Prologue sensor", "id" : 5, "rid" : 166, "channel" : 1, "battery" : "OK", "button" : 0, "temperature_C" : -0.700, "humidity" : 49}

    IDENTIFIER = "Prologue-TH"

    @staticmethod
    def parse_json(obj):
        pkt = dict()
        pkt['dateTime'] = Packet.parse_time(obj.get('time'))
        pkt['usUnits'] = weewx.METRIC
        sensor_id = obj.get('rid')
        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
        pkt['channel'] = obj.get('channel')
        pkt = Packet.add_identifiers(pkt, sensor_id, ProloguePacket.__name__)
        return pkt



Gary

Stephen Hocking

unread,
Sep 2, 2021, 6:32:32 AM9/2/21
to weewx...@googlegroups.com
Hi Gary,

Thanks for this. It looks as if the device I have is either a knock-off of the original Prologue or a later version. I reckon creating an extra function will sort it, as there are  a few irritating small differences between the messages that each pushes out. I'll have to familiarise myself with the GitHub workflow to pull & push changes to someone else's code.. I've also discovered that I can bodge a shellscript together that will pull the pressure off the simple webpage that the Acurite Atlas hub displays (why they didn't publish a JSON page with the data on the thing is beyond me...) 

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/WE_o14sb8BE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/a5fd73e3-d783-4118-af25-275dc294679an%40googlegroups.com.


--
  "I and the public know
  what all schoolchildren learn
  Those to whom evil is done
  Do evil in return"		W.H. Auden, "September 1, 1939"

Reply all
Reply to author
Forward
0 new messages