# {{name}} — a tiny body ({{board}})

Scaffolded by `npx tiny-tech init --body {{slug}}` (tiny-tech {{version}}, template `esp32`).
An ESP-IDF firmware skeleton that joins tiny as a **daemon** row provisioned over USB: `tools/provision.sh`
reads the MAC, derives the board's name `tiny-XXXX` (FNV-1a — the same formula the Sticky and the Nicla use),
enrols it with your session, writes `{device_id, token, api, name, networks}` into an NVS image and flashes
everything in one run. The firmware then heartbeats over Wi-Fi.

## Commands

```bash
. ~/esp/esp-idf/export.sh            # ESP-IDF v5.x
idf.py set-target esp32s3 && idf.py build
WIFI_SSID=home WIFI_KEY=secret bash tools/provision.sh /dev/cu.usbmodemXXXX
# or, once tiny-tech knows this body's port rule: npx tiny-tech flash --body {{slug}} --port /dev/cu.usbmodemXXXX --from .
```

## Firmware contract (main/tiny_node.c)

Reads NVS namespace `tiny` key `cfg` (a JSON blob), joins the first reachable network, then every 30 s
`POST {api}/api/devices/heartbeat {"deviceId","token","capabilities":{{capabilities}}}`. A 401 means the
owner revoked the row → stop heartbeating and open the provisioning path again.
