get device history

This block is part of the globals group and was last modified in core v15.0.0.

get device history v15.0.0

Returns recorded readings for one capability of one device, optionally bucketed for charting.

In pins 5 + flow
  • flow v15.0.0
    flow
  • device v15.0.0
    value

    Device id, native address, or exact device name. Leave empty to use the device picked on the block.

  • capability required v15.0.0
    value

    Suggestions: temperature humidity power_watts energy_kwh occupancy contact battery illuminance

  • from v15.0.0
    date

    Start of the window. Defaults to 24 hours ago.

  • to v15.0.0
    date

    End of the window. Defaults to now.

  • buckets v15.0.0
    number

    How many aggregated windows to return. 0 returns raw readings only.

Out pins 6 + flow
  • flow v15.0.0
    flow
  • readings v15.0.0
    array

    Raw stored readings, oldest first: {device_id, capability, value, text, at}.

  • buckets v15.0.0
    array

    Aggregated windows, when buckets > 0: {at, min, max, avg, last, delta, count}.

  • count v15.0.0
    number
  • recording v15.0.0
    condition

    False when nothing is being stored for this device and capability : an empty result then means 'not recorded', not 'nothing happened'. Two things make it false: a capability this node never records, and a device that has not been adopted, because the recorder ignores unadopted devices entirely.

  • unit v15.0.0
    value

    Display unit, e.g. °C or kWh.

  • error v15.0.0
    value

Reads the device analytics store, which records CHANGES rather than every report: alarms and states on transitions, measurements past a per-capability deadband plus a heartbeat, meters at a fixed interval. So the readings are a faithful record of what changed, not a sample of what was said. `buckets` > 0 additionally returns aggregated windows whose shape follows the capability kind : a meter reports `delta` (consumption per window) because its raw lifetime total is a meaningless ramp, an alarm's `avg` is the fraction of the window it was true, everything else gets min/max/avg/last. Empty windows are omitted rather than zero-filled: a gap means the device did not report, and drawing it as zero invents a reading. Returns empty with recording=false on a node with analytics switched off.

zigbee
zwave
matter
thread
hue
smart home

get device history reads the analytics store, which records what CHANGED rather than every report. With from and to left empty the window is the last 24 hours, and buckets set to 24 additionally returns one aggregated window per hour on the buckets pin. Watch the recording pin: it is false when this node stores no history for that capability, which is a different answer from "nothing happened".

Studio canvas example for the get device history block: a day of temperature, bucketed for a chart.

Used in these guides

These documentation pages use or explain this block:

Version history

Introduced in v15.0.0.


Back to globals Return to the main group to view all sub-groups Back to home Return to the group to view all blocks within this group