T1D Diabetes IFTTT Project: Turn on Lights if Blood Glucose Levels are Critical
Type 1 diabetes (T1D) dad outlines DIY project utilizing NightScout, IFTTT, SmartThings and other IoT devices to enable a Dexcom constant glucose monitor to turn on lights when blood glucose reaches critical levels. #singfornicole
This piece on technology and Type 1 Diabetes (T1D) is the second in a series by Michael Maniscalco, co-founder of the remote-network monitoring company Ihiji. Some 30,000 people, including Maniscalco's young son "Z," are diagnosed with the potentially fatal disease each year. Yet, as Maniscalco has learned, there is no simple way to integrate glucose meters (for blood sugar monitoring) with home automation -- for the simplest of IoT tasks like flashing the lights when blood glucose reaches dangerous levels. Here, he explains how to integrate a Dexcom constant glucose monitor (GCM) with the open-source NightScout Project, and home automation products and services like SmartThings and IFTTT. The end result could be a life saver: Turn on the lights if blood glucose reaches critically high or low levels. - Julie Jacobson
THANK YOU FOR A GREAT AND INSPIRING RESPONSE to the first CE Pro article I wrote on Type 1 Diabetes (T1D) and better management using technology. I wanted to write a follow-up given the reaction of those affected by this disease and their interest in my DIY project.
I mentioned in the last installment that I was surprised to learn how little there was in the way of integration for T1D medical devices and related software. For example, there is no standard way to use data from a Constant Glucose Monitoring (CGM) system to trigger outside events, like flashing the lights.
I set about creating a non-standard way to integrate with GCM systems. Because of my technical background, it was a fairly simple process, but it probably isn’t for the typical consumer.
Given we have a technically savvy group of CE Pro readers, I’ll highlight the high-level components required to get the project working.
First, a disclaimer: This is an experimental project that is largely run on open and unsupported APIs. Anyone embarking on this project should treat it as such and not rely on non-FDA approved solutions for medical treatment.
The purpose of sharing the project details here is to stimulate discussion on this important subject, with the hope of someday creating more robust and reliable solutions for the medical device, open source, home automation and similar industries.
T1D Project: The Components
The essential element in this solution is a Constant Glucose Monitor (CGM) that works with the NightScout project, an open-source remote monitoring solution.
In my case, I’m using a Dexcom CGM, which plays nicely with NightScout through a few integrations, most of which are not officially supported by Dexcom.
NightScout requires forking the NightScout project on GitHub, which contains all of the code required to run this solution. I host my NightScout installation on both Microsoft Azure and Heroku so that I can quickly move service as a failover. Most people can get by with one instance and I’d suggest Heroku over Azure. Each of these cloud instances requires a hosted Mongo database to collect and store all of the CGM readings. I host my database on Mongolabs which has a free tier for small data sets.
Given that most CGMs are taking a simple blood glucose reading with a few other data elements on a five-minute interval the storage requirements are pretty low. The details on getting NightScout up and running are very well documented on the NightScout website, and they have an engaged support community online through Facebook and Gitter.
Outside of the complexities of actually treating and deeply understanding T1D, this is the most technical aspect of this project. If you are unfamiliar with cloud-hosted software solutions, I would highly recommend following the NightScout documentation in detail through each step.
The average Dexcom user does not need to spin up a NightScout system because Dexcom hosts a robust remote monitoring and alerting system that has mobile apps for Android and iOS as well as family applications (Dexcom Share) so that parents can follow BG readings of their children on their own phones.
These apps provide some great initial functionality, but after you sleep through your first Dexcom audible alarm because you forgot to turn your ringer back on after a big meeting or your phone battery dies, you’ll be asking what else you can do to have backup alerts.
That was the genesis of my project, I wanted to have better monitoring throughout the day of blood glucose (BG) readings at all times, and I also wanted to be sure I had backups to the Dexcom Audible alert at night.
Dexcom and IFTTT: Lights On when BG is Critical
Once I had NightScout up and running, the first integration I configured was a Pebble Watch interface which allows you to replace your normal watch-face with one that pulls CGM data showing the current BG and BG trend line.
The watch app can also be configured to buzz your arm when a high, low or no-data event occurs. Right now I only have it configured to alert my wrist on low BG readings or severe high BG that persist over a longer than normal period. I don’t run the watch app all of the time, but when my son Z gets sick, or is having a rough BG night, or is running around the park for a few hours, it is nice to get a glimpse of his current status.
There is also an excellent OSX menu bar app, appropriately named nightscout-osx-menubar, which shows the most recent BG as well as the current trend. Super helpful for getting intimately familiar with my son’s BG trends, which is knowledge that drives better treatment decisions.
The next project was to integrate my lighting dimmers with the NightScout project. For research purposes, I have a "Frankenstein's Monster"-type home automation setup at home. I use a combination of Wemo, Ring, Z-Wave, Philips Hue, Nest, Eero, Google Fiber, Amazon Echo and Samsung SmartThings devices.
I had already integrated my Ring video doorbell to turn on lighting loads, which had triggers for events through IFTTT so I assumed I could accomplish similar IFTTT integration with NightScout. I tested the integration, and it worked like a charm!
I had some initial concerns with the reliability of IFTTT in such a critical application, so I turned on the audit trail and reporting functionality which has allowed me to monitor the service and become very comfortable with its functionality.
I was also concerned about relying on an inexpensive hub and Z-Wave dimmer. SmartThings is very communicative about downtime and outages, which helps to establish trust in the system. The SmartThings app does a good job of notifying when the hub or device falls offline.
There are also worries about CGM connectivity, but the Dexcom app can be set up to alert to no connectivity. For connectivity, I relied solely on Wi-Fi for a while, but there were too many times when the CGM app on the cell phone was outside of WiFi coverage.
To remedy this, I found a cheap Tracphone data plan to allow cell coverage as well as a failover if Wi-Fi or the ISP goes down. To ensure the local network and ISP are functioning I have Internet monitoring and monitor my SmartThings hub and Wi-Fi through Ihiji, our remote network-management system.
I plan to configure better NightScout monitoring via monit and PagerDuty but haven’t yet found the time. In the meantime, Dexcom runs in parallel with all of these systems and still alerts three phones in the house.
My understanding of the disease, normal BG trends, and the data collected from the CGM has also helped provide a better comfort level with how to manage the data to maintain normal BG trends.
Using all of this technology is still a challenge because I know managing T1D with a growing child will always be a constant battle.
Given everything described, I LOVE it when the lights go on at 4:00 a.m. to alert to a low BG reading. I seriously smile because I know that the risks of missing one of these events if I wasn't to wake up could have serious consequences. #SingForNicole
Wish List: Amazon Echo or Google Home Integration
I also wanted to trigger an audible alarm through the Amazon Echo in the bedroom, but Amazon doesn't have any APIs to allow for incoming audio alerts. That is unfortunate because wouldn’t it be fantastic if, on a critical BG event, Alexa could announce the last known BG level and the trend?
There are integrations through NightScout that allow you to ask for the most recent BG reading. While this is cool, I don’t find myself using it much. To go one step further, I also had a Google Home that used Google’s search solutions to query a Carbohydrate database - so you can say “Ok Google, how many grams of carbohydrates are in a banana? Or, “How many grams of carbohydrates are in 15g of refried black beans?”
Google does a great job at giving you a specific answer which Amazon has not nailed on Alexa.
Fun story: I met an engineer on the Google search project, which enables the carb-query functionality, while I was at the NightScout Foundation hackathon in San Diego alongside the American Diabetes Association meeting earlier this year.
His young son also has T1D, and since he was a tech nerd like me and had the appropriate skills, he was using NightScout and OpenAPS to provide cutting-edge treatment.
Interestingly, Amazon and Merck, through Luminary Labs, are currently running the Alexa Diabetes Challenge startup competition which could spur some new and novel integrations.
So Much Work to Do
Lastly, there is always talk about a cure for T1D. There is a ton of fundraising that helps to finance research projects all over the world to find a cure. A partner at the NightScout Foundation said to me that if T1D is cured, it will be the first known cure for an auto-immune disorder. That would be a HUGE breakthrough but also signifies how difficult a cure is to obtain.
It is a beacon of shining light in a dark storm, as anyone dealing with disease management or life-threatening health problems knows well.
I had a conversation with a dealer whose wife has been battling cancer for years. She continues to beat the odds and keeps on treatment regimens. The longer they can fight, the more hope for a cure. That is what keeps them going day-to-day.
That is also what is inspiring about technology developments in T1D: It can greatly improve treatment decisions and quality of life. It is reducing complexity and risk. It could, in a reasonable period, provide the closest thing to a cure until a “real” one is found.
In some ways, we’re lucky because our son was diagnosed at a time of great innovation, so he can live a long and comfortable life. I know and have met many people who have fought way too long without this modern technology to barely “manage” the disease. It is only now they can experience the luxury this cutting-edge technology and connectivity offers. These fighters are the people who inspire the T1D tech community and drive many of the open-source projects.
There is so much more to this, and I will share my experiences from the ADA Scientific Sessions in the next article.
I do, however, want to look into the future a bit because it is very encouraging. On the foreseeable horizon is amazing technology such as hybrid and closed-loop artificial pancreas systems. There are also applications to apply similar technology to other diseases.
Within CE Pro there has been plenty of talk about aging-in-place technology which can leverage similar technological advances, connectivity, data, and monitoring. Big data, machine intelligence, and contextual awareness are going to make a huge impact on the treatment of T1D and other diseases.
The future seems bright for this otherwise depressing condition. Thanks for allowing me to share this experience and for the comments, emails, tweets, messages, etc. I find it incredibly satisfying to spur conversation, bridge industries, connect tech experts and contribute, where I can, to moving things forward because solutions like these shouldn’t be reserved for IoT and cloud experts.
Secure Your Free Pass to CEDIA EXPO 2019
Register before Sept. 2 to gain free access to the opening keynote, product training & education series as well as the show floor including Innovation Alley and much more. Don’t miss your chance. Sign up today.
A former integrator, Michael Maniscalco is co-founder and vice president of technical operations for ihiji. He served as one of the principal architects of invision, the company’s cloud-based, real-time remote systems monitoring and servicing solution. For more information contact email@example.com or visit www.ihiji.com. Have a suggestion or a topic you want to read more about? Email Michael at firstname.lastname@example.org
Follow Michael on social media:
Control & AutomationMassive ADT Report Shows How Customers View Smart Home Tech
Product Briefs: Elan adds Jandy; Crestron Marine Program; Zigbee Milestone
Escape CEDIA Expo! First-Ever Delos Wellness Pavilion Offers Biophilic Refuge
CEDIA Find: Cellgate’s Cell-Based Access Control with Streaming Video; Control4 Integration
How ADG Successfully Added Lighting Design and Electrical to its A/V
View more on Control & Automation