...
- k - user session ID;
- id - the identifier of the element; if the identifier is absent, a new element is created; otherwise the existing one is modified;
- name - the name of the element, the length is not more than 63 characters;
- virtual_type - type of virtual sensor ":
- modbus rtu
- - for reading Modbus data;
- modbus rtu wr - for writing Modbus data.
Options for reading Modbus data only (analog virtual sensor):
- vmax - maximum value for the measuring range;
- vmin - minimum value for the measuring range;
- low_alarm - threshold level for notification;
- low_warning - threshold level for notification;
- high_warning - threshold level for notification;
- high_alarm - threshold level for notification;
- hyst_type - the type of algorithm used to calculate the hysteresis:
- disable - the hysteresis is disabled;
- value - hysteresis by the value measured by the sensor value;
- time - hysteresis using time (used by default).
- hyst_value - the value of the deviation of the sensor value when calculating the hysteresis by value, the value with a floating point (minimum 0, maximum 10,000, default 0.3);
- hyst_low_alarm - the time in seconds, during which the sensor should keep its value in this range, for transition of the sensor to this state (minimum 0, maximum 1000, default 1);
- hyst_low_warning - same as previous (default 1);
- hyst_normal - same as previous (default is 0);
- hyst_high_warning - same as previous (default 1);
- hyst_high_alarm - same as previous (default 1).
- expr - expression for calculating the output value, by default "x";
- um - unit of measurement of this element;
- utype - custom type, defines the sensor icon: current, factor, frequency, humidity, power, temperature, vibration, voltage;
Options for Modbus protocol (reading only):
- mb_addr - slave address of device on bus, decimal (1-255);
- mb_reg - register index for modbus function, hexademal string;
- mb_func - function code for modbus:
- Read Coil Status (0x01);
Read Input Status (0x02);
Read Holding Register (0x03);
Read Input Register (0x04).
- mb_type - data type:
16 bits signed int;
16 bits unsigned int;
32 bits signed int;
32 bits unsigned int;
32 bits IEEE 754 floating point.
- mb_order - data ordering:
low byte first, low word first;
low byte first, high word first;
high byte first, low word first;
high byte first, high word first.
- mb_period - the polling period, seconds.
Options for Modbus protocol (writing only):
- mb_addr - slave address of device on bus, decimal (1-255);
- mb_reg - register index for modbus function, hexademal string;
- mb_func - function code for modbus:
- Write Single Coil (0x05);
Write Single Register (0x06).
- mb_wrval - writing value, integer.
If the new element is successfully created, the response is:
...
When creating a new sensor (id is not specified), some parameters are mandatory - . For reading: name, virtual_type, vmax, vmin, mb_addr, mb_reg, mb_func, mb_type, mb_order, mb_period. For writing: name, virtual_type, mb_addr, mb_reg, mb_func, mb_wrval. The rest of the query parameters are optional, and if not set, they will be set to the default values.
...
- k - user session ID;
- virtual_type - type of virtual sensor ":
- modbus rtu
- - for reading Modbus data;
- modbus rtu wr - for writing Modbus data.
- mb_addr - slave address of device on bus, decimal (1-255);
- mb_reg - register index for modbus function, hexademal string;
- mb_func - function code for modbus:
- Read Coil Status (0x01);
Read Input Status (0x02);
Read Holding Register (0x03);
Read Input Register (0x04);
- Write Single Coil (0x05);
Write Single Register (0x06).
- mb_type - data type (for reading only):
16 bits signed int;
16 bits unsigned int;
32 bits signed int;
32 bits unsigned int;
32 bits IEEE 754 floating point.
- mb_order - data ordering (for reading only):
low byte first, low word first;
low byte first, high word first;
high byte first, low word first;
high byte first, high word first.
- mb_wrval - writing value, integer (for writing only).
Information about the reading test looks like:
<modbusrtu mb_raw_req="1F 04 00 00 00 02" mb_raw_ans="1F 04 04 43 63 55 19" mb_value="227.332413" /> |
Information about the writing test looks like:
<error type="no error" /> |
If an error occurs, example:
...