diff --git a/CLAUDE.md b/CLAUDE.md index 01143f9..66d0431 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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. diff --git a/README.md b/README.md index 6854f33..28539ab 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/daemon/claude-usage-daemon.sh b/daemon/claude-usage-daemon.sh index 0663904..c0ab0bf 100755 --- a/daemon/claude-usage-daemon.sh +++ b/daemon/claude-usage-daemon.sh @@ -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 diff --git a/daemon/claude_usage_daemon.py b/daemon/claude_usage_daemon.py index 311bedb..a207961 100755 --- a/daemon/claude_usage_daemon.py +++ b/daemon/claude_usage_daemon.py @@ -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" diff --git a/firmware/src/ble.cpp b/firmware/src/ble.cpp index 14d0a0f..b9a4642 100644 --- a/firmware/src/ble.cpp +++ b/firmware/src/ble.cpp @@ -3,7 +3,7 @@ #include #include -#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. diff --git a/install-mac.sh b/install-mac.sh index 4303c02..6235bdb 100755 --- a/install-mac.sh +++ b/install-mac.sh @@ -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:" diff --git a/install.sh b/install.sh index 2357258..c1d51ef 100755 --- a/install.sh +++ b/install.sh @@ -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 " echo " 5. Run: bluetoothctl trust " echo " 6. Start the daemon: systemctl --user start $SERVICE_NAME"