Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add battery parameter to WH25 #33

Closed
StephenR0 opened this issue Nov 3, 2018 · 1 comment
Closed

Add battery parameter to WH25 #33

StephenR0 opened this issue Nov 3, 2018 · 1 comment

Comments

@StephenR0
Copy link

In this thread:

https://groups.google.com/forum/#!topic/rtl_433/nsZsA7Boggw

it was discovered that the WH25 sensor has a battery low bit. Could that be added to sdr.py? I'm using this. Thanks.


class FOWH25Packet(Packet):
    # 2018-10-09 19:45:12 :   Fine Offset Electronics, WH25
    # id : 21
    # temperature_C : 20.900
    # humidity : 65
    # pressure_hPa : 980.400
    # battery : OK
    # mic : CHECKSUM

    # {"time" : "2018-10-10 13:37:11", "model" : "Fine Offset Electronics, WH25", "id" : 21, "temperature_C" : 21.600, "humidity" : 66, "pressure_hPa" : 972.800, "battery" : "OK", "mic" : "CHECKSUM"}
    IDENTIFIER = "Fine Offset Electronics, WH25"

    @staticmethod
    def parse_json(obj):
        pkt = dict()
        pkt['dateTime'] = Packet.parse_time(obj.get('time'))
        pkt['usUnits'] = weewx.METRIC
        pkt['station_id'] = obj.get('id')
        pkt['temperature'] = Packet.get_float(obj, 'temperature_C')
        pkt['humidity'] = Packet.get_float(obj, 'humidity')
        pkt['pressure'] = Packet.get_float(obj, 'pressure_hPa')
        pkt['battery'] = 0 if obj.get('battery') == 'OK' else 1
        return FOWH25Packet.insert_ids(pkt)

    @staticmethod
    def insert_ids(pkt):
        station_id = pkt.pop('station_id', '0000')
        pkt = Packet.add_identifiers(pkt, station_id, FOWH25Packet.__name__)
        return pkt
@matthewwall
Copy link
Owner

patch applied at commit c34b556. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants