Skip to content

Commit

Permalink
add battery voltage for WS80 thanks to fankyy matthewwall#153
Browse files Browse the repository at this point in the history
  • Loading branch information
andylittle committed Jul 7, 2022
1 parent 54e899d commit 6041a43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 8 additions & 14 deletions bin/user/sdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def to_in(v):
v /= 25.4
return v

def to_v(v):
if v is not None:
v /= 1000
return v

class AsyncReader(threading.Thread):

Expand Down Expand Up @@ -1834,9 +1838,9 @@ def insert_ids(pkt):


class FOWS80Packet(Packet):
# This is for a Fine Offset Electronics WS80 weather station

#{"time" : "2022-07-06 21:06:18", "model" : "Fineoffset-WS80", "id" : 589862, "battery_ok" : 1.170, "battery_mV" : 3280, "temperature_C" : 17.700, "humidity" : 67, "wind_dir_deg" : 268, "wind_avg_m_s" : 1.300, "wind_max_m_s" : 1.800, "uvi" : 0.000, "light_lux" : 0.000, "flags" : 170, "mic" : "CRC"}

#{"time" : "2022-07-06 21:06:18", "model" : "Fineoffset-WS80", "id" : 589862, "battery_ok" : 1.170, "battery_mV" : 3280, "temperature_C" : 17.700, "humidity" : 67, "wind_dir_deg" : 268, "wind_avg_m_s" : 1.300, "wind_max_m_s" : 1.800, "uvi" : 0.000, "light_lux" : 0.000, "flags" : 170, "mic" : "CRC"}

IDENTIFIER = "Fineoffset-WS80"

Expand All @@ -1854,8 +1858,8 @@ def parse_json(obj):
pkt['rain_total'] = Packet.get_float(obj, 'rainfall_mm')
pkt['uv_index'] = Packet.get_float(obj, 'uvi')
pkt['light'] = Packet.get_float(obj, 'light_lux')
#pkt['battery'] = 0 if obj.get('battery') == 'OK' else 1
#pkt['some voltage'] = Packet.get_float(obj, 'battery_mV')
#pkt['battery'] = 0 if obj.get('battery_ok') == 1 else 1
pkt['voltage'] = to_v(Packet.get_float(obj, 'battery_mV'))
return FOWS80Packet.insert_ids(pkt)

@staticmethod
Expand All @@ -1864,16 +1868,6 @@ def insert_ids(pkt):
return Packet.add_identifiers(pkt, station_id, FOWS80Packet.__name__)












class AuriolHG02832Packet(Packet):
IDENTIFIER = "Auriol-HG02832"

Expand Down
6 changes: 6 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.90 07jul2022
* add battery voltage for WS80 thanks to fankyy (#153)

0.90 06jul2022
* add json pars section for WS80 thanks to fankyy (#153)

0.90 22jun2022
* add json pars section for Kedsum-TH thanks to user Sar6e (#157)

Expand Down

0 comments on commit 6041a43

Please sign in to comment.