> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mykit.info/llms.txt
> Use this file to discover all available pages before exploring further.

# Shot Timer Integration

> Connect an SG Global Smart Shot Timer via Bluetooth and have drill results submit automatically the moment the timer stops.

## What it does

The shot timer integration connects MyKit.info to an **SG Global Smart Shot Timer** over Web Bluetooth. You never tap a submit button at the range — the flow is:

1. **Pair your timer** from the Profile page once per session.
2. **Select a drill** on the Range Day Drills tab — a Timer button appears on each drill when a timer is connected.
3. **Pick a firearm** (optional) and the app switches to the Performance tab for that drill.
4. **Run the drill** — hit the physical start button on the timer, shoot, stop.
5. **Results submit automatically** when the timer stops and appear live in the Performance tab.

## Browser support

Web Bluetooth is required. Supported environments:

| Platform                    | Browser        | Status          |
| --------------------------- | -------------- | --------------- |
| Android                     | Chrome         | ✓ Supported     |
| Desktop (Mac/Windows/Linux) | Chrome         | ✓ Supported     |
| iOS / iPadOS                | Safari, Chrome | ✗ Not supported |
| Firefox / Safari (desktop)  | —              | ✗ Not supported |

iOS support is planned via the Expo mobile companion app.

## How results are stored

Shot timer results share the same `range_drill_results` table as manually logged and watch-sourced results. They are tagged `source = shot_timer` and show a **Shot Timer** badge in the Performance tab. Per-shot split times are stored alongside each result and expandable in the results list.

<Note>
  The `passed_par` flag is computed server-side from the drill's par time — the same logic used for watch and manual results.
</Note>

***

## Pairing

### Supported devices

The integration works with the **SG Global Smart Shot Timer** (Sport and GO models). The timer advertises via Bluetooth as `SG-SST4A…` (Sport) or `SG-SST4B…` (GO). MyKit scans for any device whose name starts with `SG-SST4`.

### Connect your timer

1. Open **Profile** (`/dashboard/profile`).
2. Scroll to the **Shot Timer** section — above Connected Watches.
3. Click **Pair Timer**.
4. A browser Bluetooth picker appears — power on your SG timer and select it from the list.
5. The section updates to show **● Connected · \<device name>** once the link is established.

<Note>
  Chrome requires Bluetooth permission the first time. If the picker appears but the timer isn't listed, make sure the timer is powered on and within \~10 m.
</Note>

### Disconnect

Click **Disconnect** in the Shot Timer section of the Profile page. The connection is session-scoped — it clears automatically when you close or refresh the tab.

### Connection scope

Web Bluetooth connections are tied to the browser tab. Pairing on the Profile page establishes a connection that persists across client-side navigation (Range Day, Performance tab, etc.) for the duration of the session. If you navigate to an external page or refresh, you will need to pair again.

### Pairing troubleshooting

| Symptom                                                   | Fix                                                                        |
| --------------------------------------------------------- | -------------------------------------------------------------------------- |
| Bluetooth picker doesn't open                             | Verify Chrome has Bluetooth permission in your OS/browser settings         |
| Timer not listed in picker                                | Power-cycle the timer; confirm no other device is actively connected to it |
| Shows connected but Timer button doesn't appear on drills | Refresh the Range Day page after pairing                                   |

***

## At-Range Workflow

### Before you head to the range

* Make sure you're using **Chrome on Android** or **desktop Chrome**.
* Create the drill in Range Day if you haven't already (name, par time, round count).
* Add the firearm you'll be shooting in the Armory.

### Step-by-step

<Steps>
  <Step title="Pair your timer">
    Open **Profile → Shot Timer** and click **Pair Timer**. Select your SG timer from the Bluetooth picker. The section shows **● Connected** once linked.
  </Step>

  <Step title="Go to Range Day → Drills">
    Navigate to Range Day and open the **Drills** tab. Each drill now shows a blue **Timer** button alongside Watch and Log.
  </Step>

  <Step title="Click Timer on your drill">
    A firearm picker appears. Select the firearm you're shooting (or leave it blank) and click **Start**.
  </Step>

  <Step title="Wait for the Performance tab">
    The app switches to the Performance tab for that drill, filtered to your selected firearm, and shows a **● Live** indicator.
  </Step>

  <Step title="Shoot the drill">
    Hit the physical start button on your SG timer. Shoot. The timer stops automatically (or you stop it manually).
  </Step>

  <Step title="Result appears automatically">
    MyKit receives the `SESSION_STOPPED` event over Bluetooth, saves the result, and it appears in the Performance tab immediately — no tapping required.
  </Step>

  <Step title="Repeat">
    Hit the timer button again for the next rep. Results keep streaming in as long as the Bluetooth connection is active.
  </Step>
</Steps>

### PAR time

If the selected drill has a PAR time set, MyKit writes it to the timer's PAR setup before the session so the timer beeps at par automatically. No manual configuration on the timer is required.

### Adding notes

Notes are added after the fact — not at the range. From the Performance tab, click **Edit** on any result and enter notes in the form.

### Session reset

The active drill and firearm selection clears when you navigate away from Range Day or disconnect the timer. To start a new drill, click the **Timer** button on a different drill from the Drills tab.

***

## Troubleshooting

### Connection issues

| Symptom                                                | Fix                                                                                                                            |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| Bluetooth picker doesn't open when clicking Pair Timer | Ensure Chrome has Bluetooth permission in Android Settings → Apps → Chrome → Permissions, or macOS System Settings → Bluetooth |
| Timer not listed in the Bluetooth picker               | Power-cycle the timer. Confirm no other device (phone, another browser tab) is actively connected to it                        |
| "Timer disconnected" message mid-session               | Stay within \~10 m of the device; avoid large metal obstructions between the phone and timer                                   |
| Timer button not visible on drills                     | The timer must be connected (paired from Profile) before the button appears — refresh after pairing if needed                  |

### Submission issues

| Symptom                                | Fix                                                                                                                    |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Result not saved after the timer stops | Check network connectivity; the result is submitted as soon as `SESSION_STOPPED` fires over BLE                        |
| Result saved but shows no time         | Ensure the drill was started with the physical button — MyKit records time from the `SESSION_SET_BEGIN` (buzzer) event |
| Shot count is 0                        | The timer must send `SHOT_DETECTED` events; check that the microphone/sensor isn't blocked                             |
| passed\_par shows wrong value          | Verify the drill's PAR time is set correctly in Range Day → Drills → Edit                                              |

### Performance tab issues

| Symptom                                | Fix                                                                                        |
| -------------------------------------- | ------------------------------------------------------------------------------------------ |
| Live indicator not showing             | The active session clears if you navigate away; return to Drills and click Timer again     |
| New results not appearing in real time | Check that Supabase Realtime is connected (look for network errors in the browser console) |

### iOS / Safari

Web Bluetooth is not supported on iOS Safari or any iOS browser. The shot timer feature is unavailable on iPhone and iPad until the Expo mobile app ships. Use Chrome on an Android device or a laptop at the range.

### Still stuck?

Open the browser developer console (F12 → Console) and look for errors prefixed with `BLE` or `shot-timer`. Share those with support.
