The API
Everything is one shape: { id, pool, source, type, ts, data, meta }. You put observations in over HTTP or a WebSocket, and you read them back the same two ways or with the npm client. A key is scoped to one pool and to the verbs you chose.
Put something in
POST /api/fusion/pools/{pool}/observations with a key that carries write. The body is one observation or an array of up to five hundred. Send { source, line } and the line is parsed for you; send { source, data } and it is stored as is. A webhook sender that can only set a URL may pass the key as ?key=.
Read it back
GET …/latest folds recent observations into the current value of every field per source. GET …/observations pages the history with since, until, source and type. GET …/stream is server-sent events. wss://fusion.leumas.tech/ws/fusion is the socket: send { type: "subscribe", pool } and receive { type: "observation" } frames from then on.
From an application
npm install @leumas/fusion. const fusion = new LeumasFusion({ apiKey }); const pool = fusion.pool("my-home"); pool.on("data", o => …); await pool.getLatest(). The client speaks the socket, reconnects with backoff, and falls back to polling where a socket is blocked.
Keys and scopes
Mint a key on the pool page. It carries fusion:read, fusion:subscribe or fusion:write for that one pool. Manage — deleting the pool, minting keys, flipping visibility — needs a signed-in person, never a key.
Questions
How much history does a pool keep?
A day on the free tier, a week with a membership, a month on the Fusion plan, and never more than twenty thousand observations per pool. Longer memory is what Leumas Memory is for.
Can a rule fire on an observation?
Yes. Every observation is a Fusion observation trigger in Leumas automation: pick the pool, a source, a field and a test — temperature greater than eighty — and attach any action.