historyMax

The highest logged value of a tag over a time range.

Read scripts only. Part of the virtual tag expression reference.

Returns the highest value a tag was logged at over a time range, from its history.

historyMax(tag: string, fromTime: number, toTime?: number): number | null;

Parameters

  • tag — the path to the tag.
  • fromTime — the start of the range, as a Unix timestamp in seconds.
  • toTime — the end of the range, as a Unix timestamp in seconds. Defaults to now.

Return value

The maximum value in the range, or null if the range has no logged data.

Example

// Peak outdoor temperature over the last 24 hours
historyMax("Outdoor/Temperature", getTimeBefore("1d", getCurrentTime()));