nightscout / Trio

Trio - an automated insulin delivery system for iOS based on the OpenAPS algorithm with adaptations.
https://docs.diy-trio.org/en/latest/
MIT License
98 stars 531 forks source link

Libre Alarms Using Non Calibrated Data #167

Open kylmcw opened 6 months ago

kylmcw commented 6 months ago

Describe the bug Using Libre, when a high or low notification is sounded, the app appears to be using non calibrated data to trigger the alarm, despite being lower (in this case) than the alarm trigger point.

To Reproduce Steps to reproduce the behavior:

  1. Calibrate Libre sensor to a value below default
  2. Observe when default value in GCM settings exceeds threshold, but calibrated value is below.
  3. Observe high alert

Expected behavior A clear and concise description of what you expected to happen. High alert only applies to calibrated values.

Screenshots If applicable, add screenshots to help explain your problem.

image image image Smartphone (please complete the following information): iPhone 15 Pro

Setup Information (please complete the following information):

Additional context Add any other context about the problem here.

kylmcw commented 6 months ago

@avouspierre

avouspierre commented 6 months ago

Very good point with a difficulty to resolve quickly, without changing the logic of the alarm notification.

The alarm notifications are integrated in Libre package plugin with his own "BG" (the value that it will send to Trio core app). And, the correction of BG with calibration value is done after (by trio app). Probably the issue was here (and always is) in iAPS.

Different scenarios of solutions :

github-actions[bot] commented 4 months ago

hey 👋 - silence for 30 days 🤐 ... anybody? triage is required!

github-actions[bot] commented 4 months ago

closed 📴 because silencio 🤫 since an additional 14 days after staleness 📠

bjornoleh commented 1 month ago

Tagging @dabear in case this is not on your radar already.

dabear commented 1 month ago

I am not certain I understand this problem. Libretransmitter has its own experimental calibration feature. Libretransmitters alarm feature does work on top of this calibration. allowsEditingFactoryCalibrationData must be set to true though (it's experimental so not something that should be set to true by default).

If trio implements calibration on top of the value returned by Libretransmitter, Libretransmitter would not know about or use that for alarming. If Trio modifies the glucose values returned, it should also be responsible for sending out any alarms rather than letting Libretransmitter do it

bjornoleh commented 1 month ago

Ok, thanks for the info, I believe Trio has its own calibration on top. Maybe the Libre alarms should be disabled when libretransmitter is used in Trio? And replaced with Trio specific alarms perhaps?

Tagging @kskandis , whom I believe is working on alarms/alerts in Trio?

dabear commented 1 month ago

(For Loop I did have long conversations with Pete about this; basically I wanted Loop to provide the alarms, while Pete insisted that each cgmManager implements its own alarm handling)

dabear commented 1 month ago

If needed, I can add a feature flag to libretransmitter to programatically disable alarms, both from ui and the alarm handling code itself

bjornoleh commented 1 month ago

I believe Loop now also supports a cheaper Dexcom targeted at T2 without alarms in its accompanying app. Hence this discussion will probably reemerge. Adding the alarms at the CGM manager level sounds a little like duplicating of work across CGM managers.

marionbarker commented 1 month ago

Pete did not accept the pull request for Stelo support into Loop yet. He is wearing one himself but was concerned about alarms.

kskandis commented 1 month ago

Ok, thanks for the info, I believe Trio has its own calibration on top. Maybe the Libre alarms should be disabled when libretransmitter is used in Trio? And replaced with Trio specific alarms perhaps?

Tagging @kskandis , whom I believe is working on alarms/alerts in Trio?

Yes, agree, Libre plugin has its own set of notifications that are enabled in the plugin by the user in NotificationsSettingsView, saved to UserDefaults, and based on those settings, Libre will send APN in NotificationsHelper.

This is similar to what Trio does. Trio, of course, already has High/Low BG notifications if the user enables them in Settings - Notifications - Glucose Notifications. The other Libre notifications are Libre specific which currently Trio does not process. Looking at the code, Libre does send the LibreError which Trio's PluginSource cgmDelegate should be able to process. I see there is a // TODO comment there.