Visualization and Monitoring¶
Nightscout is an open source, DIY project that allows real-time access to a CGM data via personal website, smartwatch viewers, or apps and widgets available for smartphones. Setting up a Nightscout web app is the recommended way to visualize your OpenAPS closed loop.
Nightscout allows a user to upload CGM data from a variety of sources, to an online database and cloud computing service. The information is then processed and displayed visually as a graph. There are plugins that allow greater information to be shown about OpenAPS, too. As the data is uploaded to an online website and then retrieved by OpenAPS, it allows OpenAPS a wider range of compatibility with various CGM solutions.
Nightscout is the recommended way to visualize your OpenAPS closed loop.
Even if you don’t choose to share your Nightscout site with another person, it will be helpful for you to visualize what the loop is doing; what it’s been doing; plus generate helpful reports for understanding your data, customized watchfaces with your OpenAPS data, and integration with IFTTT. You can read more about the latest Nightscout features here.
- If you plan to use Nightscout with OpenAPS, we recommend using Heroku, as OpenAPS can reach the usage limits of the free Azure plan and cause it to shut down for hours or days. If you end up needing a paid tier, the $7/mo Heroku plan is also much cheaper than the first paid tier of Azure. Currently, the only added benefit to choosing the $7/mo Heroku plan vs the free Heroku plan is a section showing site use metrics for performance (such as response time). This has limited benefit to the average OpenAPS user. In short, Heroku is the free and OpenAPS-friendly option for NS hosting.
- Create an account at Heroku and choose the Primary Development Language to be Node.js when you create your account. You’re going to use a free account, but you will still need to enter credit card information for your account setup before the app will deploy. You’ll need confirm your Heroku account by clicking a link sent via email.
- Create an account at GitHub
Note: If you already have an existing GitHub account and NS site, you may just need to update your repository by doing a Compare in GitHub. Use
https://github.com/yourgithubname/cgm-remote-monitor/compare/master...nightscout:master and replace yourgithub name. Click the big green
Create pull request button. Another screen will appear, fill in a title and click button to
create the pull request, and then you can
Merge pull request, and finally
Confirm merge. That process updates your Nightscout repository in Github. Once updated, you can skip the “click the Fork Button” step below and start following along with the purple
Deploy to Heroku button step from your updated Nightscout cgm-remote-monitor repository.
- Go to the Nightscout cgm-remote-monitor repository
- Click the
Forkbutton in the upper right corner
- Scroll down until you see the purple
Deploy to Herokubutton. Click that button.
- Give your app a name, this will be the prefix of your NS site’s URL. For example,
- Fill out the information lines in the
Config VariablesSection of that page, as shown below. Some of the lines can stay with the default entries already provided.
|API_SECRET||Create your own API_SECRET…this is like the password to your NS site. Please write it down somewhere safe or commit it to memory, you will be using it in the future. It needs to be at least 12 characters long and should NOT use the `@` symbol.|
|DISPLAY_UNITS||enter either mg/dl or mmol|
|ENABLE||bridge openaps pump iob basal careportal sage cage maker(Enter all of the words without commas. Just a single space between each word. Make sure autocorrect does not add space between careportal. **Notice we are not including cob here.** If you have other plugins that you would like to enable, please add them here.)|
|BG_HIGH||Enter the numeric value of BG you’d like as an urgent high alarm.|
|BG_TARGET_TOP||Enter the numeric value of the top of your target BG.|
|BG_TARGET_BOTTOM||Enter the numeric value of the bottom of your target BG.|
|BG_LOW||Enter the numeric value of the BG you’d like as an urgent low alarm.|
|PUSHOVER lines||Can be left blank for now. If you decide to use Pushover later, you can come back and add your info to these lines.|
|CUSTOM_TITLE||This will be the text displayed in the upper left part of the NS website.|
|THEME||change from default to colors|
|BRIDGE_USER_NAME||Enter your Dexcom Share Account login name. This should be the same account name used in the Share2 or G5 Mobile app.|
|BRIDGE_PASSWORD||Enter your Dexcom Share Account password.|
|BRIDGE_MAX_COUNT||Default value is 1. Setting this to 7 will update the last 35 minutes of data.|
The remaining variables can be left at their default values.
Note: for BRIDGE_MAX_COUNT: This value sets the number of BG values to pull from Share per update. Each Dexcom BG value represent 5 minutes. Nightscount defaults to BRIDGE_MAX_COUNT=1. If you lose connectivity with your Dexcom transmitter, your Share app will automatically backfill data points when you regain connectivity. Nightscount does not do this and you will have gaps in the data for when you were out of range. More information here https://github.com/nightscout/cgm-remote-monitor#bridge-share2nightscout-bridge
You can change the BRIDGE_MAX_COUNT value to pull more samples per query, which will backfill BRIDGE_MAX_COUNT values for you. This change increases your data usage and may affect your Nightscout billing tier. Setting BRIDGE_MAX_COUNT to 7 will update the previous 35 minutes of data and will keep OpenAPS up to date on your current BG trends. If you frequently have larger data gaps and you use autotune, you may consider increasing this number more to backfill data more aggressively.
- Click the purple
Deploybutton at the bottom of screen.
- Wait a little bit while Heroku builds your NS app. You’ll see some text scroll by in the Build App box, and then finally, you will have a message that the NS app was successfully deployed. If the app fails to deploy, it may be that you have not added your credit card information to your account yet. Go add that information in your account billing section, and then come back and press the deploy button again. Don’t worry, your account is still free unless you choose otherwise. The credit card simply gives you added dyno hours on your free account (win-win).
- You can verify your site’s successful build by clicking
View(you should see black site with a profile warning). You will be redirected to a profile set-up page. (If it doesn’t redirect automatically, refresh your webpage).
You do not have to enter all the information in the profile if you are using OpenAPS (since OpenAPS will be providing the information for IOB and COB rather than letting NS calculate them), but you do have to fill out the
Basal Profile and
TimeZone at a minimum in order to have your temp basals properly display. Click
Save when you have entered the information. You will be prompted to authenticate, if it is the first time you’ve used the device to make changes in your profile. Click on the
Authenticate link at the bottom of the site, and enter your API_SECRET to complete the authentication.
Note: OpenAPS will only work based on the values in your pump; not the values that you put into Nightscout profile. You will need to keep the Nightscout basal profile in-sync with any changes you make in your pump to prevent later confusion in watching the temp basal rendering.
- Assuming your previous browser tab is still open for “Create a new App | Heroku”, let’s go back to that tab. This time instead of choosing the
Viewoption, we are going to select the
Manage Appbutton. Then, select the
Settingstab near the top of the screen on your Heroku app.
- Click on
Reveal Config Vars. Scroll down the bottom of the Config Vars lines until you find the last blank one. You are going to add several additional lines of config vars for OpenAPS use; the DEVICESTATUS_ADVANCED is a required line, the others just make Nightscout more useful when using OpenAPS.
|PUMP_FIELDS||battery reservoir clock status|
|PUMP_RETRO_FIELDS||battery reservoir clock status|
|SHOW_PLUGINS||openaps pump iob sage cage careportal|
|PUMP_URGENT_BATT_V||1.3(This is the pump battery voltage that will trigger a red, urgent alert in NS.)|
|PUMP_URGENT_RES||10(This is the reservoir volume that will trigger a red, urgent alert in NS.)|
|OPENAPS_FIELDS||status-symbol status-label iob meal-assist rssi|
|OPENAPS_RETRO_FIELDS||status-symbol status-label iob meal-assist rssi|
|OPENAPS_WARN||20(This is the minutes since OpenAPS last successfully looped. This will be a yellow alert in NS.)|
|OPENAPS_URGENT||60(Same as the alert above, but will be red in color and have a shorter snooze option.)|
If you are using the Nightscout Bridge to bring in CGM data from Dexcom servers (G4 Share2 app or G5 Mobile app) and are outside the US, you will need to add a setting for
BRIDGE_SERVER and set the value to
- Click on
Open Appin the top right corner of your Heroku site.
- Click on the settings (those three horizontal lines in upper right corner). Now check that your basal render is selected to either default or icicle (personal preference for how the temp basals show as blue lines in NS site), check the boxes that you’d like display pills in the SHOW PLUGINS (usually all of them), and then press save. Your NIGHTSCOUT site is all set-up. Congrats!
It’s not working - I’m missing data in Nightscout?¶
If you are using a “test pump” that has not received sufficient data in some time, Nightscout pills will NOT be displayed onscreen. Nightscout may also not work if it hasn’t had CGM data in a while - so if you haven’t been using a CGM and uploading CGM data to Nightscout for the past few days, the site may be empty as well. If this happens, simply use this pump in tandem with a CGM so glucose values are recorded and eventually uploaded to Nightscout. Once sufficient data has been collected, (and OpenAPS plugin is enabled and saved), the OpenAPS pills should appear automatically. Medtronic CGM users may also need to do this to get their CGM data flowing into Nightscout after a gap in uploading data.
Switching from Azure to Heroku¶
- If you are a current OpenAPS user and want to switch from Azure to Heroku, you will need to change your NS URL in both
cron. Alternatively, you can edit your runagain.sh file and run the setup script again.
- If you’d like to seamlessly keep all your old Azure NS data showing in your new Heroku NS site, you’ll need to copy and paste your old
MONGODBstring from your Azure site. Find it in either Application Settings or Connection strings in your Azure control panel and then go to Heroku’s
MONGODB_URIline. Replace the content with your copied string from Azure. Double check that your Azure collection used the “entries” name…if it doesn’t, then you will need to update that variable in Heroku to match as well.
Note: It’s a good idea to to check your deployment connection in Heroku’s dashboard after your deploy (typically this still needs to be manually connected after initial setup). Go your
Deploy tab in your Heroku dashboard, click on the GitHub service, and select your GitHub cgm-remote-monitor repository. You can select the cgm-remote-monitor branch you’d like to deploy at the bottom of the screen. Both master and dev branches work for OpenAPS.
A Note about Nightscout’s COB Pill¶
If you have the Advanced Meal Assist (AMA) OpenAPS feature turned on, OpenAPS calculates COB dynamically. To see your COB on your Nightscout web app, look inside the OpenAPS pill. (If it says “undefined”, this means you do NOT have AMA turned on.)
Nightscout, however, has its own COB pill, which decays carbs statically, and it is NOT used in OpenAPS calculations.
- We highly recommend NOT using the Nightscout COB pill. We even recommend removing it from your Nightscout ENABLE web app settings as it causes bugs, and great confusion, because it will do a static decay and/or mess up your Nightscout.
- Note also: Nightscout’s Bolus Wizard Preview (BWP) pill also decays carbs statically.
- To avoid confusion: Turn off all other Nightscout pills that use static COB calculations.
How to display basal changes (“render basal”)¶
- In case you missed it during setup: we recommend that you “render”/display the basal rates (the blue lines to show what temp basals have been enacted, if any.) To do so, select “Default” or “Icicle” from the “Render Basal” pull-down menu in the Settings.
How to display OpenAPS purple prediction/forecast lines¶
- Click the three dots next to your timeframe horizon (3HR, 6HR, 12HR, 24HR) and then enable “Show OpenAPS Forecasts”. Don’t see this option? Check and make sure you added this variable and that your OpenAPS has successfully run.
Understanding the OpenAPS pill¶
The OpenAPS pill box has four states, based on what happened in the last 15 minutes: Enacted, Looping, Waiting, and Warning:
- Waiting is when OpenAPS is uploading, but hasn’t seen the pump in a while
- Warning is when there hasn’t been a status upload in the last 15 minutes
- Enacted means OpenAPS has recently enacted the pump
- Looping means OpenAPS is running but has not enacted the pump
- Unknown means Error or Timeout; OpenAPS has reported a failure, or has reported no status for many hours.
All of a sudden, Nightscout is no longer showing treatments (bolus, carbs, finger BGs) on the graph or rendering my basals.¶
If you suddenly find that Nightscout is not showing treatments (bolus, carbs, finger BGs etc.) on the graph; and/or that your basals are no longer being rendered in the blue basal line; but otherwise, everything looks normal and you are looping properly:
You probably somehow got a future-dated treatment. One possible reason is a clock-time mismatch between your devices - for example, your BG meter, pump, CGM, or OpenAPS rig may have different dates or times set.
To remove future treatments:
- Go into Nightscout under “Settings” and “Admin tools” and delete any future-dated treatments (press the “remove treatments in the future” button). If the future treatments were caused by a time mismatch, you’ll need to resolve that first, or the future dated treatments may simply be re-uploaded.