Remote notifications

While Loop app currently sends notifications locally on Loop user's iPhone, parents and caregivers likely want those messages on their phones, too. We can achieve this functionality through a combination of Nightscout, IFTTT, Google, and Pushover.

Traditionally, most people may already know of Pushover alerts through their NS site. The old Loop docs had setup for how to add your PUSHOVER_ANNOUNCEMENT_KEY , PUSHOVER_API_TOKEN, and PUSHOVER_USER_KEY in your Heroku settings to get notifications on the non-looping phones of parents and caregivers. The drawback for that method is that you could not necessarily fine tune the alerts (maybe you wanted battery alarms on your NS website, but not get pushovers for them...a bit hard to separate out the environments that way) and Pushover had a demanding acknowledgement requirement. If you failed to acknowledge an alert, you may end up getting alarm fatigue fairly quickly as the alarm repeated itself.

Using Pushover THROUGH IFTTT however, we can improve the possible notifications and who receives which ones. For example, a teenage Looper may want notifications when his/her pump site needs changing and when his/her dexcom is about to expire in the next day. S/he already gets local notifications on his/her phone via Loop for low reservoir volumes, low pump battery, and Loop failures. Dexcom app provides high/low BG notifications locally, too. If s/he were to get those same alarms via Pushover, s/he would inevitably get alarm fatigue. A remotely-monitoring parent may want additional information, like a pushover alerts when the school nurse bolused for lunch, as well as Loop failures, low iPhone battery level for the child, low pump battery, and other such information that might be useful. Perhaps there's also an emergency contact person that you only want to get high/low BG alerts...you can set that up as well quite easily.

The basic concept is that NS puts out an event that triggers the IFTTT service called Webhooks (old name was "Maker Webhooks" hence you may see references to "maker" in NS docs). Actually, there are several types of events that NS has programmed in all ready to use in IFTTT.

For this setup, we are going to use the most general logging event called ns-event. You'll get all the alarms and notifications logged, and then you can decide in subsequent steps which ones you'd actually like to send to your phone for pushover notification.

As a brief roadmap for what we are going to do:

  1. Get necessary accounts setup
  2. Add a folder to your Google Drive
  3. Make an IFTTT applet to log NS events to your Google Spreadsheets
  4. Enable NS to work with that new IFTTT applet
  5. Make an IFTTT applet to send Pushover alert when the Google Spreadsheet is updated

Get Prepped

If you don't already have these steps done, you will need them. Skip any that you already have done.

Add a Google Drive folder

This IFTTT/Nightscout-Alarms folder will eventually contain numerous Google Spreadsheets, one for each NS alarm or infomation that is logged. As new alarms are triggered, the IFTTT applet we are about to write will add a row to the appropriate spreadsheet logging the time of the alarm and any other reported details that go with the entry. For now though, your drive will be blank...screenshot below just to give you an idea of where we are going.

Make 1st IFTTT Applet to Log NS Alarms

Enable IFTTT Webhooks in your Nightscout site

If you already have created IFTTT buttons previously to work with your NS site, you can skip this section. If those buttons are working, then you've already added your MAKER_KEY and "maker" to your ENABLE line in Heroku.


Make 2nd IFTTT Applet to send Pushover notifications

This applet can't be created unless your filename (alarm spreadsheet) already exists. If your 1st applet we created above hasn't run for a long time, the spreadsheets may not exist yet because the alarms haven't triggered. You have two options...(1) manually create the file in your Google Drive so that you can finish the applet now or (2) wait several days/weeks for the alarms to happen and that will automatically create the files in your Google drive.

If you choose option 1, here's a partial list of some of the filenames you could create in advance:

  • Loop isn't looping
  • Cannula age 48 hours
  • Cannula age 72 hours
  • Meal Bolus
  • Warning, Pump Reservoir Low
  • Warning Uploader Battery is Low

Depending on your alert levels you specified in NS, some of the hours in the titles may vary to match your settings

Revisit Nightscout Alert Levels

Putting all these notifications together may cause you to want to revisit the alert levels you have set in your Heroku settings. Here's a short summary of NS for the looping-related alerts (Note: the last row, Upbat, is the Looping iPhone battery level for Loop users; or the rig's battery level for OpenAPS users.) If you'd like some of these alarms for your site and don't currently have them activated (they are all off by default unless specifically turned on), the lines you'd need to add are in the last column. If you like the default values of the WARN and/or URGENT, you don't have to add those extra lines...just the line to enable the alerts will be sufficient.

SETTING DEFAULT
WARN
DEFAULT
URGENT
HEROKU
SETTINGS
CAGE 48 72 CAGE_ENABLE_ALERTS = true
CAGE_WARN=XX
CAGE_URGENT=XX
SAGE 164 168 SAGE_ENABLE_ALERTS = true
SAGE_WARN=XX
SAGE_URGENT=XX
IAGE 48 72 IAGE_ENABLE_ALERTS = true
IAGE_WARN=XX
IAGE_URGENT=XX
LOOP 30 60 LOOP_ENABLE_ALERTS = true
LOOP_WARN=XX
LOOP_URGENT=XX
OPENAPS 30 60 OPENAPS_ENABLE_ALERTS = true
OPENAPS_WARN=XX
OPENAPS_URGENT=XX
PUMP_CLOCK 30 60 PUMP_ENABLE_ALERTS = true
PUMP_WARN_CLOCK=XX
PUMP_URGENT_CLOCK=XX
PUMP_RES 10 5 PUMP_ENABLE_ALERTS = true
PUMP_WARN_RES=XX
PUMP_URGENT_RES=XX
PUMP_BATT_P 30 20 PUMP_ENABLE_ALERTS = true
PUMP_WARN_BATT_P=XX
PUMP_URGENT_BATT_P=XX
PUMP_BATT_V 1.35 1.30 PUMP_ENABLE_ALERTS = true
PUMP_WARN_BATT_V=XX
PUMP_URGENT_BATT_V=XX
UPBAT 30 20 UPBAT_ENABLE_ALERTS = true
UPBAT_WARN=XX
UPBAT_URGENT=XX

Final notes