Skip to content

Record Eversense alarms that stop glucose as CGM events - #3

Merged
ps2 merged 2 commits into
loop-next-devfrom
eversense-sensor-events
Oct 12, 2026
Merged

ps2 merged 2 commits into
loop-next-devfrom
eversense-sensor-events

Conversation

@ps2

@ps2 ps2 commented Oct 12, 2026

Copy link
Copy Markdown

Records Eversense alarms that stop glucose as CGM events, like G7 (LoopKit/G7SensorKit#90), G5/G6 (LoopKit/CGMBLEKit#224) and Libre 3 (LoopKit/LibreLoop#19), using the sensorIssue type from LoopKit/LoopKit#637.

  • sensorIssue. Recorded when the transmitter raises an alarm whose own description says glucose stops: critical fault, empty battery, sensor and transmitter temperature, no sensor detected, invalid sensor, calibration past due or expired, transmitter end of life, glucose suspended, sensor retired. Glucose-level and informational alarms are skipped. error.code is the alarm name and metadata.alarmCode its raw code. None are marked fatal.
  • Device. Transmitter alarms are recorded under the transmitter ID, sensor alarms under the sensor ID.
  • sensorEnd. Sent once per sensor when it retires.
  • Dedup. The active alarms were already persisted, so an alarm is recorded once while it stays active.

The first commit is bastiaanv#66 (sensorStart for each new sensor), which goes upstream too. These events stay on loop-next-dev because sensorIssue and CgmEventError exist only in LoopKit next-dev.

Tests: CgmEventTests (3), SensorStartTests (2).

ps2 added 2 commits October 11, 2026 23:48
The sensorStart CGM event was guarded by hasReportedInsertionDate,
which only onboarding reset, so a new sensor on the same transmitter
never got one. Track the sensor it was sent for instead. The flag from
earlier versions is read as meaning the current sensor, so updating
doesn't resend it.
When the transmitter raises an alarm whose description says glucose
stops (no sensor detected, temperature, calibration expired, empty
battery, sensor retired and so on), send Loop a sensorIssue named for
the alarm, with its raw code. Transmitter alarms are recorded under the
transmitter ID, sensor alarms under the sensor ID. A retired sensor's
sensorEnd is sent once. The active alarms were already persisted, so
an alarm is recorded once while it stays active.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant