01 How it works (and why it's delayed)

Most events happen while Wi-Fi is off (closing a book, falling asleep). So:

  event happens --> one JSON line appended to  <plugin dir>/events.jsonl   (cheap SD write)
                                      |
                      later, when the reader is online:
                                      v
               each queued line -> your declared request -> 2xx = delivered, line removed

The queue is drained (sent):
- whenever Wi-Fi connects (any Wi-Fi connection the user makes),
- when File Transfer starts in "Join network" mode,
- at sleep entry: only for handlers that opt in with "connect": true, and always for sleep.enter. The reader then turns on Wi-Fi for up to ~10 s just to deliver.

Delivery is at-least-once and in order per plugin. A failed request stops that plugin's drain, and the rest wait for next time. Each line has a unique {event.id}. Deduplicate on it server-side.
Reader file (.txt)