Table of Contents

LASTNZ() Function

The LASTNZ() function (last non-zero) can be used to get the last value and timestamp for a variable above zero or a given threshold - it returns a human readable time, a value, or a combination of the two.

Usage:

LASTNZ(variable, options, type, threshold_value)

variable - the variable name to check

options - see below

type - return type: 0 = value, 1 = time of last match, 2 = value + time of last match

val - optional - threshold value to compare against (default is 0)

Generic Variables (per device type)

LASTNZ('genset_on',1,1)

Get the last time that the genset_on variable was set today

LASTNZ('inverter_state',1,0,3)

Get the get the last inverter state that was above 3 today

Device - Specific Variables

For device specific variables use a . to separate the device name:

LASTNZ('My Device.My Value',1,2)

Option Parameters

The second parameter, [options] is a number and can be any of the following

0 Returns No Change
1 DAY - Last time the variable changed during the day
2 WEEK - Last time the variable changed during the week
3 MONTH - Last time the variable changed during the month
4 YEAR - Last time the variable changed during the current year
5 PERIOD - Last time the variable changed during the selected range
6 SLICE - Last time the variable changed during the slice in the range (i.e. in a graph segment)

Example

Get the last time the variable changed this week

LASTNZ('delta0_w',1,1,1500)

Returns the last time in the day that the value of delta0_w was greater than 1500