Historical & Map Data
Fetch recorded datastream values and location tracks for a period.
Periods — both methods take the same period values:
'ONE_HOUR', 'SIX_HOURS', 'DAY', 'WEEK', 'MONTH', 'THREE_MONTHS', 'SIX_MONTHS', 'ONE_YEAR'
A fixed window ending now
'CUSTOM'
An explicit from / to range in Unix milliseconds
'RANGE_PICKER'
Web only (isRangePickerSupported()). Follows the dashboard's date-range picker and keeps pushing new results — see below
Get historical data
Returns recorded values of up to 10 datastreams for a period, raw or aggregated.
bridge.getHistoricalData(options) // → Promise<HistoricalDataResult>Parameters
options.from
number
CUSTOM only
Start of the range, Unix ms
options.to
number
CUSTOM only
End of the range, Unix ms. Must be strictly greater than from; the span must not exceed 365 days
options.offset
number
no
Number of points to skip, for RAW_DATA pagination. Non-negative integer, default 0
options.dataStreams
array
yes — for every period, RANGE_PICKER included
1 to 10 datastream descriptors
options.dataStreams[].index
number
yes
0-based datastream index
options.dataStreams[].sourceType
string
yes
'RAW_DATA', 'MIN', 'MAX', 'AVG', 'SUM' or 'COUNT'
sourceType values:
RAW_DATA
Individual recorded points, no aggregation. granularity is null for these streams
MIN, MAX, AVG, SUM
Minimum, maximum, average or sum per time bucket
COUNT
Number of points per time bucket
Resolves with
The server picks the bucket size from the period and sourceType. Null-check granularity before you display it.
Rejects with
All validation runs before anything is sent, and fails with code invalid_request. Branch on code; the messages below are current but not a stable API.
options or period missing
'period' is required
Unknown period
'period' must be one of: …
CUSTOM without from or to
CUSTOM period requires 'from' and 'to' timestamps
from / to not a finite number
'from' must be a finite number / 'to' must be a finite number
from >= to
'from' must be less than 'to' — equal timestamps are rejected too
Span over 365 days
'to' - 'from' must not exceed one year (365 days)
Bad offset
'offset' must be a non-negative integer
dataStreams not an array
'dataStreams' must be an array
dataStreams empty or longer than 10
'dataStreams' must carry from 1 to 10 datastreams
dataStreams[N] not an object
dataStreams[N] must be an object
Bad dataStreams[N].index
dataStreams[N].index must be a non-negative integer
Bad dataStreams[N].sourceType
dataStreams[N].sourceType must be one of: RAW_DATA, MIN, MAX, AVG, SUM, COUNT
Other codes: request_timeout (no result within 30 seconds — Historical data request timeout (30s)), server_error, device_unavailable, bridge_destroyed.
Out-of-range indexes are not reported per entry. If every dataStreams[].index is past the widget's list, the call rejects (No valid datastream indexes). If only some are, it resolves without those streams and without an error — validate indexes against getValues() if you need to detect that.
Example
RANGE_PICKER (web only)
RANGE_PICKER hands range selection to the dashboard's own date-range picker. It is a subscription:
The first
getHistoricalData({ period: 'RANGE_PICKER', dataStreams: […] })call registers the widget and resolves with the data for the range the picker shows now.Every later picker change pushes a fresh result to
onHistoricalDataUpdated. Those pushes are not Promise resolutions.
Register
onHistoricalDataUpdatedbefore subscribing, so the first push isn't lost.dataStreamsis required here too.
Get map data
Returns the recorded location points of a
LOCATIONdatastream for a period.
Parameters
options.index
number
yes
0-based index of an assigned LOCATION datastream
options.from
number
CUSTOM only
Start of the range, Unix ms
options.to
number
CUSTOM only
End of the range, Unix ms. Must be strictly greater than from. There is no 365-day cap
Resolves with
Map data is never aggregated and takes no sourceType.
Rejects with invalid_request ('index' is required, a non-integer index, or the same period and range rules as getHistoricalData), request_timeout (30 seconds — Map data request timeout (30s)), server_error, device_unavailable, bridge_destroyed. An index that isn't a LOCATION datastream fails on the host side.
Example
Was this helpful?

