Delubear / GlucoseTray

Tray Icon for displaying current BG information in taskbar.
MIT License
35 stars 21 forks source link

Nightscout Readings wrong when using MMOL/L #52

Closed sgmoore closed 3 years ago

sgmoore commented 3 years ago

I don't think the 5b6a2bebc4e0dc8f73fa48d311db3ce8ea950831 commit Now query nightscout to see what type of value it is sending us is correct.

Certainly does not work for me and reports my blood sugar to be 18 times higher than they really are. (I've reverted to a previous build, which works fine).

My nightscout is setup using MMOL/L but the api figures are always returned in mg/dl. (Can't find any official confirmation / documentation on this, but another user has confirmed it is the same for him).

Related to this, regarding your comment

// 25 MMOL is > 540 MG, most readers wont go below 40 or above 400.
// Catch any full value MMOL readings that may be perfect integers that are delivered without a '.', i.e., 7.0 coming in as just 7
// TODO: Need to investigate if the (value <= 30) check is needed. Any Nightscout-MMOL users able to verify? See above line for reasoning.
   if (value.ToString().Contains(".") || value <= 30) 

Only speaking from my own case, but that block of code has never been executed. Firstly, as stated, my figures are returned in mg/dl and so have never contained any decimal points. Secondly I have never got any results of 30 or below. My readings are sourced from a FreeStyle libre and looking at the figures when I have had a bad low, I would be fairly sure that this never returns figures below 2.1 mmol/l or 38 mg/dl. I have had a manual finger prick reading of 1.9 mmol/l or 34 mg/dl but that isn't recorded in Nightscout (and is still is above the 30 theshold)

However issue https://github.com/Delubear/GlucoseTray/issues/50 would make me wary of assuming that this is the case for everyone, as that bug was from one of my prs, but the strange thing is, that url works for me! (The fixed url also works). The data is returned in slightly different format (json rather than what looks like plain text), but it is still returned, so I'm not sure why it doesn't work for others.

Delubear commented 3 years ago

Ah, if the /status API is giving incorrect info, I can revert that. I had mine set to mg/dl so I assumed it was working.

So if Nightscoout is configured to be mmol, it still sends readings as MG/dl? If so, that at least makes programming for Nightscout easier.

I will get these changes in. Thanks

Delubear commented 3 years ago

Ah, here it is. It's from the nightscout variables in the config:

DISPLAY_UNITS

Not sure what its exactly used for since its independent from the settings on the main nightscout page. Might be for telling it what sort of unit you're expected from your datasource.

Delubear commented 3 years ago

Going to assume we get data from the server as MG/DL. Then provide a setting to switch it to MMOL if people notice it is incorrect.

Delubear commented 3 years ago

Version 11.1.0 should be deploying soon with fixes for this.

Delubear commented 3 years ago

https://github.com/Delubear/GlucoseTray/releases/tag/11.1.0

sgmoore commented 3 years ago

Thanks, that is working for me now.