nightscout / cgm-remote-monitor

nightscout web monitor
GNU Affero General Public License v3.0
2.42k stars 71.76k forks source link

LibreLink Up Uploader/Importer for Freestyle Libre 2 and 3 #7272

Open timoschlueter opened 2 years ago

timoschlueter commented 2 years ago

Happy new year everyone. A few days ago I published a new sidecar application written in JavaScript to GitHub which allows anyone to import LibreLink Up glucose measurements to a Nightscout instance. It pulls data periodically and makes it available in Nightscout. It pulls current glucose measurements and also backfills data based on the graph data thats shown in the LibreLink Up app.

The application uses the (undocumented) LibreLink Up API and supports FreeStyle Libre 2 and 3. All thats required is a (free) LibreLink Up account which you share your glucose measurement with. I myself created a separate LibreLink Up account and shared the data from my main account thats configured in the Libre 3 app with this new LLUP account.

You can find the repository and documentation here: https://github.com/timoschlueter/nightscout-librelink-up The application is also available as a docker image.

Contributions and feedback is highly appreciated :)

sebdei commented 2 years ago

You are so awesome! After some troubleshooting with nightscouts api-secret header and it's reverse proxy config in their docker-compose file I got it to work on a local dev setup.

Thanks to you I can finally look up my glucose level on the apple watch :-) Would be a pleasure to me to contribute and to enhance your project piece by piece!

timoschlueter commented 2 years ago

Thank you @sebdei! Having my Libre measurements on the Apple Watch was actually my motivation in the first place. Glad that it works for you too! Looking forward to your contributions :)

cubybox commented 2 years ago

Your application is a dream - I've been looking for it for a long time. Now I can finally do what I want with the data from my Libre 3 and use it for solutions that make my life easier and safer. I thank you very much for that!

HipstamaticPhoto-663878857 907856

HipstamaticPhoto-663879092 091510

timoschlueter commented 2 years ago

Thank you @cubybox! Means a lot. :)

mbdiab commented 2 years ago

trying to get my bg on my garmin devices. First I need to get them on nightscout....... Is it possible to add a step by step documentation?

PinkPanter commented 2 years ago

Hello @timoschlueter, I successfully deployed LibreLink Up Uploader, but Nightscout shows something like - 6.6?? ✖︎, and shows only the last value.

However if I go to server-adress/api/v1/entries I see all entries "2022-01-24T15:30:57.000Z" 1643038257000 6.6 "Flat"
"2022-01-24T15:29:57.000Z" 1643038197000 6.6 "Flat" etc...

Last Nightscout version 14.2.5, last LibreLink Up Uploader version, have no idea what can go wrong. Maybe it's all about the difference between mg/Dl and mmol/L, cause I see only mg/Dl in this thread, but I use to see mmols, any ideas?

image

timoschlueter commented 2 years ago

@PinkPanter i will look into this. You could be right. I am using mg/dl myself and haven't tested mmol/L, because my sensor is not configured for that. I will post an update as soon as I found a solution!

timoschlueter commented 2 years ago

@PinkPanter I just released version 1.4.0 of the LibreLink Up Uploader. This version should work for you now. :)

PinkPanter commented 2 years ago

@timoschlueter Yey! It helped, thank you)

SanktMaddin commented 2 years ago

grafik

I have an issue after I set the maintenance mode in heroku because of LLU service yesterday to save free dynos. Can someone help me with this?

Edit: The nightscout api token in the value settings is correct and SHA1 crypted

timoschlueter commented 2 years ago

@SanktMaddin: are you located in germany by any chance? Tonight, Abbott changed the server backend for users in germany. I updated the nightscout-librelink-up app to version 1.8.1 which includes a fix. More here: https://github.com/timoschlueter/nightscout-librelink-up/issues/54 Maybe that is the problem, not the free dynos. :)

SanktMaddin commented 2 years ago

@timoschlueter yes i changed it to DE and now everything works fine again :) but i have another question: is it possible to save dyno hours in any way? because with two applications on heroku i will have more than 1000 hours

mutti1980 commented 2 years ago

@timoschlueter Hello. We have followed all your steps and I have no values in the Nightscout. In the LinkUp they are in it. Unfortunately, I can't find the error. Can you help me further?

he99 commented 2 years ago

@mutti1980: I have basically everything working here (also in DE) using two Heroku free tier accounts (one for Nightscout and one for LibreLink Up) and a free MongoDB account (as described in detail on the Nightscout site). I've installed LibreLink Up as described by @timoschlueter. Unfortunately, overall this setup is unreliable - sometimes I don't get data in Nightscout for hours, although data is visible on the LibreLink site.

I've debugged this a bit and found, that LibreLink Up reads all data correctly from the LibreLink site, but fails to upload the data to Nightscout. The reason is a request timeout on the Heroku side - most likely due to the free MongoDB timing out. I did not find any workaround, so I plan to setup Nightscout/MongoDB on another server.

I've found it very helpful to run LibreLink Up locally (using the Variant 2 local install on my windows machine) and set the log level to debug to get more details - this then showed exactly what was going on...

One more note: I missed hashing the Nightscout API token for use with the LibreLink Up parameter (I only copied the API token, but did not hash it) - did you check this?

cabbage2400 commented 1 year ago

Hello,

I am attempting to follow this method to upload librelinkup readings into nightscout, but am stuck in the process. I am not very knowledgeable about a lot of this, so my apologies if my question doesn't make sense. I followed all steps on this github page to get this to work and believe that I followed everything successfully, because in my heroku account the app "stormy-castle-9257" is showing up. Now I am trying to deploy using heroku git, and when I do the first step here of inputting $ heroku login into the Heroku CLI program on my PC, it says "command not found". Within the Heroku website, I am pasting the Application Logs, to give more info on the error as it does show errors in uploading to nightscout.

If anybody can assist me with this, I would so appreciate it!!

2023-04-23T23:23:34.175876+00:00 app[worker.1]: [info]: Trying to upload 141 glucose measurement items to Nightscout 2023-04-23T23:23:34.178516+00:00 app[worker.1]: [error]: getaddrinfo ENOTFOUND https 2023-04-23T23:23:34.178708+00:00 app[worker.1]: [error]: Upload to NightScout failed 2023-04-23T23:23:34.186572+00:00 app[worker.1]: npm notice 2023-04-23T23:23:34.186651+00:00 app[worker.1]: npm notice New minor version of npm available! 9.5.1 -> 9.6.5 2023-04-23T23:23:34.186860+00:00 app[worker.1]: npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.5 2023-04-23T23:23:34.186915+00:00 app[worker.1]: npm notice Run npm install -g npm@9.6.5 to update! 2023-04-23T23:23:34.187053+00:00 app[worker.1]: npm notice 2023-04-23T23:23:34.337002+00:00 heroku[worker.1]: Process exited with status 0 2023-04-23T23:23:34.373678+00:00 heroku[worker.1]: State changed from up to crashed

ogsadmin commented 1 year ago

The second line from your log reads "getaddrinfo ENOTFOUND https" - that usually means, that you specified a URL (starting with https://) instead of the expected server hostname.

Please check your NIGHTSCOUT_URL environment variable:

adamlounds commented 2 weeks ago

One more note: I missed hashing the Nightscout API token for use with the LibreLink Up parameter (I only copied the API token, but did not hash it) - did you check this?

🧟 A quirk of nightscout's authentication means that if you use the api-secret then it must be hashed, but if you use a more-limited access token then it should not.

For any new users, note that librelinkup returns 15-minutely historical data, but the current reading is updated every minute. So if you set LINK_UP_TIME_INTERVAL=1 you'll get more data :)

gui-dos commented 2 weeks ago

@adamlounds

For any new users, note that librelinkup returns 15-minutely historical data, but the current reading is updated every minute. So if you set LINK_UP_TIME_INTERVAL=1 you'll get more data :)

In the case of the Libre 3, the "historical" data are saved every 5 minutes but they are updated with a latency exactly of 17 minutes: you can spot in the decompiled executable clearly the definition HISTORIC_POINT_LATENCY = 17 in fact ;-)

Differently than the Libre 2, the timer of the Libre 3 is much more precise: if you subtract the sensor activation time from a measurement timestamp, you notice that all the "historical" data have a lifeCount perfectly divisible by 5 for the whole sensor lifetime, while for the Libres 1/2 this is not true and the "historical" passed lifetimes have not the same reminder after dividing them by 15.