utilities/gadgetbridge_to_influxdb#10: Test Blood Oxygen Support

Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.4
Created: 26-Aug-23 16:55


In upstream 3249 Jose has mentioned that it's possible to enable SpO2 tracking


The script already has code in it to fetch stuff from the HUAMI_SPO2_SAMPLE table, so well worth trying.

Toggle State Changes


assigned to @btasker


ben@optimus:~$ adb shell
chiron:/ $ am broadcast \
> -a "nodomain.freeyourgadget.gadgetbridge.action.SET_DEVICE_SETTING" \
> -e "device" "<redacted>" \
> -e "key" "zepp_os_experimental_features" \
> -e "value" "true"
Broadcasting: Intent { act=nodomain.freeyourgadget.gadgetbridge.action.SET_DEVICE_SETTING flg=0x400000 (has extras) }
Broadcast completed: result=0

Had done a manual blood oxygen measurement on the watch, but nothing came through.

It's because I hadn't enabled intents for the device:

  • In GB, hit the 3 dots
  • Choose Preferences
  • Toggle Allow 3rd part apps to change settings

Then re-ran the am broadcast.

This time when hitting Sync in GB, I saw "Fetching SpO2 data" flash up.

Running the script retrieved the data, but looks like this uses ms timestamps too

strconv.ParseInt: parsing \"1693069035000000000000\": value out of range dropped=0"}

mentioned in commit 8ec93500d745ca2124865b76265b058fa990a2cd

Commit: 8ec93500d745ca2124865b76265b058fa990a2cd 
Author: B Tasker                            
Date: 2023-08-26T18:31:09.000+01:00 


SpO2 data uses ms timestamps (utilities/gadgetbridge_to_influxdb#10)

+10 -3 (13 lines changed)

With that fix in place, the following

SELECT mean("spo2") AS "mean_spo2" 
FROM "testing_db"."autogen"."gadgetbridge" WHERE time > :dashboardTime: AND time < :upperDashboardTime: GROUP BY time(:interval:) FILL(null)

Has successfully retrieved my measurement. In theory, the watch should automatically take some measurements overnight as well.

Checking this morning, the watch hasn't taken any automatic measurements - I guess that feature's not active on the watch. Unfortunately, there isn't an option (in GB or on the watch) to enable it.

Looking in the DB though, I can actually see historic values in there from manual samples too

sqlite> select * from HUAMI_SPO2_SAMPLE;

I've come up with a crazy plan to try and enable the feature, at least for long enough to test, so I'll hold this open for the time being.

I played around in the Zepp app, but couldn't find an option to enable automatic SpO2 readings (I was sure I'd seen one though).

Useful point of info: Gadgetbridge only updates config items that it knows about, so changes made via Zepp can persist.

I'm going to close this as done: the SpO2 support that the watch has seems to be working just fine.

mentioned in issue #16