testbench-ble
Skill235 starsChanged 3 months agoMITView on GitHub
Use this skill whenever the user needs to interact with BLE peripherals through the testbench — scanning for devices, connecting by address, writing to GATT characteristics, or checking connection status. The Pi acts as a BLE-to-HTTP bridge using bleak. Also use when sending keystrokes to BLE HID devices, triggering OTA via BLE commands, or debugging BLE connectivity. Triggers on "BLE", "bluetooth", "GATT", "NUS", "Nordic UART", "BLE scan", "BLE write", "BLE connect".
- Sends data out
In this repository17 other files it gives its agents.
- buildSkill
- commissionSkill
- defineSkill
- esp-idf-handlingSkill
- esp-pio-handlingSkill
- grill-meSkill
- harnessSkill
- sdr-receiverSkill
- setup-actionSkill
- signal-generatorSkill
- testbench-debugSkill
- testbench-installSkill
- testbench-integrationSkill
- testbench-loggingSkill
- testbench-mqttSkill
- testbench-test-handlingSkill
- testbench-wifiSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 81
Check devices array in response
- Distinctive: line 86
Write to NUS RX characteristic
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ESP32 Bluetooth LE Proxy
Base URL: $TESTBENCH_URL — see Step 0
Step 0: Point at a bench
There are several benches and their addresses move, so nothing here writes one
down. $BENCH is not usable either — a container cannot resolve mDNS.
Discover the bench and export its URL:
export TESTBENCH_URL=$(sudo python3 .claude/skills/esp-idf-handling/discover-testbench.py \
--url --name <bench-hostname>)
curl -s "$TESTBENCH_URL/api/info" # confirm before anything else--url refuses to guess when more than one bench answers, so --name is
required whenever a second bench is powered on. TESTBENCH_URL is the same
variable pytest --wt-url falls back to.
Endpoints
Request and response shapes: FSD Appendix D.5.
One BLE connection at a time — connect to a second peripheral without disconnecting the first and the call fails rather than switching.
Examples
# Scan for BLE devices (5s timeout)
curl -X POST $TESTBENCH_URL/api/ble/scan \
-H 'Content-Type: application/json' \
-d '{"timeout": 5}'
# Scan with name filter
curl -X POST $TESTBENCH_URL/api/ble/scan \
-H 'Content-Type: application/json' \
-d '{"timeout": 5, "name_filter": "<device-name>"}'
# Connect by MAC address
curl -X POST $TESTBENCH_URL/api/ble/connect \
-H 'Content-Type: application/json' \
-d '{"address": "AA:BB:CC:DD:EE:FF"}'
# Write hex data to a GATT characteristic
curl -X POST $TESTBENCH_URL/api/ble/write \
-H 'Content-Type: application/json' \
-d '{"characteristic": "6e400002-b5a3-f393-e0a9-e50e24dcca9e", "data": "48656c6c6f", "response": true}'
# Check connection status
curl $TESTBENCH_URL/api/ble/status
# Disconnect
curl -X POST $TESTBENCH_URL/api/ble/disconnectNordic UART Service (NUS) UUIDs
| UUID | Role |
6e400001-b5a3-f393-e0a9-e50e24dcca9e | NUS Service |
6e400002-b5a3-f393-e0a9-e50e24dcca9e | RX Characteristic (write to this) |
6e400003-b5a3-f393-e0a9-e50e24dcca9e | TX Characteristic (notifications from device) |
Common Workflows
- Send a command via NUS:
POST /api/ble/scanwithname_filterto find devicePOST /api/ble/connectwith the MAC address from scan resultsPOST /api/ble/writewith NUS RX UUID and hex-encoded commandPOST /api/ble/disconnectwhen done
- Check if device is advertising:
POST /api/ble/scanwith short timeout and name filter- Check
devicesarray in response
- Send binary command protocol:
- Connect to device
- Encode command bytes as hex (e.g.,
0x02+ "Hello" =0248656c6c6f) - Write to NUS RX characteristic
- Monitor device response via serial or UDP logs (see testbench-logging)
Troubleshooting
| Problem | Fix |
| "BLE not available" | bleak not installed on testbench Pi |
| Scan returns empty | Increase timeout; check device is advertising |
| Connect fails (409) | Already connected — disconnect first |
| Write fails "invalid hex data" | Data must be hex string (e.g., "48656c6c6f" for "Hello") |
| Device not found by name | Check exact advertised name; BLE names are case-sensitive |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

