Skip to content

Commit

Permalink
catch up
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwall committed Feb 12, 2022
2 parents 74910f6 + 885d5b6 commit bdb14ac
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
47 changes: 45 additions & 2 deletions bin/user/sdr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# Copyright 2016-2021 Matthew Wall
# Copyright 2016-2022 Matthew Wall
# Distributed under the terms of the GNU Public License (GPLv3)
"""
Collect data from stl-sdr. Run rtl_433 on a thread and push the output onto
Expand Down Expand Up @@ -140,7 +140,7 @@ def logerr(msg):
logmsg(syslog.LOG_ERR, msg)

DRIVER_NAME = 'SDR'
DRIVER_VERSION = '0.86'
DRIVER_VERSION = '0.87'

# The default command requests json output from every decoder
# Use the -R option to indicate specific decoders
Expand Down Expand Up @@ -988,6 +988,30 @@ def parse_json(obj):
return Packet.add_identifiers(pkt, _id, AcuriteWT450Packet.__name__)


class Acurite515Packet(Packet):

# refrigerator (XR) and freezer (XF) sensors
# X is one of A, B, or C
# "time" : "2022-01-21 21:55:54", "model" : "Acurite-515", "id" : 2375, "channel" : "BR", "battery_ok" : 1, "temperature_F" : 47.600, "mic" : "CHECKSUM"
# "time" : "2022-01-21 21:55:44", "model" : "Acurite-515", "id" : 78, "channel" : "BF", "battery_ok" : 1, "temperature_F" : 47.100, "mic" : "CHECKSUM"

IDENTIFIER = "Acurite-515"

@staticmethod
def parse_json(obj):
pkt = dict()
pkt['dateTime'] = Packet.parse_time(obj.get('time'))
pkt['usUnits'] = weewx.US
pkt['hardware_id'] = "%04x" % obj.get('id', 0)
pkt['channel'] = Packet.get_int(obj, 'channel')
pkt['battery'] = 0 if obj.get('battery_ok') == 1 else 1
if 'temperature_F' in obj:
pkt['temperature'] = Packet.get_float(obj, 'temperature_F')
elif 'temperature_C' in obj:
pkt['temperature'] = to_F(Packet.get_float(obj, 'temperature_C'))
return Packet.insert_ids(pkt, Acurite515Packet.__name__)


class AlectoV1TemperaturePacket(Packet):
# {"time" : "2018-08-29 17:07:34", "model" : "AlectoV1 Temperature Sensor", "id" : 88, "channel" : 2, "battery" : "OK", "temperature_C" : 27.700, "humidity" : 42, "mic" : "CHECKSUM"}

Expand Down Expand Up @@ -2169,6 +2193,25 @@ def parse_json(obj):
return pkt


class LaCrosseLTVR3Packet(Packet):

# "time" : "2022-01-16 04:43:25", "model" : "LaCrosse-R3", "id" : 7417878, "battery_ok" : 1, "seq" : 1, "rain_mm" : 10921.750, "rain2_mm" : 10921.750, "mic" : "CRC"

IDENTIFIER = "LaCrosse-R3"

@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['rain_total'] = Packet.get_float(obj, 'rain_mm')
pkt['rain2_total'] = Packet.get_float(obj, 'rain2_mm')
pkt['battery'] = 0 if obj.get('battery_ok') == 1 else 1
pkt = Packet.add_identifiers(pkt, sensor_id, LaCrosseLTVR3Packet.__name__)
return pkt


class RubicsonTempPacket(Packet):
# 2017-01-15 14:49:03 : Rubicson Temperature Sensor
# House Code: 14
Expand Down
4 changes: 4 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.87 21jan2021
* added support for Acurite515 refrigerator/freezer sensors
* added support for LaCross LTV-R3 rain sensor thanks to srhuston (#145)

0.86 11jan2021
* fixed typo in factor for THPacket (thanks gjr80)

Expand Down
4 changes: 2 additions & 2 deletions install.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# installer for the weewx-sdr driver
# Copyright 2016-2021 Matthew Wall
# Copyright 2016-2022 Matthew Wall
# Distributed under the terms of the GNU Public License (GPLv3)

from weecfg.extension import ExtensionInstaller
Expand All @@ -10,7 +10,7 @@ def loader():
class SDRInstaller(ExtensionInstaller):
def __init__(self):
super(SDRInstaller, self).__init__(
version="0.86",
version="0.87",
name='sdr',
description='Capture data from rtl_433',
author="Matthew Wall",
Expand Down
2 changes: 1 addition & 1 deletion readme
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
weewx-sdr
Copyright 2016-20212 Matthew Wall
Copyright 2016-2022 Matthew Wall
Distributed under terms of the GPLv3

This is a driver for weewx that captures data from software-defined radio.
Expand Down

0 comments on commit bdb14ac

Please sign in to comment.