Skip to content

kws1969/share2nightscout-bridge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

share2nightscout-bridge

Fetches data from Dexcom's webservice and puts it in Nightscout.

Environment variables

These are required.

Highly recommend setting these as Custom type of Connection String environment variable inside of Azure.

Most people with a pre-existing Nightscout with the API enabled (using the API_SECRET) will only need to add two more custom connection string variables, DEXCOM_PASSWORD, and DEXCOM_ACCOUNT_NAME. The app uses these details to stay connected, bridging the "data streams" over the web. If the API is not already set up using the API_SECRET, then the third variable is also needed, set it to any long phrase of your choosing, it needs to be longer than 12 characters.

  • DEXCOM_ACCOUNT_NAME - Dexcom Share user name
  • DEXCOM_PASSWORD - Dexcom Share password
  • API_SECRET - (might already be set in Azure) your Nightscout API Secret

Features

These environment variables are optional, you can most likely ignore this section. These features can be used to emulate gap sync.

  • maxCount - default: 1, maximum number of records to process
  • minutes - default: 1440, number of minutes to include

This one is completely optional.

  • SHARE_INTERVAL - default: 60000 * 2.5, number of ms to wait between updates. Default is 2.5 minutes.

Old not needed

Deprecated:

  • NS - Your fully qualified https://bar.example.com endpoint with no path. This is similar to your /pebble endpoint, but without the /pebble part.

We now look at WEBSITE_HOSTNAME environment variable, which is set automatically by Azure.

Output/logs

The output looks something like this when it works:

$ env $(cat shansel.env )  node index.js 
Entries [ { sgv: 70,
    date: 1426298639000,
    dateString: '2015-03-14T02:03:59.000Z',
    trend: 4,
    device: 'share2',
    type: 'sgv' } ]
Nightscout upload error null status 200 []

How it works:

Using the Share2 app allows an iphone to push data from a Dexcom receiver to Dexcom's webservices. This program fetches a user's data from Dexcom's servers, and stores it in their own Nightscout server.

By default, this program run as node index.js, will loop forever. As described by Scott Hanselman, one of my many advisors, this logs in to Dexcom Share as the data publisher. It re-uses the token every 5 minutes to fetch the maxCount latest glucose records within the last specified minutes. This information is then sent to the user's specified Nightscout install, making the data available to the beloved pebble watch and other equipment owned and operated by the receiver's owner. It will continue to re-use the same sessionID until it expires, at which point it should attempt to log in again. If it can log in again, it will continue to re-use the new token to fetch data, storing it into Nightscout.

How to use/install

Visit the releases page, download nightscout-sidecar.zip, and upload to Azure as a web job. Set the environment variables above as App Settings.

Prerequisites:

  • A working Nightscout web app, and an Azure account.
  • Download nightscout-sidecar.zip file from the releases page

Setup

What to expect

Shortly after creating the webjob, it should start, and your Nightscout rig should receive data as usual.

This project is not FDA approved, not recommended for therapy, and not recommended by Dexcom.

Azure Account Quotas

We highly recommend using this only on the paid Azure Basic plans. They cost around $50/month. Using this program with Azure Free website causes the usage to exceed the free quotas. Feel free to try it out, but watch out for those quotas. You can partner with family and friends to run up to 20 sites on a single plan. Because you have a paid plan, the service will have paid performance and support, with better terms on uptimes. It may be possible to also host mongo on the same paid account, in which case it the system will fail much less often, because of the Basic support.

See the billing comments for more details and feedback.

About

azure sidecar, bridges Dexcom share2 to Nightscout

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%