tiledash.history
Recorded history of a reading the tile is set to, with `history` in its Permissions: the tile’s own device, a device set in a device setting, or a reading picked in a capability, value or readings setting. Resolves to `{ points: [[time, value], …], valueKind, resolution, aggregate, from, to, limitedFrom, unit }`, or `null` when the reading isn’t recorded. Read it once on start, then add the live readings from `context`.
Syntax
tiledash.history(request)Arguments
capabilityRequired- The capability, as `measure_power`.
deviceOptional- A device id the tile is set to; the tile’s own device when left out.
fromRequired- Where it starts: milliseconds or an ISO time.
toOptional- Where it ends; now when left out.
resolutionOptional- `auto` (about a thousand points), `raw`, `1m`, `5m`, `15m`, `1h` or `1d`.
aggregateOptional- `avg`, `min`, `max`, `last`, or `delta` for meters that only count up.
Example
const history = await tiledash.history({ capability: 'measure_power', from: Date.now() - 6 * 3600_000,});const points = history?.points ?? [];