yo-han/Home-Assistant-Carelink

Great work on this custom integration

Closed this issue · 8 comments

Hi,

Thanks for adding this custom integration on Home assistant.
My son has been using this Diabetic pump almost two years now and all this carelink app junk of medtronic supportwise is a joke.

I was looking at the Java client of Carelink, and thinking about reverse engineering this into python and eventually putting this into home assistant. (engineering background, but facing a steep learning curve on python and Home assistant method)
And now this comes along.. talking about an early christmass present. :-)

On 19th of december i installed the integration into my home assistant instance, and hooked it up to Carelink.
Works great so far. it feels like the polling time often goes to almost 10 minutes before fresh information comes in. but i will monitor that over time.

Looking at the sensor values the Reservoire level does not match with the values is can observe on the pump and app. (half of actual)

And i was wondering the possibilities to add some more sensor values
For Dashboarding
lastSG >> current SG value : already mapped
lastSGTrend >> What is the trend of the SG value with an arrow (values are : DOWN_DOUBLE, DOWN, NONE, UP, UP_DOUBLE)
activeInsulin >> How much insuline is currently active

Daily statistics last 24 hours
averageSG : average SG value
belowHypoLimit : Percentage point time spend below Hypo Value (3,9%)
aboveHyperLimit : Percentage point time spend above Hyper Value (10,0%)
timeInRange : Percentage point time spend in between Hypo and Hyper

Planning data for replacing sensor and Infusion Set
reservoirLevelPercent : percentage of still left insuline
reservoirRemainingUnits : amount of units of insuline in the reservoir
medicalDeviceBatteryLevelPercent : Battery level of the sensor
sensorDurationHours : How many hours remaining on current sensor (countdown of 7 days to zero

Again thanks ever so much for your work already done.. And if there is anyway i can help, by either testing or otherwise. Let me know.

hoi HHuitema,
HomeAssistant offers some great tools to use a sensor's history; this allows you to calculate averages, detect trends, trigger alerts etc. see https://www.home-assistant.io/integrations/filter/#time-simple-moving-average

things like timeInRange are calculated on the pump or on the carelink site, not sure if these data are provided.
it should be fairly straightforward to configure this with a custom SQL sensor if you're comfortable with that
https://www.home-assistant.io/integrations/sql/

Hi,
Fully agree the daily statistics can simply be generated by Home Assistant.

This integration with HA for me (as a parent) will have greater value if also the SG Trend and ActiveInsuline is part of the sensor values. Then alerting and visually Analysing if a Hypo is about to happen is possible from HA.. :)

Hi, to be honest I'm very surprised anyone beside my wife is using this integration. The sensor available now are only the ones we came up with first. I will take a look at your propositions next week.

About the updating interval. What we have seen the last weeks is the the integration is updating pretty well, but the pump/app are doing a real bad job. Many disruptions between app and pump. But I will keep monitoring to see if there is any way to improve the updates.

Using the values now is only for ballpark estimates right now. We saw on the apple watch it's even worse, because it's updating even less times. The most fun are popups on our wall dashboard with current hypo warnings and requests to make some lemonade. 😀

I just made a new release. Some of the requested sensors are added. Others will come in the next release.

I also changed the update interval from Carelink from 180s to 60s.

Heya. Be careful not to hammer the Medtronic API, they will start blocking that many requests. It may be useful to look at the actual updates of the sensor, there's no point in doing more API calls between updates :-)

Updating every minute seems to be the sweet spot now. The problem is that medtronic says in it's documentation that the pump is uploading data every 5 minutes but the real interval is just all over the place. The longer I make the interval the longer an update can take. The pulls from the api are done in a very nice way for the api so I guess it won't be a problem. Working nicely for about 5 days here now.

But the interval could be something that is configurable so everyone get set it to their own preference.

@hhuitema I just made a new release containing a lot of sensor from your original request. Please let me know if it all works.