Skip to content

Commit

Permalink
Merge pull request matthewwall#26 from mlfreeman2/data-make-6045
Browse files Browse the repository at this point in the history
JSON support for 6045m
  • Loading branch information
matthewwall authored Jul 6, 2018
2 parents 6f377e5 + 80c2277 commit 3f186ab
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion bin/user/sdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,29 @@ class AcuriteLightningPacket(Packet):
# 2016-11-04 04:43:22 Acurite lightning 0x536F Ch A Msg Type 0x51: 15 C 58 % RH Strikes 55 Distance 69 - c0 53 6f 3a d1 0f b7 c5 18
# 2017-01-16 02:37:39 Acurite lightning 0x526F Ch A Msg Type 0x11: 67 C 38 % RH Strikes 47 Distance 81 - dd 52* 6f a6 11 c3 af d1 98*

IDENTIFIER = "Acurite lightning"
# April 21, 2018 - JSON support
# {"time" : "2018-04-21 19:12:53", "model" : "Acurite Lightning 6045M", "id" : 151, "channel" : "C", "temperature_F" : 66.900, "humidity" : 33, "strike_count" : 47, "storm_dist" : 12, "active" : 1, "rfi" : 0, "ussb1" : 1, "battery" : "LOW", "exception" : 0, "raw_msg" : "0097af2150f9afcc2b"}
IDENTIFIER = "Acurite Lightning 6045M"
PATTERN = re.compile('0x([0-9a-fA-F]+) Ch (.) Msg Type 0x([0-9a-fA-F]+): ([\d.-]+) ([CF]) ([\d.]+) % RH Strikes ([\d]+) Distance ([\d.]+)')

@staticmethod
def parse_json(obj):
pkt = dict()
pkt['dateTime'] = Packet.parse_time(obj.get('time'))
pkt['usUnits'] = weewx.US
pkt['channel'] = obj.get('channel')
pkt['hardware_id'] = "%04x" % obj.get('id', 0)
pkt['temperature'] = obj.get('temperature_F')
pkt['battery'] = obj.get('battery')
pkt['humidity'] = obj.get('humidity')
pkt['active'] = obj.get('active')
pkt['rfi'] = obj.get('rfi')
pkt['ussb1'] = obj.get('ussb1')
pkt['exception'] = obj.get('exception')
pkt['strikes_total'] = obj.get('strike_count')
pkt['distance'] = obj.get('storm_dist')
return Acurite.insert_ids(pkt, AcuriteLightningPacket.__name__)

@staticmethod
def parse_text(ts, payload, lines):
pkt = dict()
Expand Down

0 comments on commit 3f186ab

Please sign in to comment.