Skip to content

Poll the RileyLink battery level on every pump data refresh - #42

Open
scrappy wants to merge 1 commit into
LoopKit:mainfrom
scrappy:lk-poll-rileylink-battery
Open

scrappy wants to merge 1 commit into
LoopKit:mainfrom
scrappy:lk-poll-rileylink-battery

Conversation

@scrappy

@scrappy scrappy commented Oct 24, 2026

Copy link
Copy Markdown

MinimedPumpManager.checkRileyLinkBattery() is only called from updatePumpStatus(_ status: MySentryPumpStatusMessageBody, …), so for a pump without MySentry the RileyLink battery level is read only when the RileyLink device screen is opened, and hosts that show the link battery elsewhere never get a value. OmniPumpManager.ensureCurrentPumpData() already calls the equivalent every cycle for Eros / RileyLink keep-alive pods.

This calls checkRileyLinkBattery() from ensureCurrentPumpData() as well, so the level refreshes once per data refresh (~5 min). RileyLinkBluetoothDevice.updateBatteryLevel() is a no-op for a device without the battery characteristic, so devices that do not expose one are unaffected. One extra BLE characteristic read per cycle on the RileyLink link; the pump radio session is untouched.

Reported against iAPS (Artificial-Pancreas/iAPS#263), which consumes this framework through a fork that tracks main here; the fork has the same change (Artificial-Pancreas#14).

checkRileyLinkBattery() was only called from the MySentry status path, so
without MySentry the link battery was read only when the RileyLink detail
screen was opened and the Home header never showed it. Call it from
ensureCurrentPumpData(), as OmniPumpManager already does each cycle.

Fixes Artificial-Pancreas/iAPS#263

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@ps2 ps2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and it matches what OmniPumpManager does each cycle. One behavior note for the description: each successful read reaches device(_:didUpdateBattery:), so users without MySentry who have set a RileyLink battery alert level will now get the 'Low RileyLink Battery' alert, repeating hourly. That's presumably intended. Also, Loop builds MinimedKit from next-dev. Could this target dev, or be cherry-picked there after merging to main?

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.

2 participants