Track Your iPhone Location with Grafana Using iOS Shortcuts
In this guide, we'll show you how to install a simple iOS Shortcut that captures your current location and sends it to Telemetry Harbor, where it's instantly visualized on customizable Grafana dashboards. Whether you're a field engineer needing to log site visits, a remote worker tracking locations for compliance, or an IoT enthusiast exploring mobile telemetry, this setup provides location monitoring using nothing more than your iPhone.
By the end of this tutorial, you'll have a one-tap solution that turns your iPhone into a location beacon, complete with historical tracking, and the powerful analytics capabilities of Grafana. Let's dive in!
Requirements
Hardware:
- iPhone running iOS 14 or later
- Active internet connection (WiFi or cellular)
Software & Services:
- iOS Shortcuts app (pre-installed on modern iOS)
- Telemetry Harbor account (free tier available)
- Access to Grafana dashboards through Telemetry Harbor
Step 1: Setting Up Telemetry Harbor
If you haven't already set up Telemetry Harbor, follow these steps to create your data collection endpoint:
Create Your Account
- Visit Telemetry Harbor and sign up for a new account
- Verify your email address through the confirmation link
- Log in to access your dashboard
Create a Location Tracking Harbor
- Click Create Harbor in the top right corner
- Name your harbor something descriptive like "iPhone_Location_Tracker"
- Select General as the harbor type
- Choose Free for Harbor Specifications (or upgrade as needed)
- Click Create Harbor to finalize setup
Gather Your API Credentials
- From your harbor list, click View Details on your newly created harbor
- Copy and save the following information:
- API Endpoint (single data point endpoint)
- API Key
- Grafana Endpoint
- Grafana Username (typically your email)
- Grafana Password
Keep these credentials secure - you'll need them for both the iOS Shortcut configuration and Grafana access.
Step 2: Installing and Configuring the iOS Shortcut
Download the Pre-Built Shortcut
- On your iPhone, visit the RoutineHub link
- Tap Get Shortcut to download the automation
- When prompted, tap Add Shortcut to install it to your Shortcuts library
Understanding How It Works
The shortcut is built using iOS Shortcuts' visual workflow system with these key actions:
- Get Current Location - Captures your iPhone's GPS coordinates
- Get Current Time - Captures the current timestamp
- Text Actions - Format location and time data into JSON payloads
- Get Contents of URL - Makes HTTP POST requests to Telemetry Harbor
Configure Your API Settings
- Open the Shortcuts app on your iPhone
- Find the "iPhone Location Tracker - Telemetry Harbor" shortcut
- Tap the three dots (⋯) to edit the shortcut workflow
- Look for the Get Contents of URL actions (there are two - one for latitude, one for longitude)
- In each action, update:
- URL field: Replace
https://YOUR_ENDPOINT/
with your Telemetry Harbor API endpoint - Headers section: Replace
API-KEY-HERE
with your actual API key - Request Body: Customize the
ship_id
value to identify your device
- URL field: Replace
Step 3: Testing Your Location Tracking
First Test Run
- Ensure your iPhone has location services enabled
- Tap your configured shortcut
- Grant location access when prompted
- Watch for the success confirmation
Verify Data Transmission
Check your Grafana dashboard to confirm data is arriving correctly. You should see entries with:
- Timestamp
- Latitude/Longitude coordinates
- Ship ID (your device identifier)
- Cargo ID ("Latitude" and "Longitude")
Step 4: Visualizing Location Data in Grafana
Access Your Dashboard
- Open the Grafana Endpoint URL from your harbor details
- Log in with your Grafana Username and Grafana Password
- Navigate to Dashboards → Comprehensive Telemetry Dashboard
Configure Location Visualization
- Select your harbor as the data source
- Filter by your device's ship_id
- In cargo_id filter choose both Longitude and Latitude
- Adjust time ranges to see historical location patterns
- Scroll down to the map panel, you should see a heatmap started forming based on your iPhone location data
Step 5: Setting Up Automated Triggers
One of the most powerful features of iOS Shortcuts is the Automation tab, which can automatically trigger your location tracking shortcut based on various conditions. In the Automation tab, you can take your shortcuts to a whole new level by using triggers like time of day, location, or workout completion.
Available Automation Triggers
These automations can streamline daily routines, enhance productivity, and personalize the user experience by executing predefined actions automatically when certain conditions are met. Here are the key triggers you can use:
- Location-Based Triggers
- Time-Based Triggers
- NFC Tag Triggers
- Device State Triggers
- Activity-Based Triggers
Setting Up Your First Automation
- Open the Shortcuts app and tap the Automation tab
- Tap Create Personal Automation
- Choose your trigger (e.g., "Arrive" for location-based)
- Configure the trigger conditions
- Add your location tracking shortcut as the action
- Toggle "Ask Before Running" off for true automation
Beyond Location: Expanding Your Telemetry Toolkit
While this guide focuses on location tracking, the same iOS Shortcut framework can capture and transmit virtually any data your iPhone can access. This is just the beginning - you can modify the payload to send comprehensive telemetry data to Telemetry Harbor.
Creating Custom Payloads
The beauty of iOS Shortcuts is that you can collect any data source into a JSON payload:
{
"time": "2024-11-18T19:24:00.948Z",
"ship_id": "iPhone",
"cargo_id": "Data Label",
"value": 0 # value
}
Troubleshooting Common Issues
Shortcut Not Executing
- Check that location services are enabled for the Shortcuts app
- Verify the shortcut has permission to access location data
- Ensure the workflow doesn't have any broken or misconfigured actions
- Test each action individually using the Shortcuts app's debug mode
API Connection Issues
- Verify your API endpoint URL is correct and includes the full path
- Confirm your API key is properly formatted in the request headers
- Test with the Shortcuts app's debug mode to validate your API credentials
Data Not Appearing in Grafana
- Check the time range in your Grafana dashboard
- Verify ship_id and cargo_id filters match your shortcut configuration
- Ensure your Telemetry Harbor account has sufficient quota
Conclusion
Your iPhone is now a powerful location tracking device, pushing GPS coordinates to professional-grade monitoring dashboards. This setup transforms a simple consumer device into a tracking solution with minimal configuration and no ongoing maintenance.
The combination of iOS Shortcuts and Telemetry Harbor provides the flexibility to expand beyond basic location tracking. Consider adding weather data, device health metrics, or business process indicators to create comprehensive mobile solutions.
Ready to take mobile tracking further? Try integrating multiple data sources, setting up automated alerts, or building custom Grafana panels that combine location data with your other IoT streams. The possibilities are endless.