GithubHelp home page GithubHelp logo

minimed-connect-to-nightscout's Introduction

NO LONGER MAINTAINED

This repo is no longer maintained. Active development continues in the nightscout/minimed-connect-to-nightscout fork.

minimed-connect-to-nightscout

Circle CI

MiniMed Connect is a device which communicates with a Medtronic insulin pump over 916MHz radio to gather data about pump status. This data may include readings from an Enlite continuous glucose monitor (CGM). The Connect forwards pump data via Bluetooth LE to a proprietary app running on an iPhone. The iPhone app uploads the data to Medtronic's servers, enabling authorized users to view it on the Medtronic CareLink Connect website.

Nightscout is an open source, DIY project that allows real-time access to CGM data on any platform. The core of the Nightscout project is cgm-remote-monitor, a web service which can receive and broadcast CGM data using a Mongo database. Various other software projects communicate with an instance of cgm-remote-monitor, either to transmit data from a CGM device, or to display that CGM data on a computer, smartphone/tablet, or smartwatch.

minimed-connect-to-nightscout is a web scraper which sends data from Medtronic CareLink Connect to Nightscout. It does so by posing as a web browser, logging into CareLink Connect, periodically downloading pump status data from the Medtronic server, and uploading that data to a Nightscout server.

Prerequisites

  • A MiniMed Connect and compatible Medtronic insulin pump
  • An iPhone running the MiniMed Connect app
  • Username and password for a CareLink account linked to the Connect
  • A working Nightscout website and Mongo database

Installation on Azure

The easiest installation mode is to set up an instance of Nightscout cgm-remote-monitor on Azure and enable the mmconnect plugin. This module is packaged with Nightscout 0.8.2+ and can pull data from CareLink Connect as part of the web server process. Follow this guide.

Installation on Heroku

Another turnkey installation option is to run this on a Heroku worker dyno. You may find this more reliable than Azure. Follow the Share2 Bridge instructions for Heroku, substituting this repo for share2nightscout-bridge.

Deploy

Installation in general

  1. Install Node.
  2. Clone this repository or download a zip with the latest version.
  3. npm install to install dependencies.
  4. Set environment variables (see below).
  5. npm start and leave it running.

Required environment variables

  • CARELINK_USERNAME - your username for CareLink
  • CARELINK_PASSWORD - your password for CareLink
  • API_SECRET - the value you use for API_SECRET on your Nightscout website
  • WEBSITE_HOSTNAME - the hostname for your Nightscout instance, which looks like your.host.com. If you are running this script in the same Azure environment as Nightscout, there is no need to set this, as it will already be set by Azure. If you set NS (see below), you do not need to set this.

Optional environment variables

  • CARELINK_REQUEST_INTERVAL - number of milliseconds to wait between requests to the CareLink server (default: 60000)
  • CARELINK_SGV_LIMIT - maximum number of recent sensor glucose values to send to Nightscout (default: 24)
  • CARELINK_MAX_RETRY_DURATION - maximum number of seconds to spend retrying failed requests to CareLink, ideally a power of 2 (default: 512)
  • CARELINK_QUIET - set to a truthy value to not output details of CareLink and Nightscout requests to the console (default: empty)
  • MMCONNECT_SERVER - set to EU if you are based in Europe / using Guardian Connect
  • NS - a fully-qualified Nightscout URL (e.g. https://sitename.azurewebsites.net) which overrides WEBSITE_HOSTNAME

Currently supported data

  • Sensor glucose values and trend (single/double arrow up/down)
  • Pump: active insulin, reservoir level, battery level
  • MiniMed Connect: battery level, connection status to phone, connection status to pump
  • Sensor: calibration state, time until next calibration, sensor duration, connection status to pump
  • Pump model

Understanding of the current data is based mostly on this analysis.

API

run.js demonstrates how to use the key API features in production. A minimal example would look like:

var mmcns = require('minimed-connect-to-nightscout');
var client = mmcns.carelink.Client({username: 'username', password: 'password'});
client.fetch(function(err, data) {
  if (!err) {
    var transformed = mmcns.transform(data);
    mmcns.nightscout.upload(transformed.entries, 'https://your.ns.host/api/v1/entries.json', 'api-secret', callback);
    // ...or:
    mmcns.nightscout.upload(transformed.devicestatus, 'https://your.ns.host/api/v1/devicestatus.json', 'api-secret', callback);
    // ...or use `transformed.entries` and `transformed.devicestatus` directly
  }
});

Contributing

File an issue if you'd like to give feedback, request an enhancement, or report a bug.

Pull requests are welcome, provided they include tests. See test/ for examples. Run npm test to run the suite.

Much of the Medtronic HTTP interaction is based on the excellent work by @bewest and @ianjorgensen on mmcsv.

Disclaimer

This project is intended for educational and informational purposes only. It relies on a series of fragile components and assumptions, any of which may break at any time. It is not FDA approved and should not be used to make medical decisions. It is neither affiliated with nor endorsed by Medtronic, and may violate their Terms of Service.

minimed-connect-to-nightscout's People

Contributors

bewest avatar mddub avatar pietergit avatar szymjaw avatar

Stargazers

 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

minimed-connect-to-nightscout's Issues

Error: unable to verify the first certificate

Since about 9:15 PST on 5/9/2016, I am getting the following error within Nightscout when the MMCONNECT_VERBOSE=true environment variable is enabled. Before this everything was working as expected for the last 2 weeks.:

Mon May 09 2016 22:33:31 GMT-0700 (PDT) Logging in to CareLink
Mon May 09 2016 22:33:31 GMT-0700 (PDT) POST https://carelink.minimed.com/patient/j_security_check
MiniMed Connect error: Error: unable to verify the first certificate

I am not certain what is wrong, and this may be a red herring but in the authentication POST in carelink.js it doesn't look like the j_character_encoding key=UTF-8 is being sent. When attempting to mimick the login using POSTMAN, I was unable to authenticate without this value in the payload.

User settings

I can't get this to work with node.js. Where do i need to set the username/password? i supposed in the run.js files var config section by replacing CARELINK_USERNAME, that doesn't seem to work because i always get this error:

Error: Missing CareLink username at Object.<anonymous> (/xxx/xxx/minimed-connect-to-nightscout/run.js:32:9) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10) at startup (node.js:140:18) at node.js:1043:3

MMConnect is not working in EU due to EU CareLink service changes (28.06.2020)

Hi!

There was a major upgrade in EU CareLink services (28.06.2020) and since then MMConnect module is not working anymore in EU.

Login changed
https://carelink.minimed.eu/patient/j_security_check?j_username=&j_password= throws HTTP 400
EU CareLink seems to using now the following service for logins:
https://mdtlogin.medtronic.com/mmcl/auth/oauth/v2/authorize/login

Dataservice changed
https://carelink.minimed.eu/patient/connect/ConnectViewerServlet?cpSerialNumber=NONE&msgType=last24hours&requestTime= throws HTTP 404
EU CareLink connect webapplication seems to be using the following service to fetch SGV values:
https://carelink.minimed.eu/patient/connect/data?cpSerialNumber=NONE&msgType=last24hours&requestTime=

The returned SGV data seems to be the very same JSON as earlier
lastSensorTSAsString
bgunits
lastSensorTS
...
lastSGTrend
lastSG{}
lastAlarm{}
activeInsulin{}
sgs[]
limits[]
markers[]

Could you please change the MMConnect module to support the new EU CareLink Connect services?

Thank you!

Insulin (manual entry) from carelink into nightscout

How complicated is it to get this information out of carelink into nightscout?
I've had a brief look at the code and as far as I can see it looks like a different url is needed to query for the information - after that it shouldn't be too complicated to get it packaged up should it?

carelink.eu - No new items

hello, i'm install your minimed-connect-to-nightscout on my raspberry ubuntu os.
this app run but my request return no result ..

where i found debug log

Tue Feb 18 2020 10:35:49 GMT+0000 (Coordinated Universal Time) Logging in to CareLink
Tue Feb 18 2020 10:35:49 GMT+0000 (Coordinated Universal Time) POST https://carelink.minimed.eu/patient/j_security_check
Tue Feb 18 2020 10:35:50 GMT+0000 (Coordinated Universal Time) GET https://carelink.minimed.eu/patient/main/login.do
Tue Feb 18 2020 10:35:50 GMT+0000 (Coordinated Universal Time) GET https://carelink.minimed.eu/patient/connect/ConnectViewerServlet?cpSerialNumber=NONE&msgType=last24hours&requestTime=1582022150780
Tue Feb 18 2020 10:35:51 GMT+0000 (Coordinated Universal Time) Stale CareLink data: 26367035.85 minutes old
Tue Feb 18 2020 10:35:51 GMT+0000 (Coordinated Universal Time) No new items for https://XXXX.herokuapp.com/api/v1/entries.json
Tue Feb 18 2020 10:35:51 GMT+0000 (Coordinated Universal Time) No new items for https://XXXX.herokuapp.com/api/v1/devicestatus.json

update dependencies and publish the package

@mddub Can you update your dependencies and publish this package?

Updating the dependencies will remove the warning:
[email protected]: Use uuid module instead like reported here:
nightscout/cgm-remote-monitor#3535

Publishing this package makes it possible to install Nightscout without git, and also makes Nightscout a bit more secure, because packages uses checksums and a dependency like "git://github.com/mddub/minimed-connect-to-nightscout.git#v1.1.0", does not use a checksum. Therefore it's vulnerable if people somehow are able to hack your github.

security issue in depenendency lodash

Can you please fix this. I try to integrate minimed-connect-to-nightscout into Nightscout and get:

$ npm audit
npm WARN audit Both npm-shrinkwrap.json and package-lock.json exist, using npm-shrinkwrap.json.
=== npm audit security report ===

# Run  npm update lodash --depth 2  to resolve 1 vulnerability

  High            Prototype Pollution

  Package         lodash

  Dependency of   minimed-connect-to-nightscout

  Path            minimed-connect-to-nightscout > lodash

  More info       https://nodesecurity.io/advisories/1065

Can you upgrade lodash and confirm it works with minimed-connect-to-nightscout and then release a 1.3.1?

Guardian Connect

The european Version of Minimed Connect is released now.

The device is called Guardian Conenct and there is a Minimed Connect tab in Carelink. It works similar to the US Minimed Conenct but it does not work with nightscout because the URLs are different i suppose.

Would be great if there is a way to get it working with carelink.minimed.eu

support for carelink.minimed.eu (european minimed site)

is it possible to use this uploader for nightscout with the european portal?
i noticed the URL of Carelink website is hardcoded and cannot be set to https://carelink.minimed.eu.

I replaced the URL in carelink.js to carelink.minimed.eu, but I get errors in Nightscout.
timestamp1 Logging in to Carleink
timestamp2 POST https://carelink.minimed.eu/patient/j_security_check
...
MiniMed Connect error: Error: read ECONNRESET

Can I help you to make this uploader also work for European Carelink users?

Memory leak

Nightscout users who are using mmconnect in NS are now reporting the site crashes every couple days due to running out of memory. The issues seems to be isolated to this module; help checking where the leak is would be great.

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.