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

  1. Visit Telemetry Harbor and sign up for a new account
  2. Verify your email address through the confirmation link
  3. Log in to access your dashboard

Create a Location Tracking Harbor

  1. Click Create Harbor in the top right corner
  2. Name your harbor something descriptive like "iPhone_Location_Tracker"
  3. Select General as the harbor type
  4. Choose Free for Harbor Specifications (or upgrade as needed)
  5. Click Create Harbor to finalize setup

Gather Your API Credentials

  1. From your harbor list, click View Details on your newly created harbor
  2. 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

  1. On your iPhone, visit the RoutineHub link
  2. Tap Get Shortcut to download the automation
  3. 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

  1. Open the Shortcuts app on your iPhone
  2. Find the "iPhone Location Tracker - Telemetry Harbor" shortcut
  3. Tap the three dots (⋯) to edit the shortcut workflow
  4. Look for the Get Contents of URL actions (there are two - one for latitude, one for longitude)
  5. 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

Step 3: Testing Your Location Tracking

First Test Run

  1. Ensure your iPhone has location services enabled
  2. Tap your configured shortcut
  3. Grant location access when prompted
  4. 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

  1. Open the Grafana Endpoint URL from your harbor details
  2. Log in with your Grafana Username and Grafana Password
  3. Navigate to DashboardsComprehensive Telemetry Dashboard

Configure Location Visualization

  1. Select your harbor as the data source
  2. Filter by your device's ship_id
  3. In cargo_id filter choose both Longitude and Latitude
  4. Adjust time ranges to see historical location patterns
  5. 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

  1. Open the Shortcuts app and tap the Automation tab
  2. Tap Create Personal Automation
  3. Choose your trigger (e.g., "Arrive" for location-based)
  4. Configure the trigger conditions
  5. Add your location tracking shortcut as the action
  6. 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
}
💡
For more details on how to interact with the Telemetry Harbor API to push data, visit the official documentation: Pushing Data to Telemetry Harbor API

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.