Git Product home page Git Product logo

lvconnect's Introduction

lvconnect

Deploy to Heroku

lvconnect copies your CGM data from LibreView web services to a Nightscout website. The tool runs as node.js index.js, or as a Nightscout plugin, and will atempt to connect to your LibreView account, fetch data and upload to your Nightscout website via its REST API.

Prerequisites

  • A working LibreView account, either Personal or Pro. NOTE: In case of a Pro account any connected patient data can be fetched, so please make sure that the correct Nightscout URL and API_SECRET are set, or otherwise data will be uploaded and merge to the wrong Nightscout.
  • A working Nightscout website

Environment

VARIABLE (default) - description

Required

  • API_SECRET - A secret passphrase that must be at least 12 characters long, and must match the API_SECRET from your Nightscout website
  • WEBSITE_HOSTNAME - The hostname for your Nightscout website. Example: sitename.herokuapp.com or sitename.azurewebsites.net. Do not include http:// or https://
  • LVCONNECT_SERVER (api.libreview.io)- LibreView api website. ['EU', 'US', or any actual hostname]. Blank value can be used to get redirect LibreView servers in the US. Set to (EU) to fetch from servers outside of US from the beginning.
  • LVCONNECT_USER_NAME - Your personal account email for the Pro LibreView service. Overrides LVCONNECT_PRO_USER_NAME if set. Can be left empty if Pro account is used (see below).
  • LVCONNECT_PASSWORD - Your personal password for the Pro LibreView service. Overrides LVCONNECT_PRO_PASSWORD if set. Can be left empty if Pro account is used (see below).
  • LVCONNECT_TRUSTED_DEVICE_TOKEN - Trusted device token for 2FA verification

Optional

  • LVCONNECT_PRO_USER_NAME - Account email for the Pro LibreView service.
  • LVCONNECT_PRO_PASSWORD - Password for the Pro LibreView service.
  • LVCONNECT_PRO_TRUSTED_DEVICE_TOKEN - Pro account's trusted device token for 2FA verification
  • LVCONNECT_PATIENT_ID - LibreView Pro connected patient UUID. Used with Pro accounts to access one of the connected patients data. Ignored for personal LibreView accounts.
  • LVCONNECT_INTERVAL (3600000) - The time (in milliseconds) to wait between each update. Default is 1 hour
  • LVCONNECT_FETCH_TIMEOUT (2000) - Number of millisecods to wait for the LibreView servers' response
  • LVCONNECT_MAX_FAILURES (3) - The maximum number of attempts to connect to the LibreView server.
  • LVCONNECT_FIRST_FULL_DAYS (90) - The number of days to search for data on the first update only.
  • NS - A fully-qualified Nightscout URL (e.g. https://sitename.herokuapp.com) which overrides WEBSITE_HOSTNAME
  • LVCONNECT_TIME_OFFSET_MINUTES - Time difference in MINUTES between UTC and your location. LibreView treats your local time as UTC and doesn't report the actual time differences, so data will be shown with wrong timestamps if this parameter is not set.

More information

Before sending over and sensitive user information lvconnect checks if the LVCONNECT_SERVER appears to be a valid Lvapi server, then logs in and fetches historical glucose data through the Daily Log report. This information is then uploaded to the user's specified WEBSITE_HOSTNAME or NS.

If called without any parameters as a stand-alone tool, or as a plugin lvconnect will fetch data accumulated since previous call every LVCONNECT_INTERVAL ms, except for the the first run when it will request all data in the last LVCONNECT_FIRST_FULL_DAYS. Only essential step information is printed out.

The following three command line parameters are used for development and debugging:

  • login - forces starting of a new login session and fetches new authentication token.
  • fetch - prevents fetched data from being uploaded to Nightscout, and saves it to fetched.json instead.
  • run - runs one full authorize/fetch/upload cycle.

In development mode lvconnect only fetches data once per call, and its current session is saved to a session.json file and is resused for next calls. It also re-uses authentication tokens until they expire, or obtaines new ones as required.

Deletion of the session.json file will enforce new session start.

How to deploy to Heroku

Click 'Deploy to Heroku' button above and configure all of the variables as per descriptions, then click 'Deploy app'.

After the app is built and started click 'Manage app' button or go to Overview tab, then click 'Configure Dynos' link. Disable 'web' and enable 'worker' processes, confirm changes. Lvconnect does not have web interface when used as a standalone tool, and having 'web' process will cause app crashes.

Make sure that you correctly set LVCONNECT_TIME_OFFSET_MINUTES variable, as LibreView is not using timezones internally and therefore there is no way for lvconnect to know what your local time is. LVCONNECT_TIME_OFFSET_MINUTES is set in minutes to accomodate 1/2 hour timezones, not in hours!

Disclaimer

The code is lisensed under GNU General Public License.

This project is not approved by any national Health Authority, not recommended for therapy, and not related to, or approved by LibreView / Abbott.

lvconnect's People

Contributors

profpjs avatar skobkars avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lvconnect's Issues

What do I miss in the setup?

Hi, I am trying to set up your plugin to a Nightscout instance. Unfortunately I could not manage to make it work, I'd really appreciate if you could help me making this work! My 8 years old son has a Libre 3 and it would be really cool to have the data in Nightscout so I'd transfer them to a smartwatch.

I was doing the following:

  1. Deployed to Heroku from GitHub forked Nightscout repo (one file uploaded, other is replaced as per instructions in your repo) -> No option to add other parameters here
  2. Added “lvconnect” to ENABLE and SHOW_PLUGINS fields when doing the deploy
  3. So now I have a working NS site
  4. Now Heroku app is there, I went to Settings/Reveal Configs and added the following variables (here it is possible to add variables):
    i. WEBSITE_HOSTNAME – it is clear what to enter here as a value
    ii. LVCONNECT_SERVER – this is not that clear, I’ve added 'EU'
    iii. LVCONNECT_USER_NAME – this is also clear, the user name (email address) I have for LibreView
    iv. LVCONNECT_PASSWORD – also clear
    v. LVCONNECT_FINGERPRINT – I have signed in to the LibreView, pressed F12, under the “Session Storage” there was a token. I have taken that really long text – tried with and without the “-s
    vi. LVCONNECT_INTERVAL – set to 120,000 (2 min – I am using Libre 3 which has data in each min, so I wanted to start with a 2 min here)
    vii. LVCONNECT_FIRST_FULL_DAYS – 10 (no need for more)

One more question: what is the difference if I add WEBSITE_HOSTNAME or NS? I'v tried adding NS also but still not working.

LV_Connect Fingerprint where to get

Where can I get the fingerprint?

LVCONNECT_FINGERPRINT - Your LibreView account's fingerprint for skipping 2FA code verification step.

Thank you

JSON Error

For some reason will not depoly to Heroku…getting a JSON error. Any ideas on a fix?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.