⚠️ diasend.com has been superseded by glooko.com. ⚠️
This project will no longer work since diasend will be spun down in the future and be completely replaced by glooko. For more information, visit the official resources of diasend / glooko.
If you want to import data from e.g. CamAPS into nightscout, here are some options to look into.
Thank you for everyone who contributed to this project!
Synchronizes treatments (insulin boli, temp basal changes) as well as continuous glucose values (CGV) from diasend to nightscout. This can e.g. help CamAPS FX users to view their treatments and glucose values via nightscout.
While diasend will eventually be replaced by glooko which will (presumably) provide a more open API to access the data and forward it to nightscout, this project can help in the meantime. #WeAreNotWaiting
✅ Glucose Values (CGM)
✅ Correction and Meal Boli
✅ Carb Corrections
✅ Basal rates (Pre-programmed)
✅ Basal rates (temporary, as applied by the CamAPS FX hybrid closed loop)
✅ Pump settings (see issue)
Depending on your use case and requirements, you may not need a synchronization solution from diasend to nightscout as provided by this project.
If all you need is to monitor the glucose values remotely via nightscout and don't want to use diasend for it, or the delay of uploading to diasend and synchronizing to nightscout (5+ minutes) is unbearable, I recommend taking a look at running xDrip in Companion mode which will provide glucose values faster to nightscout than this project can.
However, if you need to see more data than the pure continuous glucose values (CGV) within nightscout, e.g. insulin boli, carb corrections, basal rates or temporary adjustments of basal rates, the diasend-nightscout-bridge has got you covered.
And finally - you don't have to pick: You can run both the xDrip Companion and the diasend-nightscout-bridge to get the best out of both worlds: Near-Realtime blood glucose monitoring and trends as well as proper import of all treatments issued via CamAPS FX / stored on diasend. For more details, see here
The following environment variables are required, also see env.example:
DIASEND_USERNAME
: the username / email address of your disasend accountDIASEND_PASSWORD
: the password of your disasend accountNIGHTSCOUT_URL
: the url of your nightscout instanceNIGHTSCOUT_API_SECRET
: the api secret to communicate with your nightscout instanceTZ
: the timezone from which the glucose values have been sent to diasend. If your run the bridge on a machine other than your local pc (e.g. a dedicated server), it must be configured to avoid an offset in the data due to timezone issues. Usually the timezone in which your device exporting data to diasend is. This little utility can help you find the correct value for the TZ
variable.Optionally, you can also provide the following values:
NIGHTSCOUT_PROFILE_NAME
: The name of the profile in nightscout to which to synchronize the diasend pump settings. Defaults to undefined which means the pump settings will not be synchronized. When set, the specified profile will be overwritten with the settings from diasend so be careful.DIASEND_CLIENT_ID
: client id for authorization against diasend. Defaults to a486o3nvdu88cg0sos4cw8cccc0o0cg.api.diasend.com
DIASEND_CLIENT_SECRET
: client secret for authorization against diasend. Defaults to 8imoieg4pyos04s44okoooowkogsco4
There are two different ways to use this project in order to synchronize data from diasend to nightscout. You can either run this bridge standalone in which case it will pull the data via the diasend API and forward it to nightscout via nightscout's REST API. The downside here is that you need to run it on an additional server or PC which is why the more intuitive way is running the bridge as a plugin directly as part of nightscout. This way, the data will still be pulled from diasend via its HTTP API but the data will directly be imported into nightscout without going through its REST API, which should likely be more reliable and remove the need to run the bridge separately.
To run this bridge as a plugin directly in nightscout, you can simply install the bridge as an npm package within your nightscout installation and implement a handler to import the data directly into nightscout. A sample implementation can be found here: https://github.com/nightscout/cgm-remote-monitor/compare/master...burnedikt:cgm-remote-monitor:master?expand=1.
Once installed, the plugin needs to be enabled via nightscout's ENABLE="... diasend ..."
environment variable and the following two environment variables need to be defined: DIASEND_USERNAME
and DIASEND_PASSWORD
so that nightscout will automatically pull data in from diasend.
A future goal is to either merge the example implementation above upstream or publish the bridge as a nightscout plugin directly to npm so that the integration with nightscout becomes easier.
To run the bridge, ensure that all required environment variables are set. You can set environment variables manually or create a file called .env
and fill it with values similar to env.example. All variables defined within the .env
file will be loaded automatically thanks to dotenv.
Next, run yarn install
to install all dependencies.
Finally run the following command to synchronize CGV from diasend to nightscout every 5 minutes:
yarn start
You can also run the bridge as a docker container either side-by-side with nightscout (if it is running containerized using docker
or docker-compose
). To do so, you can use the Dockerfile within this repository to build the bridge into a docker container image:
docker build -t diasend2nightscout .
You can use the resulting container image (in this case named diasend2nightscout
) to run the bridge as a container using docker-compose
like:
# nightscout services
services:
diasend-bridge:
build:
context: .
environment:
DIASEND_USERNAME: <diasend-username>
DIASEND_PASSWORD: <diasend-password>
NIGHTSCOUT_URL: <url-of-nightscout-instance>
NIGHTSCOUT_API_SECRET: <retracted>
# ... other environment variables for configuration, see readme
... or directly using docker à la docker run -e DIASEND_USERNAME=... -e DIASEND_PASSWORD=...diasend2nightscout
. See here for more details.
This project uses the loglevel library to control the verbosity / level of logging. You can turn on more verbose and detailed logging by setting the environment variable NODE_ENV
to development
. This will output detailed information about what kind of data has been fetched from diasend and how it will be sent to nightscout.
This project works by connecting to diasend's internal (!) API, which may change at any time without warning, so use with caution, and pulling the latest number of so-called patient data, converts it to CGV values compatible with nightscout and then uses the nightscout API to push those values.
More information and sample calls on the diasend-api can be found in diasend-api.http which can be used with VSCode's REST Client plugin to quickly try out the API calls.
This project is written in Typescript.
File an issue if you'd like to give feedback, request an enhancement, or report a bug.
Pull requests are welcome.
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 diasend / glooko, and may violate their Terms of Service.