timoschlueter / nightscout-librelink-up

Script written in TypeScript that uploads CGM readings from LibreLink Up to Nightscout.
MIT License
192 stars 246 forks source link

Support for mmol/L units #16

Closed timoschlueter closed 2 years ago

timoschlueter commented 2 years ago

Right now, the upload uses the ".Value"-Field from the response object. This is bad, since the value might either be in mmol/L or mg/dL, depending on the users LibreLink setup.

Fortunately, the value also returns an attribute called ".ValueInMgPerDl". This is always mg/dL, no matter what the use has configured. Therefore we should switch to this attribute.

timoschlueter commented 2 years ago

example response:

"glucoseMeasurement": {
  "FactoryTimestamp": "1/24/2022 6:43:54 PM",
  "Timestamp": "1/24/2022 7:43:54 PM",
  "type": 1,
  "ValueInMgPerDl": 123,
  "TrendArrow": 3,
  "TrendMessage": null,
  "MeasurementColor": 1,
  "GlucoseUnits": 1,
  "Value": 123,
  "isHigh": false,
  "isLow": false
},