Pull sensors from the fit file and display on activity

Thank you pepe, for your script.

My connection is Ant+

the name is?

In watch settings the name was 19320 and I have just modified it (on the watch) to ‘19320 VSense’ so that I know what it is. In About, the ID is 19320. In the fit file the ID is 24660856 (I don’t know why they don’t match).

One is Serial Number, the other is Ant+id, not all manufacturer implement all.

In watch setting, About device, it says Serial: - and in the fit file it also has a hyphen in the Serial number field. So I don’t know where that serial number is coming from.

Anyway, what to do now?

one is generic, the other is specific for ant+processing

in Activity>Custom>Activity FieldsAdd Field

Paste the code in SCRIPT
Give A Name, select Type as Text, check Process Fit File check box, chose units, and save.
The reprocess and analyze activity.

What do you mean choose units. I can’t see that in there


thats right

After reprocessing activity the activity field is still blank

Can’t see any of those Polar Verity Sense numbers in my fit file. Does that matter?

That the name that Polar likes to use and additional info to parse fit file in the conventional way

So do I need to put that info in the script or something? So far the script is not working for me.

{

for (let se of icu.fit.m_147) {
if ( se.f_52?.value !== 0) continue
console.log("se " +se)

let antid = se.f_0?.value
let name = se.f_2?.value

ssds = name + " "+ antid
break
ssds
}}

image

Wow, it works. Thank you!

A more polished version:

{
    let activesensor = ''; /* Active Sensor */
    let ssds = ''; // Declare ssds variable
    
    for (let di of icu.fit.device_info) {
        if (
            di.source_type?.value !== 1 /* Ant+ */ ||
            di.device_type?.value !== 120 /* Heart Rate Monitor */
        ) continue;

        activesensor = di.f_24?.value;

        for (let se of icu.fit.m_147) {
            
            if (se.f_0?.value !== activesensor || se.f_52?.value !== 0) continue;
            
            let antid = se.f_0?.value;
            let name = se.f_2?.value;

            ssds = (name ? " " + name : "") + (antid ? " " + antid : "");
            break;
        }
    }
    // ssds is now available here with the result
    ssds;
}
3 Likes

BTW, you can check also my beta Custom Activity Field: “HR Monitor S/N mod”, in the search field, search for mod.

2 Likes

Polar Verity Sense isn’t Ant+, it’s just BLE

Edit: sorry, it has also ant+. The reason I though it’s only BLE is that it doesn’t show up in my gym treadmill, which I believe uses gymlink, whereas my H10 shows up.

How is it possible that this script finds my HR monitor to be the H10, even though in this particular run I used the verity sense? I own both and like to vary. Can the H10 somehow be picked up from a passive field in my watch?

I have now the FR 965, and in my previous watch, the FR 945, the HR monitor field was picked up from a different field.