This shows you the differences between two versions of the page.
— |
wiki:firstnz [2021/02/02 08:15] (current) admin created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== FIRSTNZ() Function ====== | ||
+ | |||
+ | The FIRSTNZ() function (first non-zero) can be used to get the first 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: | ||
+ | |||
+ | '' | ||
+ | |||
+ | **variable** - the variable name to check | ||
+ | |||
+ | **options** - see below | ||
+ | |||
+ | **type** - return type: 0 = value, 1 = time of first match, 2 = value + time of first match | ||
+ | |||
+ | **val** - optional - threshold value to compare against (default is 0) | ||
+ | |||
+ | ===== Generic Variables (per device type) ===== | ||
+ | |||
+ | '' | ||
+ | |||
+ | Get the first time that the genset_on variable was set today | ||
+ | |||
+ | '' | ||
+ | |||
+ | Get the get the first inverter state that was above 3 today | ||
+ | |||
+ | |||
+ | ===== Device - Specific Variables ===== | ||
+ | |||
+ | For device specific variables use a . to separate the device name: | ||
+ | |||
+ | '' | ||
+ | |||
+ | |||
+ | ===== Option Parameters ===== | ||
+ | |||
+ | The second parameter, [options] is a number and can be any of the following | ||
+ | |||
+ | |0 | Returns //No Change// | | ||
+ | |1 | DAY - First time the variable changed during the day | | ||
+ | |2 | WEEK - First time the variable changed during the week | | ||
+ | |3 | MONTH - First time the variable changed during the month | | ||
+ | |4 | YEAR - First time the variable changed during the current year | | ||
+ | |5 | PERIOD - First time the variable changed during the selected range | | ||
+ | |6 | SLICE - First time the variable changed during the slice in the range (i.e. in a graph segment) | | ||
+ | |||
+ | |||
+ | ===== Example ===== | ||
+ | Get the first time the variable changed this week | ||
+ | |||
+ | '' | ||
+ | |||
+ | Returns the first time in the day that the value of delta0_w was greater than 1500 | ||
+ | |||
+ | |||
+ | |||