$fd(steps)$ not displaying correctly KWGT


So I have a widget that access the walking data of Google Fit using ‘$fd(steps)$’. However, I have seen that the steps are extremely delayed (6-7 hours) even with fast updates mode enabled. I have also found that it occasionally tally up the steps over 2 days and doesn’t refresh correctly.

I was wondering if there was a work around this?

I have also noticed that the steps with the formula $fd(steps)$ are not read out correctly.
I use Samsung Health and the Health Connect connection for tracking (KWGT has switched from Google Fit to Health Connect in v3.75).

I have found a workaround for myself. For me, $fd(steps)$ is shifted forward by 2 hours. With the formula $fd(steps, a0d2h, a0d2h)$ I get nearly the correct current value (the value always differs between 1-20 steps from the value in Samsung Health).

The past days can also be tracked in this way. Here is an example of the formulas for yesterday and the day before yesterday:
Yesterday: $fd(steps, r0d22h, r0d22h)$
Day before Yesterday: $fd(steps, r1d22h, r1d22h)$

Here is a screenshot of the formulas.
$gv(StepsSH)$ is a global variable that gets the correct step value from the Samsung Health notification.

1 Like

Hey thank you so much for this. I was wondering how you figured out how many hours it was shifted by?

I noticed that a few hundred steps are displayed shortly after midnight, although the correct number of steps should actually be 0. That’s why I thought that maybe a few steps from the previous day were being counted. Then I tried a bit with the formula until the values matched.

I see, thank you so much. I was wondering if you had to do anything special for it to work off Samsung Health other than enable data sharing for Health Connect? As I cant seem to get my widget updating when I use Samsung Health with Health Connect, whereas it works with Google Fit with Health Connect.

You have to do two things. Firstly, you must allow access to KWGT and Samsung Health in Health Connect.

Secondly, the connection to health Connect must be activated in the Samsung Health settings.

If this still does not work for you, you can try the following workaround.
Activate the permanent notification of steps in the Samsung Health settings.

You can then use the following formula in KWGT to extract the number of steps from the permanent notification:

$tc(split,ni(s+if(ni(s0, pkg)=com.sec.android.app.shealth, 0, ni(s1, pkg)=com.sec.android.app.shealth, 1, ni(s2, pkg)=com.sec.android.app.shealth, 2, ni(s3, pkg)=com.sec.android.app.shealth, 3, ni(s4, pkg)=com.sec.android.app.shealth, 4, ni(s5, pkg)=com.sec.android.app.shealth, 5, ni(s6, pkg)=com.sec.android.app.shealth, 6, ni(s7, pkg)=com.sec.android.app.shealth, 7), title), " ",0)$

The only disadvantage of this workaround is that the Samsung Health notification is permanently displayed in the notifications. If you swipe it away, the formula will no longer work. If this happens to you by mistake, just open Samsung Health. The notification will then appear again.