Rename BLE device "Claude Controller" → "Clawdmeter"
Brand consistency: the device now advertises as "Clawdmeter". Updated the three functional spots that must agree for discovery-by-name to work — ble.cpp DEVICE_NAME (advertised) and both daemons' DEVICE_NAME (scan match) — plus the README/CLAUDE.md/install-script references (and fixed the stray "Claudemeter" typo in the README). Note: hosts cache the GATT name, so an already-paired device keeps showing the old name until removed/re-paired (bluetoothctl remove <mac>). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
bd5d45cef3
commit
13cc4231a0
@@ -135,7 +135,7 @@ Bash daemon (`daemon/claude-usage-daemon.sh`) reads OAuth token, polls Anthropic
|
||||
|
||||
**Discovery & resilience:**
|
||||
|
||||
- Connects by name (`"Claude Controller"`) on first run, caches resolved MAC at `~/.config/claude-usage-monitor/ble-address`. ESP32 BLE addresses are factory-burned per-chip, so swapping any board invalidates the cache.
|
||||
- Connects by name (`"Clawdmeter"`) on first run, caches resolved MAC at `~/.config/claude-usage-monitor/ble-address`. ESP32 BLE addresses are factory-burned per-chip, so swapping any board invalidates the cache.
|
||||
- On connect failure: cache is dropped AND device is removed from bluez (`bluetoothctl remove`) so the next scan won't re-pick a dead MAC. Multi-candidate scans pick `head -1` and let the failure cycle converge.
|
||||
- `POLL_INTERVAL=60`, `TICK=5`. Inner loop wakes every 5s to detect disconnects fast; polls Anthropic when 60s elapsed OR when ESP fires a refresh request.
|
||||
|
||||
|
||||
@@ -92,13 +92,13 @@ The board env name is required. Run `./flash.sh` with no args to see the availab
|
||||
|
||||
### Pair the device
|
||||
|
||||
After flashing, the device advertises as "Claudemeter". Pair it once:
|
||||
After flashing, the device advertises as "Clawdmeter". Pair it once:
|
||||
|
||||
```bash
|
||||
# Scan for the device
|
||||
bluetoothctl scan le
|
||||
|
||||
# When "Claude Controller" appears, pair and trust it
|
||||
# When "Clawdmeter" appears, pair and trust it
|
||||
bluetoothctl pair F4:12:FA:C0:8F:E5 # use your device's MAC
|
||||
bluetoothctl trust F4:12:FA:C0:8F:E5
|
||||
```
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Claude Usage Tracker Daemon (BLE)
|
||||
# Reads Claude Code OAuth token, polls usage via API, sends to ESP32 over BLE GATT.
|
||||
# Auto-connects and reconnects to the Claude Controller BLE device.
|
||||
# Auto-connects and reconnects to the Clawdmeter BLE device.
|
||||
# Dependencies: curl, awk, bluetoothctl
|
||||
|
||||
DEVICE_NAME="Claude Controller"
|
||||
DEVICE_NAME="Clawdmeter"
|
||||
DEVICE_MAC="${DEVICE_MAC:-}" # auto-discovered if empty
|
||||
SERVICE_UUID="4c41555a-4465-7669-6365-000000000001"
|
||||
RX_CHAR_UUID="4c41555a-4465-7669-6365-000000000002"
|
||||
@@ -60,7 +60,7 @@ save_mac() {
|
||||
echo "$DEVICE_MAC" > "$SAVED_MAC_FILE"
|
||||
}
|
||||
|
||||
# Scan for Claude Controller
|
||||
# Scan for Clawdmeter
|
||||
scan_for_device() {
|
||||
log "Scanning for '$DEVICE_NAME'..."
|
||||
# Start LE scan
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"""Claude Usage Tracker Daemon (BLE) — macOS port of claude-usage-daemon.sh.
|
||||
|
||||
Polls Claude API rate-limit headers and writes a JSON payload to the
|
||||
ESP32 "Claude Controller" peripheral over a custom GATT service. Uses
|
||||
ESP32 "Clawdmeter" peripheral over a custom GATT service. Uses
|
||||
bleak (CoreBluetooth backend on macOS).
|
||||
"""
|
||||
|
||||
@@ -21,7 +21,7 @@ import httpx
|
||||
from bleak import BleakClient, BleakScanner
|
||||
from bleak.exc import BleakError
|
||||
|
||||
DEVICE_NAME = "Claude Controller"
|
||||
DEVICE_NAME = "Clawdmeter"
|
||||
SERVICE_UUID = "4c41555a-4465-7669-6365-000000000001"
|
||||
RX_CHAR_UUID = "4c41555a-4465-7669-6365-000000000002"
|
||||
REQ_CHAR_UUID = "4c41555a-4465-7669-6365-000000000004"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <NimBLEDevice.h>
|
||||
#include <NimBLEHIDDevice.h>
|
||||
|
||||
#define DEVICE_NAME "Claude Controller"
|
||||
#define DEVICE_NAME "Clawdmeter"
|
||||
|
||||
// Custom GATT UUIDs for data channel
|
||||
#define SERVICE_UUID "4c41555a-4465-7669-6365-000000000001"
|
||||
@@ -72,8 +72,8 @@ static void start_advertising() {
|
||||
NimBLEAdvertising* adv = NimBLEDevice::getAdvertising();
|
||||
adv->reset();
|
||||
// Primary advertising packet (≤31 bytes):
|
||||
// flags (3) + appearance (4) + HID service 0x1812 (4) + name "Claude Controller" (19)
|
||||
// = 30 bytes. macOS Bluetooth Settings only surfaces BLE-only devices
|
||||
// flags (3) + appearance (4) + HID service 0x1812 (4) + name "Clawdmeter" (12)
|
||||
// = 23 bytes. macOS Bluetooth Settings only surfaces BLE-only devices
|
||||
// that explicitly advertise the standard HID service UUID (0x1812) —
|
||||
// without it the device is recognized internally but hidden from the
|
||||
// GUI nearby-devices list.
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ echo ""
|
||||
echo "First-time Bluetooth pairing (after firmware is flashed):"
|
||||
echo " 1. Power on the device."
|
||||
echo " 2. Open System Settings → Bluetooth."
|
||||
echo " 3. Click 'Connect' next to 'Claude Controller'."
|
||||
echo " 3. Click 'Connect' next to 'Clawdmeter'."
|
||||
echo " 4. The daemon will discover it within ~30 s and start polling."
|
||||
echo ""
|
||||
echo "Useful commands:"
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ echo ""
|
||||
echo "First-time Bluetooth pairing:"
|
||||
echo " 1. Power on the SC01 Plus"
|
||||
echo " 2. Run: bluetoothctl scan le"
|
||||
echo " 3. Find 'Claude Controller' and note the MAC address"
|
||||
echo " 3. Find 'Clawdmeter' and note the MAC address"
|
||||
echo " 4. Run: bluetoothctl pair <MAC>"
|
||||
echo " 5. Run: bluetoothctl trust <MAC>"
|
||||
echo " 6. Start the daemon: systemctl --user start $SERVICE_NAME"
|
||||
|
||||
Reference in New Issue
Block a user