matthewwall / weewx-sdr

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

Acurite Atlas - strike_count & strike_distance in sdr.py parser? #128

Closed mrneutron42 closed 2 years ago

mrneutron42 commented 3 years ago

The Acurite Atlas has an optional lightning sensor that can be bought and installed. When you have the lightning sensor, the Atlas transmits that lightning data in the variables: 'strike_count' and 'strike_distance' out:['{"time" : "2021-04-27 19:55:47", "model" : "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 0, "battery_ok" : 1, "message_type" : 37, "wind_avg_mi_h" : 0.000, "temperature_F" : 68.000, "humidity" : 42, "strike_count" : 3, "strike_distance" : 0, "exception" : 0, "raw_msg" : "c011650088b8aa006080"}\n', '{"time" : "2021-04-27 19:55:47", "model" : "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 1, "battery_ok" : 1, "message_type" : 37, "wind_avg_mi_h" : 0.000, "temperature_F" : 68.000, "humidity" : 42, "strike_count" : 3, "strike_distance" : 0, "exception" : 0, "raw_msg" : "c411650088b8aa006084"}\n', '{"time" : "2021-04-27 19:55:47", "model" : "Acurite-Atlas", "id" : 17, "channel" : "A", "sequence_num" : 2, "battery_ok" : 1, "message_type" : 37, "wind_avg_mi_h" : 0.000, "temperature_F" : 68.000, "humidity" : 42, "strike_count" : 3, "strike_distance" : 0, "exception" : 0, "raw_msg" : "c811650088b8aa006088"}\n']

I don't see these 2 variables in the Acurite Atlas parser section of sdr.py.

class AcuriteAtlasPacket(Packet):
    # {"time": "2019-12-14 16:56:57", "model": "Acurite-Atlas", "id": 896, "channel": "A", "sequence_num": 0, "battery_ok": 1, "message_type": 37, "wind_avg_mi_h": 5.000, "temperature_F": 40.000, "humidity": 76, "byte8": 0, "byte9": 37, "byte89": 37}
    # {"time": "2019-12-14 16:57:07", "model": "Acurite-Atlas", "id": 896, "channel": "A", "sequence_num": 0, "battery_ok": 1, "message_type": 38, "wind_avg_mi_h": 6.000, "wind_dir_deg": 291.000, "rain_in": 0.290, "byte8": 0, "byte9": 37, "byte89": 37}}
    # {"time": "2019-12-14 16:57:58", "model": "Acurite-Atlas", "id": 896, "channel": "A", "sequence_num": 0, "battery_ok": 1, "message_type": 39, "wind_avg_mi_h": 6.000, "uv": 0, "lux": 22900, "byte8": 0, "byte9": 37, "byte89": 37}

    # for battery, 0 means OK (assuming that 1 for battery_ok means OK)
    # message types: 37, 38, 39
    #   37: wind_avg_mi_h, temperature_F, humidity
    #   38: wind_avg_mi_h, wind_dir_deg, rain_in
    #   39: wind_avg_mi_h, uv, lux

    IDENTIFIER = "Acurite-Atlas"

    @staticmethod
    def parse_json(obj):
        pkt = dict()
        pkt['usUnits'] = weewx.US
        pkt['dateTime'] = Packet.parse_time(obj.get('time'))
        pkt['model'] = obj.get('model')
        pkt['hardware_id'] = "%04x" % obj.get('id', 0)
        pkt['channel'] = obj.get('channel')
        pkt['sequence_num'] = Packet.get_int(obj, 'sequence_num')
        pkt['message_type'] = Packet.get_int(obj, 'message_type')
        if 'temperature_F' in obj:
            pkt['temperature'] = Packet.get_float(obj, 'temperature_F')
        if 'humidity' in obj:
            pkt['humidity'] = Packet.get_float(obj, 'humidity')
        if 'wind_avg_mi_h' in obj:
            pkt['wind_speed'] = Packet.get_float(obj, 'wind_avg_mi_h')
        if 'wind_dir_deg' in obj:
            pkt['wind_dir'] = Packet.get_float(obj, 'wind_dir_deg')
        if 'rain_in' in obj:
            pkt['rain_total'] = Packet.get_float(obj, 'rain_in')
        if 'uv' in obj:
            pkt['uv'] = Packet.get_int(obj, 'uv')
        if 'lux' in obj:
            pkt['lux'] = Packet.get_int(obj, 'lux')
        pkt['battery'] = 1 if Packet.get_int(obj, 'battery_ok') == 0 else 0
        return Acurite.insert_ids(pkt, AcuriteAtlasPacket.__name__)

I see there is a pull-request to add this exact support. https://github.com/matthewwall/weewx-sdr/pull/89

Is it going to get approved and merged soon? Thanks.

mrneutron42 commented 3 years ago

These lightning variables must be getting addressed somewhere else in the system, because I AM getting the lightning data from parsed variables: strike_count.0011.AcuriteAtlasPacket strike_distance.0011.AcuriteAtlasPacket

Ve2mrx commented 3 years ago

I would like this issue reopened, adding #89 worked for me, didn't before.

matthewwall commented 2 years ago

MR89 has been merged into master