This repository contains the GarminService Plugin for the Loop iPhone app. This plugin provides real-time glucose data integration from the Loop app to Garmin devices, particularly useful for athletes like cyclists who require constant glucose monitoring without internet reliance.
Disclaimer: This is a DIY project intended for personal use. It is NOT a medical device and should not be used to make any medical decisions or treatments. The code comes with no guarantees of reliability or accuracy, and its use is entirely at the risk of the user. This service has been only partially tested and could cause Loop to crash, though this did not occur during testing. The creators and contributors take no responsibility for any outcomes resulting from the use of this plugin.
Garmin.prg
file from this repository.Garmin.prg
file to the Apps
folder of your Garmin device. Safely disconnect (eject) the Garmin device from your computer.sugar
to your Garmin data screens. You will find this under the Connect IQ section.The Garmin Service plugin (this repository) must be integrated into the Loop Workspace so that when you build Loop with Xcode, it will include this service plugin into the Loop application. I already made this integration. Therefore, the installation is almost identical with the official build instructions except that we pull the LoopWorkspace from my private fork:
git clone --branch=garminservice --recurse-submodules https://github.com/janvv/LoopWorkspace.git
LoopWorkspace.xcworkspace
file from the cloned folder in Xcode cd LoopWorkspace
xed .
LoopConfigOverride
file in Xcode's project navigator uncomment the LOOP_DEVELOPMENT_TEAM
, and replace the existing team id with your own id.LoopConfigOverride.xcconfig
to install a second instance of Loop and try it out.Enable the Upload Readings
toggle in Loop's CGM settings. If this setting is off, the Garmin Service won't receive continous CGM data. This setting needs to be re-activated every time a new CGM is connected. Use the code customizations to avoid this and have the upload always active.
Note: To remove any doubt: GarminService in no way uploads data anywhere except sending it to your GarminDevice. This toggle is only necessary because the way Loop handles uploads to remote services:
Explanation: Garmin Service uses the RemoteDataService
class which is also used by services like the NightScout Service to upload data to the cloud. Loop added this toggle for users that want to exclude CGM data from being uploaded to avoid duplication when CGM data is already imported through a different service. If the toggle is off, the services don't receive CGM data updates. In our case, we need them of course. This might exclude users from using the GarminService who need the toggle to be disabled. I think a better way to do this in Loop would be to move the toggle to the service itself rather than having one toggle that impacts all services.
Settings
→ Services
→ Add Services
→ Garmin Service
.The GarminService Plugin integrates with several repositories and codebases. Below are links to the relevant repositories and their descriptions:
LoopWorkspace Fork: This fork of LoopWorkspace includes the GarminService as a submodule and modifications to Loop's delegate to handle connections to Garmin Connect. Use this fork to build Loop with GarminService support.
GarminService Repo: (this repository). It contains the source code for the GarminService, a Loop plugin, which facilitates the communication between Loop and Garmin devices via Bluetooth, enabling real-time glucose data transmission.
CandyMountain Repo: provides the necessary Garmin datafield for displaying glucose data. This project was the early attempt to send glucose data directly from apple health. While this attempt didn't succeed as apple health becomes unaccessible while the phone is locked, it still cointains the code and a precompiled datafield called "sugar" for the datafield used in this project.
Historical Background: The basis for this project was CandyMountain. It's a companion iOS app that reads glucose data directly from Apple Health and sends it to the Garmin datafield. The datafield is still the one that we are using here. However, the approach failed due to Apple Health becoming inaccessible when the phone is locked, which rendered the app unusable for background glucose monitoring. Therefore, integrating with Loop directly became a more reliable solution to achieve real-time, background glucose tracking without these limitations.
This service was built using the structure of the Loogly Service and Nightscout Service, both of which upload glucose data to the cloud via the RemoteDataService. Special thanks to the original authors of these services for their contributions to the Loop ecosystem.
Feel free to open issues or discussions on this repository for any questions or feedback. This is an open-source DIY project, and contributions are welcome!
All rights reserved © Jan Wrede 2024.
Permission is hereby granted to view and use the code in this repository for personal, non-commercial purposes only. No part of this project may be reproduced, distributed, or used for commercial purposes without explicit written permission from the author. Modification and redistribution of the source code are allowed for personal use only.
This project is provided “as-is” without any warranties or guarantees, including but not limited to reliability, accuracy, or fitness for a particular purpose. The author is not liable for any damage or loss resulting from the use of this code or project.
For further permissions or inquiries, contact the author directly.