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

# Bluetooth Low Energy

> Scan for a BLE peripheral, inspect its GATT services, and test reads, writes, and notifications from your computer's Bluetooth adapter.

Ask Inlay to scan for, connect to, read, write, or subscribe to a BLE peripheral through your computer's Bluetooth adapter. Inlay runs each interaction as a short [hardware script](/docs/debug-mode/hardware-scripts.md) and shows the results in the Monitor's **Bluetooth** tab. This workflow covers BLE GATT, not Bluetooth Classic.

## Prepare

1. Turn on Bluetooth on the computer running Inlay, or plug in a BLE-capable USB adapter.
2. On macOS, allow Bluetooth access for the application running Inlay, such as VS Code or your terminal. If you missed the prompt, enable it under **System Settings** > **Privacy & Security** > **Bluetooth**.
3. On Linux, make sure BlueZ is installed and running.
4. Make the target advertise. If it's connected to another central, such as a phone app, disconnect it there first.

The first time you use BLE, Inlay checks for Python 3, its own Python environment, and the `bleak` package. It asks before installing each one, with prompts such as **Install Python 3?**, **Create Inlay Python environment?**, and **Install bleak?**. If Python can't be installed automatically, install Python 3 yourself and retry.

## Open the Bluetooth tab

Run **Inlay: Open Inlay Monitor**, select **+**, then choose **Bluetooth** under **Views**.

The tab has no scan or connect controls of its own. It displays what Inlay's scripts report, so ask Inlay in chat to scan, connect, read, or subscribe, and watch the results here.

| Panel | Shows |
| - | - |
| **Scanner** | Advertising devices with name, address, signal strength, and when each was last seen. A dot marks a connected device. Select a device to show its services. |
| **GATT** | Services, characteristics with their properties, and descriptors for the selected device. |
| **Notifications** and **Events** | Values grouped by characteristic, with a decoded value, rate, and count, plus a log of scans, connections, reads, and writes. |

Select **Clear** to empty a list. Select ✎ (**Rename characteristic**) to give a characteristic a readable label. Common Bluetooth SIG characteristics, such as battery level, heart rate, temperature, and device information strings, are decoded by their specification. Other values show likely numeric interpretations.

## Scan and choose the device

```text theme={"theme":"css-variables"}
Scan for five seconds for devices advertising the name Sensor. Show the
results so I can select the intended board before connecting.
```

You can also ask Inlay to filter by advertised service UUID. A name filter matches any device whose name contains the text, so it can match several boards.

Scans are active by default: Inlay requests scan responses to get fuller name and manufacturer data. A passive scan, which sends no scan requests, works on Windows only. On macOS and Linux it fails with an error.

Use the exact address this computer reports. macOS reports a device UUID instead of a MAC address, so an address copied from another computer won't work.

## Inspect services and read a value

```text theme={"theme":"css-variables"}
Connect to the selected Sensor board, list its GATT services, and read its
battery-level characteristic. Return the raw bytes and the interpreted value.
```

Refer to characteristics by the UUIDs and properties that discovery returns. Interpret bytes using the standard service definition or your project's protocol.

Discovery also lists each characteristic's descriptors. Ask to read a descriptor when you need its description or format information. To write a descriptor, give its characteristic, descriptor UUID, and payload. To turn on notifications, [subscribe](#collect-notifications) instead of writing the descriptor yourself.

## Collect notifications

```text theme={"theme":"css-variables"}
Subscribe to the selected measurement characteristic for ten seconds. Report
the received values, then unsubscribe and disconnect.
```

Subscribing works for both notifications and indications. Subscribe before you trigger the event, and leave enough time for the expected response. Watch the **Notifications** panel for incoming values.

## Write a characteristic

> [!WARNING]
>
> A write can change configuration, start an update, or control equipment. Specify the characteristic, payload, and expected effect before requesting it.

Give the payload as hex bytes, such as `01 0A`, and choose the write type:

| Write type | When to use |
| - | - |
| Write With Response | The default. The peripheral acknowledges the write. |
| Write Without Response | The characteristic doesn't support acknowledgement, or you need faster writes. |

Verify the result with a readback or the protocol's response notification.

## Repeat a test

Ask Inlay to create a [hardware script](/docs/debug-mode/hardware-scripts.md) with the selected device, service UUIDs, duration, pass condition, and cleanup. BLE script helpers cover scanning, connecting, service discovery, characteristic and descriptor reads and writes, notifications, and signal strength.

BLE scripts must use Inlay's BLE helpers. Inlay reports an error if a script imports `bleak` directly. End the script by disconnecting; Inlay also disconnects when the script exits.

## Troubleshoot

| Symptom | Check |
| - | - |
| No devices found | Bluetooth is on, the macOS permission is granted, and the target is advertising and in range. |
| Setup stops at Python or `bleak` | Approve the install prompts, or install Python 3 yourself and retry. |
| Connection fails | Scan again and use the returned address. Disconnect any other central. |
| Characteristic not found | Ask Inlay to list services again after a firmware change. |
| No notifications | The characteristic supports notify or indicate, and you subscribed before the event. |
| Write has no effect | The payload and write type match what the firmware expects. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.