tormoder / fit

A Go package for decoding and encoding Garmin FIT files
MIT License
243 stars 42 forks source link

Add BMI parameter to WeightScaleMsg #61

Closed davidkroell closed 2 years ago

davidkroell commented 3 years ago

Hi @tormoder,

I'd like to add the BMI parameter to the WeightScaleMsg, due to the issue here: https://github.com/davidkroell/bodycomposition/issues/9

I've conducted a first integration test with my utility davidkroell/bodycomposition and it works:

grafik (screenshot from Garmin Connect)

I wasn't able to fix the tests, could you help me out?

Regards,

David

tormoder commented 3 years ago

Hi @davidkroell.

I cant't find this field (for the WeightScaleMsg) in the official FIT profile (21.60). Should it be there?

davidkroell commented 3 years ago

Hi @tormoder,

I don't know if this is officially supported within this message. I've got this from there: https://github.com/jaroslawhartman/withings-sync/blob/4e96d96364b848c4222354ac904c55c5053d97f9/withings_sync/fit.py#L203-L221 and tried it out with Garmin Connect and it works.

tormoder commented 3 years ago

This repository uses the official SDK profile from Garmin (a sheet) to grenerate all code related to messages and fields. This means that we can't (and I don't want) to have any special handling of fields or message, since it will be overwritten when we generate code for a new profile. The only current exception is for errors in the profile sheet that causes code generation to fail.

I can't see a BMI field for the WeightScaleMsg scale message at all in the profile. So fields are listed there, but not enabled for the default profile. AFAICS this is not the case for BMI. I would be interested to know where the repo you listed got this information from.

But, since you are actively using this library, I would like to help you. I'll look into providing a separate branch for you. Give me a few days :-)

RobertWojtowicz commented 3 years ago

Hi, @tormoder

I came across this topic here (in search of a BMI synchronization solution): https://github.com/jaroslawhartman/withings-garmin-v2/pull/19/commits/a6d63b13f1dd172a71c46e0e8f2e0d58fd2ab412 https://github.com/jaroslawhartman/withings-garmin-v2/issues/16

There are other interesting fields (in search of a Caloric Intake synchronization solution): (7, FitBaseType.uint16, basal_met, 4), (9, FitBaseType.uint16, active_met, 4),

Best Regards, Robert

tormoder commented 3 years ago

Thanks for the input @RobertWojtowicz.

It seems to me, based on https://github.com/jaroslawhartman/withings-garmin-v2/issues/16, that this field is used by Garmin, but not documented in the SDK. I think there are other such examples elsewhere also (but it's a long time I've looked at such issues).

https://github.com/tormoder/fit/issues/6 is somewhat related.

The other two fields you mention is documented and enabled in the last (21.67) default profile:


weight_scale message

 | 253 | timestamp | date_time | 
 | 0 | weight | weight |
 | 1 | percent_fat | uint16 |
 | 2 | percent_hydration | uint16 |
 | 3 | visceral_fat_mass | uint16 |
 | 4 | bone_mass | uint16 | 
 | 5 | muscle_mass | uint16 |
 | 7 | basal_met | uint16 |
 | 8 | physique_rating | uint8 | 
 | 9 | active_met | uint16 |
 | 10 | metabolic_age | uint8 |
 | 11 | visceral_fat_rating | uint8 |
 | 12 | user_profile_index | message_index |
RobertWojtowicz commented 3 years ago

Hi, @tormoder

Are you planning to add that BMI field ? Is any of the basal_met or/and active_met parameters responsible for the Caloric Intake field ? Is it possible to add it somehow ?

tormoder commented 3 years ago

@davidkroell You can temporarily use the bodycomp-bmi branch if you want.

go get github.com/tormoder/fit@bodycomp-bmi

RobertWojtowicz commented 3 years ago

Hi, @davidkroell

can you create a new version bodycomposition with BMI ?

Best Regards, Robert

davidkroell commented 2 years ago

Hi guys,

a new release is available here: https://github.com/davidkroell/bodycomposition/releases/tag/v2.2.0.

@tormoder thanks for providing the branch.

RobertWojtowicz commented 2 years ago

Hi, @davidkroell @tormoder

It works, thank you very much :)

obraz

Only Caloric Intake is missing now (not working)

tormoder commented 2 years ago

Closing this, since this change now lives on a separate branch.

Supporting it for the main branch must be done via something like #62.

"Caloric Intake" can be added to the branch if that (hidden) field exsits and someone could provide the field definition.

tormoder commented 1 year ago

@davidkroell FYI, BMI is now available in the master branch. since Garmin (at some point) enabled it in the default profile.

https://github.com/tormoder/fit/blob/181a8ab4106bc8fc5f9edbbfdbe5be385abcdd93/messages.go#L4960

RobertWojtowicz commented 1 year ago

Hi, @davidkroell,

I know that the bodycomposition module is working well, but could you refresh it at your free time? based on the new versions of the libraries and include the master branch termoder?

BR, Robert

davidkroell commented 1 year ago

@RobertWojtowicz working on it.

Next time please open a issue at my repo instead (I've done it now for you). You can track status here: davidkroell/bodycomposition/issues/20