historyValue

Read a tag's logged value at a point in the past.

Available in read and write scripts. Part of the virtual tag expression reference.

Reads a tag’s logged value at a point in the past, from its history.

historyValue(tagPath: string, time?: number): number;

Parameters

  • tagPath — the path to the tag.
  • time — the Unix timestamp, in seconds, to read at. Defaults to now.

Return value

The value recorded at that time.

Example

// What the boiler temperature was one hour ago
historyValue("Boiler/Temperature", getTimeBefore("1h", getCurrentTime()));