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
95 stars 479 forks source link

G7 connection issue #402

Open kelseyhuss opened 2 months ago

kelseyhuss commented 2 months ago

Describe the bug

Mid day, Trio stopped receiving glucose values. Force quitting Trio and the Dexcom app did not resolve the issues. Had to 1. delete the cgm from trio 2. Force close both apps 3. Restart phone 4. Reopen Dexcom app 5. Reopen Trio. Trio DID show the cgm as connected under settings and was receiving the cgm values there, but the values did not get to the algorithm for it to run.

Attach a Log

Tap the Trio settings icon at the bottom of the screen, then tap 'Share logs' on the bottom of the list and attach it to this ticket.

To Reproduce

Can't reproduce the behavior

Expected behavior

CGM values to be used in the algorithm and appear on the Home Screen

Screenshots

If applicable, add screenshots to help explain your problem.

Setup Information (please complete the following information):

Smartphone:

Pump:

CGM:

Trio Version:

Technical Details

Additional context

duck-nukem commented 1 month ago

This has happened 4/4 times, the timing seems random, but here's what I can see:

To resolve this I go to G7 configuration within Trio, hit "Scan for new sensor", wait until up to 5 minutes so a new signal is captured (important to not to let the phone go to sleep/lock). Once I can see the screen in Trio has updated, I close this config pane, and Trio continues to work normally.

The "disconnect" never happens twice with the same sensor, but it reliably happens with every sensor - which especially sucks if it happens while my son's in school where I can't do the reconnect trick.

FWIW - I've learned the above tricks from iAPS, where the exact same behaviour could be observed after upgrading from V2 to V4 (IIRC, but not exactly sure!)

duck-nukem commented 1 month ago

Here are the logs, the app wasn't force restarted or closed AFAIK The connection was restored around 16:00-16:10, and at the point of reconnection loop didn't work for 64 minutes according to the status badge in the top-right corner of the app screen

log.txt

Maybe this is relevant?

2024-09-07T14:55:10+0200 [DeviceManager] PluginSource.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 86 - DEV: device Manager for Optional("DXCMLG") : Sensor connected
2024-09-07T14:55:10+0200 [ApsManager] FetchGlucoseManager.swift - updateGlucoseSource(cgmGlucoseSourceType:cgmGlucosePluginId:newManager:) - 116 - DEV: plugin : Optional("G7CGMManager")
2024-09-07T14:55:10+0200 [DeviceManager] PluginSource.swift - cgmManager(_:didUpdate:) - 164 - DEV: DEBUG DID UPDATE STATE
2024-09-07T14:55:11+0200 [DeviceManager] PluginSource.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 86 - DEV: device Manager for Optional("DXCMLG") : Sensor didRead G7GlucoseMessage(glucose:Optional(95), sequence:504 glucoseIsDisplayOnly:false state:ok messageTimestamp:150552 age:7, data:4e00184c0200f801000107005f00060669000f)
2024-09-07T14:55:11+0200 [ApsManager] FetchGlucoseManager.swift - updateGlucoseSource(cgmGlucoseSourceType:cgmGlucosePluginId:newManager:) - 116 - DEV: plugin : Optional("G7CGMManager")
2024-09-07T14:55:11+0200 [DeviceManager] PluginSource.swift - cgmManager(_:didUpdate:) - 164 - DEV: DEBUG DID UPDATE STATE
2024-09-07T14:55:11+0200 [DeviceManager] PluginSource.swift - readCGMResult(readingResult:) - 173 - DEV: PLUGIN CGM - Process CGM Reading Result launched with newData([LoopKit.NewGlucoseSample(date: 2024-09-07 12:55:04 +0000, quantity: 95 mg/dL, condition: nil, trend: Optional(LoopKit.GlucoseTrend.flat), trendRate: Optional(0.6 mg/min·dL), isDisplayOnly: false, wasUserEntered: false, syncIdentifier: "479323.098682962 DXCMLG 150545", syncVersion: 1, device: Optional(<<HKDevice: 0x300f269e0>, name:DXCMLG, manufacturer:Dexcom, model:G7, software:CGMBLEKit1.0, UDIDeviceIdentifier:00386270001863>))])
2024-09-07T14:55:11+0200 [DeviceManager] PluginSource.swift - cgmManager(_:hasNew:) - 117 - DEV: CGM PLUGIN - Direct return done
2024-09-07T14:55:11+0200 [Nightscout] FetchGlucoseManager.swift - subscribe() - 275 - DEV: FetchGlucoseManager callback sensor
2024-09-07T14:55:11+0200 [DeviceManager] FetchGlucoseManager.swift - glucoseStoreAndHeartDecision(syncDate:glucose:glucoseFromHealth:) - 219 - DEV: New glucose found
2024-09-07T14:55:11+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 42 - DEV: start storage glucose
2024-09-07T14:55:12+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 85 - DEV: start storage cgmState
2024-09-07T14:55:12+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 91 - DEV: storeGlucose BloodGlucose(_id: "0960FD1E-7362-4A7F-992E-2DE588C7AC46", sgv: Optional(95), direction: Optional(FreeAPS.BloodGlucose.Direction.flat), date: 1725713704278, dateString: 2024-09-07 12:55:04 +0000, unfiltered: Optional(95), filtered: nil, noise: nil, glucose: Optional(95), type: Optional("sgv"), activationDate: Optional(2024-09-05 19:05:55 +0000), sessionStartDate: Optional(2024-09-05 19:05:55 +0000), transmitterID: Optional("DXCMLG"))
2024-09-07T14:55:12+0200 [DeviceManager] DeviceDataManager.swift - updatePumpData() - 185 - DEV: Start updating the pump data
2024-09-07T14:55:12+0200 [DeviceManager] DeviceDataManager.swift - updatePumpData() - 188 - DEV: Pump data updated.
2024-09-07T14:55:12+0200 [ApsManager] APSManager.swift - loop() - 202 - DEV: Starting loop with a delay of 1.7976931348623157e+308
2024-09-07T14:55:12+0200 [ApsManager] APSManager.swift - determineBasal() - 333 - DEV: Start determine basal
2024-09-07T14:55:15+0200 [DeviceManager] PluginSource.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 86 - DEV: device Manager for Optional("DXCMLG") : Sensor disconnected: suspectedEndOfSession=false

5 mins later seems like it reconnected, but then disconnected again?

2024-09-07T15:00:10+0200 [DeviceManager] FetchGlucoseManager.swift - glucoseStoreAndHeartDecision(syncDate:glucose:glucoseFromHealth:) - 219 - DEV: New glucose found
2024-09-07T15:00:10+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 42 - DEV: start storage glucose
2024-09-07T15:00:11+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 85 - DEV: start storage cgmState
2024-09-07T15:00:12+0200 [DeviceManager] GlucoseStorage.swift - storeGlucose(_:) - 91 - DEV: storeGlucose BloodGlucose(_id: "83F6D119-D701-44BC-B3CD-ECC91BA3460D", sgv: Optional(95), direction: Optional(FreeAPS.BloodGlucose.Direction.flat), date: 1725714004349, dateString: 2024-09-07 13:00:04 +0000, unfiltered: Optional(95), filtered: nil, noise: nil, glucose: Optional(95), type: Optional("sgv"), activationDate: Optional(2024-09-05 19:05:55 +0000), sessionStartDate: Optional(2024-09-05 19:05:55 +0000), transmitterID: Optional("DXCMLG"))
2024-09-07T15:00:12+0200 [DeviceManager] DeviceDataManager.swift - updatePumpData() - 185 - DEV: Start updating the pump data
2024-09-07T15:00:12+0200 [DeviceManager] DeviceDataManager.swift - updatePumpData() - 188 - DEV: Pump data updated.
2024-09-07T15:00:12+0200 [ApsManager] APSManager.swift - loop() - 202 - DEV: Starting loop with a delay of 1.7976931348623157e+308
2024-09-07T15:00:12+0200 [ApsManager] APSManager.swift - determineBasal() - 333 - DEV: Start determine basal
2024-09-07T15:00:14+0200 [DeviceManager] PluginSource.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 86 - DEV: device Manager for Optional("DXCMLG") : Sensor disconnected: suspectedEndOfSession=false

// omitted CGM upload logs

2024-09-07T15:00:30+0200 [Service] UserNotificationsManager.swift - addRequest(identifier:content:deleteOld:trigger:) - 347 - DEV: Sending noLoopFirstNotification notification
2024-09-07T15:00:30+0200 [Service] UserNotificationsManager.swift - addRequest(identifier:content:deleteOld:trigger:) - 347 - DEV: Sending noLoopSecondNotification notification

// omitted some more entries

2024-09-07T16:00:17+0200 [DeviceManager] PluginSource.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 86 - DEV: device Manager for Optional("DXCMLG") : Sensor connected
2024-09-07T16:00:17+0200 [ApsManager] FetchGlucoseManager.swift - updateGlucoseSource(cgmGlucoseSourceType:cgmGlucosePluginId:newManager:) - 116 - DEV: plugin : Optional("G7CGMManager")
2024-09-07T16:00:17+0200 [DeviceManager] PluginSource.swift - cgmManager(_:didUpdate:) - 164 - DEV: DEBUG DID UPDATE STATE
2024-09-07T16:00:17+0200 [Service] UserNotificationsManager.swift - requestNotificationPermissionsIfNeeded() - 294 - DEV: UNUserNotificationCenter.authorizationStatus: UNAuthorizationStatus(rawValue: 2)
2024-09-07T16:00:17+0200 [Service] WatchManager.swift - session(_:activationDidCompleteWith:error:) - 253 - DEV: WCSession is activated: true
2024-09-07T16:00:17+0200 [Default] FreeAPSApp.swift - body - 71 - DEV: APPLICATION PHASE: active
2024-09-07T16:00:17+0200 [DeviceManager] PluginSource.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 86 - DEV: device Manager for Optional("DXCMLG") : Sensor disconnected: suspectedEndOfSession=false
2024-09-07T16:00:19+0200 [DeviceManager] PluginSource.swift - deviceManager(_:logEventForDeviceIdentifier:type:message:completion:) - 86 - DEV: device Manager for Optional("DXCMLG") : Sensor error Error enabling notification for authentication: unknownCharacteristic

BTW I'm not sure where does the time gap comes from, from the logs it seems to jump from 15h to 16h without anything inbetween; these are consecutive lines:

2024-09-07T15:00:31+0200 [Nightscout] TidepoolManager.swift - uploadDose() - 305 - DEV: Success synchronizing Dose data:
2024-09-07T16:00:16+0200 [Default] FreeAPSApp.swift - init() - 56 - DEV: Trio Started: v0.2.0(1) [buildDate: nil] [buildExpires: Optional(2025-08-20 17:11:57 +0000)]
duck-nukem commented 1 month ago

just happened again, here are some logs from the last 1-1.5 hours where the disconnect and the reconnect has happened

logs_2024_09_16.txt

schoenhm commented 1 month ago

I am experiencing the same dexcom g7 issue as the original post. All hardware is the same, iOS 17.5.1.

Temporary fix has been to receive bg from pull through nightscout.

Logs and screenshot below.

log_prev.txt log.txt

IMG_0155

github-actions[bot] commented 1 week ago

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