project Utilities / zepp_to_influxdb avatar

Utilities / zepp_to_influxdb: 8dceade9




Record SPO2 level from click events (utilities/zepp_to_influxdb#6)

Record SPO2 level from click events (utilities/zepp_to_influxdb#6)

The event does also have a spo2_history attribute, but it's not currently understood what the meaning/granularity of this is, so it's not being captured

Commit 8dceade9.

Authored 2023-08-08T18:08:51.000+01:00 by B Tasker in project Utilities / zepp_to_influxdb

+20 lines -0 lines

Commit Signature

Changes

diff --git a/app/mifit_to_influxdb.py b/app/mifit_to_influxdb.py
--- a/app/mifit_to_influxdb.py
+++ b/app/mifit_to_influxdb.py
# @@ -480,10 +480,30 @@ def get_blood_oxygen_data(auth_info, config):
# rows.append(processODIEvent(blood))
# elif blood['subType'] == "osa_event":
# rows.append(processOSAEvent(blood))
# + elif blood['subType'] == "click":
# + rows.append(processBloodClickEvent(blood))
#
#
# return rows
#
# +def processBloodClickEvent(record):
# + ''' Process a "click" event
# +
# + This appears to be the user manually triggering a blood
# + oxygen reading from the watch/band (utilities/zepp_to_influxdb#6)
# + '''
# + extra = json.loads(record['extra'])
# + return {
# + "timestamp": int(record['timestamp']) * 1000000, # Convert to nanos
# + "fields" : {
# + "spo2_level" : float(extra['spo2']),
# + },
# + "tags" : {
# + "blood_event" : "manual_read"
# + }
# + }
# +
# +
# def processOSAEvent(record):
# ''' Process a possible Obstructive Sleep Apnea event
# '''
#