Docs
API reference

@klorad/api/integration

The Integration layer. Sources of readings, the connection that routes them, and a simulated device.

import { connectSource, fixtureSource, pollingSource, fixtureDevice } from "@klorad/api/integration";
ExportKindDescription
ObservationSourcetype{ id, start(sink) }. start begins reporting and returns a stop function.
SourceReading, ReadingSinktypeA reading about the source's own entity: entity, quantity, value, unit, observedAt, seq, quality.
connectSource(scene, source)functionStarts the source and routes each reading to the objects bound to it. Returns a Connection.
Connection, ConnectionStatstypesource, stats(), stop(). Stats count received, latest, late, duplicate, unbound, rejected.
fixtureSource(options)functionGenerated readings on an interval. A demo, not a device.
pollingSource(options)functionCalls read() on an interval; never overlaps a slow call.
fixtureDevice(options)functionA simulated device: an ObservationSource and an Actuator in one.

fixtureSource

Prop

Type

lagMs makes a reading observed earlier than it is reported; a lag longer than the interval arrives out of order, which is how the sandbox shows late readings.

pollingSource

Prop

Type

fixtureDevice

Prop

Type

Something wrong or unclear? Tell us.