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";| Export | Kind | Description |
|---|---|---|
ObservationSource | type | { id, start(sink) }. start begins reporting and returns a stop function. |
SourceReading, ReadingSink | type | A reading about the source's own entity: entity, quantity, value, unit, observedAt, seq, quality. |
connectSource(scene, source) | function | Starts the source and routes each reading to the objects bound to it. Returns a Connection. |
Connection, ConnectionStats | type | source, stats(), stop(). Stats count received, latest, late, duplicate, unbound, rejected. |
fixtureSource(options) | function | Generated readings on an interval. A demo, not a device. |
pollingSource(options) | function | Calls read() on an interval; never overlaps a slow call. |
fixtureDevice(options) | function | A 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.