User Tools

Site Tools


wiki:value

VALUE() Function

The VALUE() function can be used in a variety of ways to get variable values.

Usage:

VALUE(variable, options, [max]) - see below for description.

Generic Variables (per device type)

VALUE('INC1_AE')

Get the latest value of the current device's variable named INC1_AE. Make sure to put variable names in single quotes if they contain spaces.

Device - Specific Variables

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

VALUE('My Device.My Value')

Get the value of the variable 'My Value' in the device 'My Device'

Special Variables

You can also use VALUE('user_field1') to access the user defined field. These values are entered when you edit a device and can contain device specific static information. The list of special device-specific variables available are as follows:

Variable Description
device_key MAC ADDRESS
remote_ip IP Address of wattmon
last_access last update timestamp
tz_offset GMT Offset in seconds
geo_lat Latitude of device
geo_lon Longitude of device
user_field1 User Defined field 1

Option Parameters

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

0 latest value (Default)
5 Period (in graph) - gets the value at the end of the selected segment in a graph
7 latest value for selected period

The third optional parameter [max] allows you to specify a maximum value for the data point, and if the value is greater than this the result will be 0. This is to help in cases where incorrect data may come in from sensors are other devices.

Example

Get the latest value of two watt hour counters and scaled them to kWh

(VALUE('delta0_wh',7)+VALUE('delta1_wh',7)) / 1000

wiki/value.txt · Last modified: 2020/07/23 04:13 by admin