npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lvconnect

v0.1.24

Published

Fetches data from LibreView's webservice and puts it in Nightscout

Downloads

55

Readme

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.