Giter VIP home page Giter VIP logo

share2nightscout-bridge's Introduction

share2nightscout-bridge

wercker status Gitter chat Releases

Deploy to Heroku

The Share to Nightscout bridge copies your CGM data from Dexcom web services to a Nightscout website. The bridge runs as node.js index.js and will loop forever, periodically querying Dexcom's Share web services for new CGM data. The bridge relays any new data to a Nightscout website (cgm-remote-monitor) via the REST API. The website then stores the data in a Mongo database.

Prerequisites

  • A working Dexcom Share receiver paired to an Apple device that is successfully uploading data to Dexcom. You must be able to see the Dexcom data in the Dexcom Follow app for the bridge to work.
  • Your Dexcom Sharer username and password
  • A working Nightscout website and Mongo database

Install

The Share to Nightscout bridge is supported on both Azure and Heroku. Please see the wiki for current install information.

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
  • DEXCOM_ACCOUNT_NAME - Your Dexcom Share2 username
  • DEXCOM_PASSWORD - Your Dexcom Share2 password
  • WEBSITE_HOSTNAME - The host name for your Nightscout website. Example: sitename.herokuapp.com or sitename.azurewebsites.net.

Optional

  • maxCount (1) - The maximum number of records to fetch per update
  • minutes (1440) - The time window to search for new data per update (default is one day in minutes)
  • firstFetchCount (3) - Changes maxCount during the very first update only.
  • maxFailures (3) - The program will stop running after this many consecutively failed login attempts with a clear error message in the logs.
  • SHARE_INTERVAL (150000) - The time to wait between each update (default is 2.5 minutes in milliseconds)
  • NS - A fully-qualified Nightscout URL (e.g. https://sitename.herokuapp.com) which overrides WEBSITE_HOSTNAME

Azure Specific

  • It is highly recommended that you set the API_SECRET, DEXCOM_ACCOUNT_NAME and DEXCOM_PASSWORD in Connection Strings.
  • No need to set WEBSITE_HOSTNAME because the value is obtained from the existing Azure website environment.

More information

As described by Scott Hanselman, the bridge 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.

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

share2nightscout-bridge's People

Contributors

bewest avatar cpitchford avatar jimsiff avatar kdisimone avatar mddub avatar pietergit avatar samuelalinder avatar skobkars avatar sulkaharo avatar toarikaplan avatar veryfancy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

share2nightscout-bridge's Issues

Web Job stops

The web job stops after running for a few hours. I do not know why. If I go to the web job page I see that the web job is stopped. If I click start, it immediately starts working again. This has happened a few times since Sat night. Is there a setting that can force a restart?

Special Characters in Dexcom username issue

Hi, I just wanted to check if the someone has come up with any other work-around to get dexcom bridge to work with Dexcom accounts having special characters in it, except creating a new dexcom user. I haven't seen any new information about this issue in a while so I expect that is still the only option, but wanted to check just in case. Thanks!

EU server not working

I'm not able to access the dexcom sharing server via shareous2.dexcom.com using a european/EU login account. shareous1.dexcom.com seems to be working though.

battery status

The battery status is not needed using this program.
Posting a devicestatus such as this, with the uploaderBattery set to false will prevent pebble from show battery info.

Should help with nightscout/cgm-pebble#46

{
    "_id": {
        "$oid": "54a1b387297b815fb66a3136"
    },
    "uploaderBattery": false,
    "created_at": {
        "$date": "2014-12-29T20:03:18.476Z"
    }
}

Misc. Discussion (Technical)

Starting a new thread so I/we don't spam the tutorials with technical discussion.

Ben/team: If you prefer a different medium, please let me know.

Thanks.

understanding azure billing

How does usage of share2nightscout-bridge affect billing?

  • what are the plan types:
    • Free
    • Shared
    • Basic

Please list your experiences with these plans. Include notes about performance, consistency, reliability, and cost, please. If you can also, please give a rough idea of how many people are using your Nightscout site/pebble, etc to help us understand your usage requirements.

Bridge seems to require alpha-numeric Dexcom passwords

In two separate cases I've worked with so far, users with Dexcom account passwords that were entirely numeric would fail to authenticate their bridge connections. Changing passes to alpha-numeric alternatives fixed the problem.

Not really sure why this would be manifesting, but perhaps something to do with the way the bridge is doing hashing or similar? Anyway, worth investigating.

Host as docker container

Hi,
[i'm quite new to docker but would it be possible to host this on your own server using docker container?
If so, would someone be able to put together a docker-compose.yml file that could be used?

Would be a great way to be able to host it yourself.

Login error for users with '+' in their account names

Hi, I have many users getting login error. All of them have a + in their dexcom username. I know it used to be a problem before to have sepcial characters in the username but that was fixed long time ago. either there was some change in the dexcom API that cause these accounts to fail authentication, or I am doing something wrong with the character encoding of my login requests.

This request works:
curl -k -X POST https://shareous1.dexcom.com/ShareWebServices/Services/General/AuthenticatePublisherAccount --data '{"password":"<hidden password here>", "applicationId":"d89443d2-327c-4a6f-89e5-496bbb0317db", "accountName":"[email protected]"}' -H "Accept: application/json" -H "Content-type: application/json"

but if I try with another account that has a + in their dexcom username, like this:
curl -k -X POST https://shareous1.dexcom.com/ShareWebServices/Services/General/AuthenticatePublisherAccount --data '{"password":"<hidden password here>", "applicationId":"d89443d2-327c-4a6f-89e5-496bbb0317db", "accountName":"+14087977776"}' -H "Accept: application/json" -H "Content-type: application/json"

I get an error message:
{"Code":"AccountPasswordInvalid","Message":"Publisher account password failed","SubCode":"<OnlineException DateThrownLocal=\"2023-06-27T15:33:08.793\" DateThrown=\"2023-06-27T15:33:08.793Z\" ErrorCode=\"AccountPasswordInvalid\" Type=\"13\" Category=\"4\" Severity=\"1\" TypeString=\"InvalidPassword\" CategoryString=\"Validation\" SeverityString=\"Minor\" HostName=\"\" HostIP=\"\" Id=\"{b2963c4a-0429-4ca2-af79-d5fc1ee4c3b4}\" Message=\"Publisher account password failed\" FullText=\"com.dexcom.udp.common.data.exception.OnlineException: Publisher account password failed\" />","TypeName":"FaultException"

Both account works fine when logging into https://uam1.dexcom.com

Any ideas?

Trouble logging in

Im getting the following log:
2022-02-05T15:18:49.899998+00:00 app[worker.1]: Fetching new token
2022-02-05T15:18:50.654008+00:00 app[worker.1]: Cannot authorize account: null 500 {
2022-02-05T15:18:50.654029+00:00 app[worker.1]: Code: 'AccountPasswordInvalid',
2022-02-05T15:18:50.654029+00:00 app[worker.1]: Message: 'Publisher account password failed',
2022-02-05T15:18:50.654031+00:00 app[worker.1]: SubCode: '',
2022-02-05T15:18:50.654031+00:00 app[worker.1]: TypeName: 'FaultException'

(...)

2022-02-05T14:56:59.517205+00:00 app[worker.1]: /app/index.js:325
2022-02-05T14:56:59.517206+00:00 app[worker.1]: throw "Too many login failures, check DEXCOM_ACCOUNT_NAME and DEXCOM_PASSWORD";
2022-02-05T14:56:59.517207+00:00 app[worker.1]: ^
2022-02-05T14:56:59.517224+00:00 app[worker.1]: Too many login failures, check DEXCOM_ACCOUNT_NAME and DEXCOM_PASSWORD

We have the G6 app installed and two phones with working Follow apps. Ive used the credentials used for the G6 app, using the credentials i can also login here:
https://clarity.dexcom.eu/

Im 100% positive there is no mistake in credentials provided in config Vars.

Anyone has any ideas?

Password and username

What is Dexcom Share2 username, Your Dexcom Share2 password, I’m currently using Dexcom G5, I created a follower entered that name it on username what do I use for the password. I have tried to use my Dexcom username and password, I get an application error

Dexcom is returning Trend a string, not an integer in EU region

I noticed at 2021-11-30 17:45:00+UTC that the direction arrow in nightscout was incorrect (shows a <=> character)

Tracking back in my syslog I found evidence that the direction information being stored in Nightscout no longer had accurate trend information: Here's a dump of the "glucose" value after dex_to_nightscout():

This was the last working collection from Dexcom:

Entries [ {
  sgv: 62,
  date: 1638294113000,
  dateString: '2021-11-30T17:41:53.000Z',
  trend: 4,
  direction: 'Flat',
  device: 'share2',
  type: 'sgv'
} ]

Then the very next collection was broken, and the type of trend has changed to a string.

Entries [ {
  sgv: 59,
  date: 1638294412000,
  dateString: '2021-11-30T17:46:52.000Z',
  trend: 'Flat',
  direction: 'NONE',
  device: 'share2',
  type: 'sgv'
} ]

direction is now "NONE" and trend is now a string "Flat"

Working backwards it seems the payload received from Dexcom during the fetch operation has switched the Trend property from a number to a string, (in this example the value is now "Flat" instead of 4

This causes the dex_to_entry() function to return an incorrect object, trend is now a string, an direction is always "NONE"

This affects me in the eu region (I'm a UK user)

Document the Share API

I'd like to access the data in other places, such as a Query Table in Microsoft Excel. Could you add a file that documents the Share API?

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.