[ ] — access to the word of device status.

Description:

[ID:SUBID[.NU_OF_BYTE]]

[ID:SUBID[:{avg|min|max}{T}:{TIME}]]

The function provides the access to the word of device ID:SUBID status or to the device NU_OF_BYTE byte. When operating with the sensors by means of this function the average (avg), minimum (min) or maximum (max) value during the period TIME (seconds or minutes T) could be obtained.

List of parameters:

ID:SUBID

Device address.

NU_OF_BYTE

ID:SUBID device byte number.

avg|min|max

Functions for receiving average (avg), minimum (min) or maximum (max) value of the device.

T

«m» or «s» are minutes and seconds correspondently.

TIME

Number of specified units of time.

Example:

<item addr="524:248" MS="512:32" RGB="524:16" name="Test for setStatus function" type="script">
	
V-ID/V-ADDR
{
	if(opt0())
	{ 
		u8 strForMess[200];
		u8 *sttOfRgb = [RGB];
		u8 syzeOfRgbstt = sizeof(sttOfRgb); 

		sprintf(strForMess, "%cRGB status size - %d, the 2nd byte value -  %d", 1, syzeOfRgbstt, [RGB.1]);

		u16 msMin = [MS:mins:10];
		u16 msMax = [MS:maxs:10];
		u16 msAvg = [MS:avgs:10]; 

		sprintf(strForMess, "%s\10Move within 10 s.: min-%d max-%d avg-%d", strForMess, msMin, msMax, [MS:avgs:10]);
		sprintf(strForMess, "%s\10Max move within 10 s.: %d", strForMess, [MS:maxm:10]); 
		setStatus(@exciterId():32, &strForMess); 
	}
}
</item>

Note:

When working with sensors while sending the time parameter (T) for 1 minute or more ([ID:SUBID:{avg|min|max}m:1]) the return value for all three functions (avg|min|max) will be the same. At that the temperature and motion sensors will display maximum value for a past minute and illumination sensor will display the average value for the same period of time.

The result of performing this example:

When pressing the element script, the message with the information about number of RGB element status word bytes and with the value of its 2nd byte will appear in the interface. Data on minimum, maximum and average values of motion sensor MS per 10 seconds as well as its maximum value for the last 10 minutes will be in the message too.