Coder Social home page Coder Social logo

dextrack's Introduction

Dextrack โ€” a Garmin watch face with blood glucose monitoring

Dextrack is a Garmin watch face that shows last hour of blood glucose readings, obtained from Dexcom share API.

Please make sure to check the official Dexcom app before making bolus or eating decisions!

Currently only Garmin Forerunner 245 is supported.

User interface

  1. Last blood glucose reading obtained from Dexcom share.

    This shows a message (instead of a glucose level) when the last reading is more than 10 minutes old.

  2. Current time and date

  3. Last hour of glucose levels, plotted in a graph.

    • Blue line: 200 mg/dl
    • Red line: 80 mg/dl
    • Gray line: in the middle, 140 mg/dl
  4. Indicates when the last reading was done, as reported by Dexcom. "-1m" in the screenshot means the shown bg level (132 mg/dl) was read by Dexcom 1 minute ago.

    When this number (ignoring the minus sign) is less than 5, you don't need to check your phone or Dexcom device for a more recent reading, as Dexcom reads every 5 minutes.

    When this number (ignoring the minus sign) is larger than 5, then it's possible that your phone or Dexcom device will show a more recent reading.

  5. Indicates when the next request to Dexcom share will be done, to read more recent numbers.

    An important limitation to be aware of is Garmin SDK requires at least 5 minutes between HTTP requests. This means once we get the recent numbers from Dexcom share, we have to wait at least 5 minutes before requesting bg levels again.

    In most cases, the number you will see here will be 5 or less. However in some cases, to catch up with recent readings without too much delay, Dextrack waits more than 5 minutes before reading bg levels.

    For example, suppose we requested bg levels at 14:08, and the most recent reading was done at 14:05. We will show 3-minute-old bg level in (1). If we keep reading new bg levels every 5 minutes, we will always show 3-minute-old data.

    So in this case we wait 7 minutes instead 5. This means we will miss the reading at 14:10, but starting from 14:15 we will always show the most recent reading, with only a few seconds delay.

  6. Blood glucose change rate, based on the last two readings.

    "-0.3/m" in the screenshot means that between the last two readings, the bg level was dropping 0.3 mg/dl per minute.

  7. Watch battery level

When there is an error and during the login sequence, (1) shows a message on what the device is doing, and a number in parens for when the next update will be done.

Installation

Dextrack is currently not available on Connect IQ Store, as it currently has no way of configuring Dexcom username, password, and share server to use (based on location). See development section below for details.

This will be fixed soon, and you will be able to install and configure it like any other watch face in Connect IQ Store.

To install Dextrack on your watch, you first need to get your account id. This is easily done by running this command after cloning the git repo: (requires Python 3)

$ ./tools/get_account_id.py <your Dexcom username> <your Dexcom password>

This tool will print a line with 36 characters. This is your Dexcom account id. Copy this, and create the file source/Secrets.mc with contents:

const DEX_ACCOUNT_ID = "<your Dexcom account id>";
const DEX_PASSWORD = "<your Dexcom password>";

Now you can compile the project as usual (see Garmin's tutorial), and copy the generated file (the one with extension .prg) to your watch (e.g. to Primary/GARMIN/APPS in Forerunner 245).

If you are in the US, update "shareous1" in get_account_id.py and source/Consts.mc files to "share2".

Development

I spent hours but failed to add a settings page to allow configuring Dexcom username, password, and share server. Any help on this would be appreciated.

Once we have a settings page I will publish Dextrack on Connect IQ Store.

Thanks

Dextrack would not be possible without xDrip developers' heroic effort to hack a Dexcom app and reverse engineer the Dexcom share API.

Related software

  • xDrip
  • Dex CGM app (not open source) is what I used on my watch before writing Dextrack.

dextrack's People

Contributors

osa1 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dextrack's Issues

Missing temporal events after a disconnect

When phone and watch go out of range, after connecting again, it seems like the next temporal event is not getting fired, and the app also doesn't schedule new temporal events.

As a result, we see "next event time" shown as negative number (i.e. we should've done a request but didn't) and we never update the bg levels again.

The workaround is to switch to a widget and then back to the watch face, which schedules a temporal event again.

We should find out which callbacks are called after a re-connection and schedule a temporal event there.

Show remaining temporal event time in seconds, using partial updates

We should show time left for the next temporal event in seconds when it's less than 60 seconds, otherwise we show it as minutes as we do now.

I think we should be able to use partial updates for this.

If we start using partial updates, maybe we can also show the second component of current time. We probably want to move the battery indicator to the left and use the space on the right for the second component.

Optimize session renewals

I think sessions get invalid after 24 hours. We should add a debug log (it should print the time) when we got an invalid session. After a few days we should be able to look at the logs and figure out the exact lifetime of a session.

Once we know the session lifetime for sure, we can store the last login time, and when the time between the next request and the last session renewal is more than the lifetime we login again instead of trying to read the bg data.

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.