Copy it now: it is shown only once. If you lose it, rotate it to get a new one.
{{ new_token }}
Put it in the firmware's secrets.h, next to the Wi-Fi credentials:
#define MAMADACHI_SYNC_URL "{{ base_url }}/api/v1/device/sync"
#define MAMADACHI_TOKEN "{{ new_token }}"
Or test it from your computer, pretending to be the device:
python tools/fake_device.py --url {{ base_url }} --token {{ new_token }} press 6
python tools/fake_device.py --url {{ base_url }} --token {{ new_token }} sync
mmd_…{{ dev.token_hint }}| When | Presses | Battery | Signal | Clock | Server time |
|---|---|---|---|---|---|
| {{ f.when(r.received_at) }} | {{ r.events_new }}{% if r.events_received != r.events_new %} ({{ r.events_received - r.events_new }} repeat){% endif %} | {{ '%.2f V' % (r.battery_mv / 1000) if r.battery_mv else '–' }} | {{ r.rssi if r.rssi is not none else '–' }} | {{ '%+d s' % r.clock_skew_s if r.clock_skew_s is not none else '–' }} | {{ r.duration_ms if r.duration_ms is not none else '–' }} ms |
Each device gets its own secret token. It sends it with every sync, so the server knows the presses are really from your Mamadachi.
POST {{ base_url }}/api/v1/device/sync
Authorization: Bearer mmd_…
Content-Type: application/json
{"device_time": 1760630400, "firmware": "0.1.0", "battery_mv": 3987,
"charging": false, "rssi": -61, "boot_count": 42, "queue_len": 0,
"events": [{"seq": 101, "time": 1760620000, "button": 6},
{"seq": 102, "time": 1760627000, "button": 6}]}
server_time (set the RTC if it drifted), tz_offset_s (to show local time), the buttons layout with short labels for the e-paper, and a status block: last feed, next side, ongoing sleep, today's counts.Current layout: {% for n, k in buttons.items() %}{{ n }}: {{ k.short if k else '–' }} {% endfor %}
Full field reference: API docs.