WMR200 now emits rain24 instead of dayRain

This commit is contained in:
Tom Keffer
2015-08-17 05:34:52 -07:00
parent df760204a5
commit 5cc0e71d64

View File

@@ -803,22 +803,23 @@ class PacketWind(PacketLive):
def decode_rain(pkt, pkt_data):
"""Decode the rain portion of a wmr200 packet."""
try:
# Bytes 0 and 1: high and low byte of the current rainfall rate
# Bytes 0 and 1: high and low byte encode the current rainfall rate
# in 0.01 in/h. Convert into metric.
rain_rate = (((pkt_data[1] & 0x0f) << 8) | pkt_data[0]) / 100.0 * 2.54
# Bytes 2 and 3: high and low byte of the last hour rainfall in 0.01in
# Bytes 2 and 3: high and low byte encode rain of the last hour in 0.01in
# Convert into metric.
rain_hour = ((pkt_data[3] << 8) | pkt_data[2]) / 100.0 * 2.54
# Bytes 4 and 5: high and low byte of the last day rainfall in 0.01in
# Bytes 4 and 5: high and low byte encode rain of the last 24 hours,
# excluding the current hour, in 0.01in
# Convert into metric.
rain_day = ((pkt_data[5] << 8) | pkt_data[4]) / 100.0 * 2.54
# Bytes 6 and 7: high and low byte of the total rainfall in 0.01in
# Bytes 6 and 7: high and low byte encode the total rainfall in 0.01in.
# Convert into metric.
rain_total = ((pkt_data[7] << 8) | pkt_data[6]) / 100.0 * 2.54
record = {'rainRate' : rain_rate,
'hourRain' : rain_hour,
'dayRain' : rain_day,
'rain24' : rain_day + rain_hour,
'totalRain' : rain_total}
if DEBUG_PACKETS_RAIN: