matthewwall / weewx-sdr

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

help with Acurite-606TX and Prologue-TH temperature sensors? #131

Closed mrneutron42 closed 3 years ago

mrneutron42 commented 3 years ago

I'm setting up weewx in a Raspberry Pi 3 at my lake cabin, and trying to read temperature data from neighbor's thermometers.

I'm calling sdr.py (ver.78) to try and figure out what the [[sensors map]] section of the weewx.conf file should contain: sudo PYTHONPATH=/home/weewx/bin python3 /home/weewx/bin/user/sdr.py --debug --cmd="rtl_433 -M utc -F json"

Does it look like sdr.py is not parsing the transmitted data. I wonder if these sensors are not know to rtl_433 or not know to sdr.py?

pi@pi3:/home/weewx $ sudo PYTHONPATH=/home/weewx/bin python3 /home/weewx/bin/user/sdr.py --debug --cmd="rtl_433 -M utc -F json" out:['{"time" : "2021-05-25 16:52:25", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.500, "humidity" : 56, "button" : 0}\n'] out:['{"time" : "2021-05-25 16:53:15", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.600, "humidity" : 54, "button" : 0}\n'] out:['{"time" : "2021-05-25 16:54:05", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.600, "humidity" : 54, "button" : 0}\n', '{"time" : "2021-05-25 16:54:06", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 24.800, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:54:37", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 24.800, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:54:55", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.600, "humidity" : 54, "button" : 0}\n'] out:['{"time" : "2021-05-25 16:55:08", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 25.000, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:55:45", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.600, "humidity" : 54, "button" : 0}\n'] out:['{"time" : "2021-05-25 16:56:35", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.600, "humidity" : 53, "button" : 0}\n'] out:['{"time" : "2021-05-25 16:56:41", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 25.000, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:57:25", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.700, "humidity" : 53, "button" : 0}\n', '{"time" : "2021-05-25 16:57:25", "model" : "GT-WT02", "id" : 144, "channel" : 2, "battery_ok" : 0, "temperature_C" : 1.500, "humidity" : 57.000, "button" : 0, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:58:15", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.700, "humidity" : 53, "button" : 0}\n', '{"time" : "2021-05-25 16:58:15", "model" : "GT-WT02", "id" : 144, "channel" : 2, "battery_ok" : 0, "temperature_C" : 1.500, "humidity" : 57.000, "button" : 0, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:59:05", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.700, "humidity" : 53, "button" : 0}\n', '{"time" : "2021-05-25 16:59:05", "model" : "GT-WT02", "id" : 144, "channel" : 2, "battery_ok" : 0, "temperature_C" : 1.500, "humidity" : 57.000, "button" : 0, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:59:47", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 25.200, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 16:59:55", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.800, "humidity" : 53, "button" : 0}\n'] out:['{"time" : "2021-05-25 17:00:18", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 25.200, "mic" : "CHECKSUM"}\n'] out:['{"time" : "2021-05-25 17:00:45", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "temperature_C" : 24.800, "humidity" : 53, "button" : 0}\n'] out:['{"time" : "2021-05-25 17:00:49", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 25.200, "mic" : "CHECKSUM"}\n']

mrneutron42 commented 3 years ago

I see there is already a reported issue and pull-request to add a class for the Acurite-606TX. https://github.com/matthewwall/weewx-sdr/issues/114 https://github.com/pii100/weewx-sdr/commit/d97609842afa97fe95cc558c4a27856b145af907

Now that I know what to look for, I just searched sdr.py for the Prologue-TH and did not see it. It needs a new class created for it, too.

mrneutron42 commented 3 years ago

I just added pii100's pull request code to my sdr.py and now the Acurite-606TX is getting parsed.

pi@pi3:/home/weewx $ sudo PYTHONPATH=/home/weewx/bin python3 /home/weewx/bin/user/sdr.py --debug --cmd="rtl_433 -R 55 -M utc -F json" out:['{"time" : "2021-05-25 22:44:24", "model" : "Acurite-606TX", "id" : 129, "battery_ok" : 1, "temperature_C" : 38.200, "mic" : "CHECKSUM"}\n'] parsed: {'dateTime': 1621982664, 'usUnits': 16, 'temperature.129.Acurite606TXPacket': 38.2, 'battery.129.Acurite606TXPacket': 1}

mrneutron42 commented 3 years ago

I added parser code to my sdr.py (ver.78) to read the Prologue-TH temperature sensor:

class ProloguePacketV2(Packet):

2021-05-25 : Prologue Temperature and Humidity Sensor

# {"time" : "2021-05-25 23:07:23", "model" : "Prologue-TH", "subtype" : 9, "id" : 9, "channel" : 1, "battery_ok" : 0, "tempe$

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('id')
    pkt['temperature'] = Packet.get_float(obj, 'temperature_C')
    pkt['humidity'] = Packet.get_float(obj, 'humidity')
    pkt['battery'] = 0 if obj.get('battery_ok') == '1' else 1
    pkt['channel'] = obj.get('channel')
    pkt['button'] = obj.get('button')
    pkt = Packet.add_identifiers(pkt, sensor_id, ProloguePacket.__name__)
    return pkt

Then, I added "ProloguePacketV2" to the KNOWN_PACKETS list in this section of sdr.py:

class PacketFactory(object):

KNOWN_PACKETS = [
    ProloguePacketV2,
]