Skip to content

Switch Loop profiles from the Loop remote screen - #790

Merged
marionbarker merged 5 commits into
devfrom
feature/loop-remote-profile-switch
Oct 30, 2026
Merged

marionbarker merged 5 commits into
devfrom
feature/loop-remote-profile-switch

Conversation

@bjorkert

@bjorkert bjorkert commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Adds a Profiles button to the Loop remote screen for switching Loop to one of the profiles saved with the profiles customization. It needs Loop built with the profiles customization that includes remote switching (loopandlearn/customization#107).

The button is blue when Loop lists profile-switch in loop.testingDetails.remoteCommands, and grey otherwise; tapping the grey button explains that the profiles customization is needed. The list shows the saved profiles from Loop's latest profile upload with the active one marked. Selecting one shows its correction range, carb ratios, basal rates with the daily total and insulin sensitivities, like Loop's own preview. Activate asks for confirmation and sends an OTP-protected command with a fingerprint of the shown values, so Loop only activates what was previewed. LoopFollow waits up to three minutes for Loop's return push and shows the outcome, including Loop's reason on failure. Replies are matched by profile name, so a late reply for one profile does not resolve a switch to another. A missing reply is shown as unknown, not as a failure, because the switch may still complete. The profile list refreshes after a successful switch.

Like carb edit and delete, the command requires LoopFollow's own APNS credentials so Loop can reply. The shared message for that case now says "This command" instead of naming carb entries.

Tested in the simulator against a local Nightscout and APNs stand-in with a next-dev Loop build carrying the profiles customization: switch, pump failure, profile changed after upload and the greyed-out button. Unit tests cover the payload, the fingerprint (same vector as the Loop side), the profile list and reply matching.

Remote screen, saved profiles, preview and confirmation:

01_remote_enabled 02_list 03_preview 04_confirm

Waiting for Loop, success, and the list after Loop uploaded the switched profile:

05a_waiting 05_success 06_list_after

Pump communication failure, profile changed in Loop after upload, and a Loop build without the customization:

07_pump_failure 08_changed 09_unavailable 10_unavailable_info

Adds a Profiles button that lists the profiles Loop uploads to Nightscout, previews one the way Loop does and sends an OTP-protected profile switch with a fingerprint of the previewed values. Loop's return push is matched by profile name. The button is greyed out with an explanation when Loop does not list profile-switch in remoteCommands.

@marionbarker marionbarker left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

❌ An authorization on the LoopFollow phone must be required before allowing remote change of profile.

Loop phone is main branch (v3.14.11) plus the one customization profiles using the remote_profile branch.

LoopFollow phone is feature/loop-remote-profile-switch 985338e

@marionbarker

Copy link
Copy Markdown
Collaborator

Test

✅ When the Loop on the other side of the NS URL that LoopFollow is following does not have the customization, the icon for Profiles is not blue and when you tap on it the message is clear.
✅ When Profile switch is requested, user must authenticate on the LoopFollow phone

  • After authentication, if the Loop phone fails to load the new profile, ✅ the message "Profile Not Activated; Command failed, 'name' not activated: Pod not connected" is returned
  • After authentication, if the Loop phone succeeds in loading profile, ✅ the message "Profile Activated; Profile 'name' activated.
    • works even when Pod was deactivated because Loop allows Therapy to be changed as long as pump manager is installed
    • tested with another pump manager, Medtrum simulator

❌ This is on the customization side, I think

  • On the Loop phone, I can see the therapy changed to the expected profile therapy settings
  • But the name of the profile on the Loop side indicates the Profile is outdated when I tap on Profiles

@marionbarker

Copy link
Copy Markdown
Collaborator

Test

The customization was updated.
The error noted in last comment happened on the Loop phone - it was not related to the remote switch.

Built new code on the Loop phone with the customization updated to loopandlearn/customization@2a2013a

✅ On Loop phone, load a saved profile, return to profile row and note that the current profile is indicated and does not report that it needs to be updated
✅ On LoopFollow phone, load saved profile - check on Loop phone, therapy is updated to new profile and profile shows the correct name
✅ When profile is modified on Loop Phone, the LoopFollow phone updates promptly with the correct profile showing the Active flag

@marionbarker marionbarker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve by code review and test.
When the customization is not applied or not available, the Profile feature shows as not available. So this can be merged independently.

@marionbarker

Copy link
Copy Markdown
Collaborator

Test

After the customization was updated, test main and next-dev independently

Test with customization on Loop phone

Customization is applied on Loop phone.
Build LoopFollow on the phone following that Loop URL with feature/loop-remote-profile-switch

@marionbarker
marionbarker merged commit 3c6117c into dev Oct 30, 2026
1 check passed
@marionbarker
marionbarker deleted the feature/loop-remote-profile-switch branch October 30, 2026 12:34
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