calc_last_message

To get a sensor value from the last message, use the unit/calc_last_message method:

Copied!
svc=unit/calc_last_message&params={"unitId":<long>,
				   "sensors":[<long>],
				   "flags":<uint>}

Parameters

The required parameters are marked with an asterisk (*).

Parameter Description
unitId* Unit ID.
sensors Array of sensor IDs. If this parameter is not specified or empty, the values of all sensors are returned.
flags Flags. If this parameter is set to 1, the sensor value is calculated using the last valid parameter value.

Response

If the request is completed successfully, the sensor value is returned.

Copied!
{
	<text>:<double|text>,	/* sensor ID: sensor value */
	...
}

Otherwise, an error code is returned.

Error codes

Error code Description
4 Failed to fetch the unit sensors.
7 Failed to fetch the unit because the user doesn’t have the required access right (ADF_ACL_AVL_UNIT_VIEW_SENSORS).

If you find a mistake in the text, please select it and press Ctrl+Enter.