@camera.ui/sdk / manager / SensorManager
Interface: SensorManager ​
Defined in: manager/index.ts:273
Read access to the host's sensor registry, via api.sensorManager.
Sensors are never created here: a camera's own sensors go through camera.addSensor(), standalone sensors exist only once the user adopted them from a SensorDiscoveryProvider.
Methods ​
getSensorHistory() ​
getSensorHistory(
sensorIds,from,to):Promise<SensorHistoryEntry[]>
Defined in: manager/index.ts:299
Get what a set of sensors did during a window of time.
Returns every recorded change between from and to, and for each property also the value it already had when the window opened, because a door that was open the whole time says as much as one that opened halfway through. Entries come back oldest first.
The history is a short tail, not an archive: it is coalesced to one entry per second and capped per sensor, so a window far in the past may be gone.
Parameters ​
sensorIds ​
string[]
Sensors to read
from ​
number
Start of the window, in milliseconds
to ​
number
End of the window, in milliseconds
Returns ​
Promise<SensorHistoryEntry[]>
Recorded changes, oldest first
Example ​
const changes = await api.sensorManager.getSensorHistory([contactId], event.start, event.end);
const opened = changes.find((change) => change.property === 'detected' && change.value === true);