Sensors values from last message

To get sensors value from the last message, use the command unit/calc_last_message:

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

Parameters

Name Description
unitId unit ID
sensors array of sensors IDs (optional parameter, if not specified or empty - return values of all sensors)
flags flags (optional): if 1, then calculate sensor value by last valid param value

If there is not parameter in message, the flags = 1 will return value from last valid message.If there is parameter in messages,but the sensor is validated by table/other sensors, then it will return the NA (-348201.3876) value in any case. The other way to get always valid sensor's valye is to get event type sensors from events

Response

{
	<text>:<double|text>,	/* sensor ID: sensor value */
	...
}
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam