# Deploy & Run on Device (v0.7+ Dashboard)

## Board Discovery (.112 case)

User said "ip ending on 112". Local subnet found via `ifconfig` -> `192.168.68.114/24`, so target is `192.168.68.112`.

Discovery recipe:
```bash
arp -a | grep 112
# ping sweep
for cand in 192.168.68.112 192.168.1.112 192.168.0.112; do
  ping -c1 -W 500 $cand
  curl -m2 -s http://$cand/ | head
done
```

Found: port 80 responds with HTTP 302 -> `/dashboard.html`. Port 6666 (old dev port) Connection refused.

## Install Endpoint Change

`tactility.py` (tool v3.5.1) still tries `POST http://<ip>:6666/app/install`. That requires Developer mode enabled on device (Settings > Development > Enable dev server). When disabled, install fails with:

```
❌ Install request failed: HTTPConnectionPool(host='192.168.68.112', port=6666): ... Connection refused
```

Firmware v0.7.0-dev Dashboard is on port 80 with new API:

- Discovered via browser devtools / `document.documentElement.innerHTML` JS fetch search:
  - `GET /api/apps` -> list
  - `PUT /api/apps/install` multipart field `file`
  - `POST /api/apps/run?id=<appId>`
  - `POST /api/apps/uninstall?id=<appId>`
  - `/api/sysinfo`, `/api/screenshot`, etc.

### Working install via curl / python

```bash
curl http://192.168.68.112/api/apps | jq

# PUT, not POST
curl -X PUT http://192.168.68.112/api/apps/install \
  -F "file=@build/BibleVerse.app;type=application/octet-stream"
# => 200 ok
```

Python:

```python
import requests, pathlib
ip="192.168.68.112"
path="build/BibleVerse.app"
with open(path,'rb') as f:
    r=requests.put(f"http://{ip}/api/apps/install",
                   files={'file': ('BibleVerse.app', f, 'application/octet-stream')},
                   timeout=120)
    print(r.status_code, r.text[:500])
# run
requests.post(f"http://{ip}/api/apps/run?id=one.tactility.bibleverse", timeout=10)
```

## Platform Arg Required

`tactility.py Apps/MyApp install <ip>` without platform tries all `manifest platforms` (esp32s3,esp32p4) -> fails if only esp32s3 ELF built:

```
❌ ELF file not built for esp32p4
```

Fix: always pass platform explicitly matching what you built:

```bash
tactility.py Apps/BibleVerse install 192.168.68.112 esp32s3
# or
tactility.py Apps/BibleVerse build esp32s3,esp32p4 --local-sdk   # build all first
```

## Browser Verification Recipe

Use Hermes browser tools:
```js
// navigate to http://<ip>/dashboard.html -> Apps tab
document.documentElement.innerHTML.match(/\/api\/apps[^\s"']*/g)
// returns ["/api/apps", "/api/apps/run?id=", "/api/apps/uninstall?id=", "/api/apps/install"]
// inline scripts contain:
function installAppFile(file) { fetch('/api/apps/install', {method:'PUT', body: formData}) }
```

This avoids guessing old docs.

## Checklist After Install

- [ ] GET /api/apps contains your app id
- [ ] POST /api/apps/run?id= -> 200 ok (app shows on device)
- [ ] If install via dashboard UI: drag .app onto upload zone works same as PUT
