Skip to content

Modbus

Starts searching for Modbus devices on the RS-485 bus.

POST /api/modbus/find/start/

Request Parameters:

ParameterTypeDescription
baudRateintegerBaud rate (bps: 75 to 230400).
charFormatintegerByte format:
0 - E1S;
1 - O1S;
2 - SPACE (0P1S);
3 - MARK (1P1S / NP2S);
4 - NP1S;
5 - AUTO STOP (Rx: NP1S / Tx: NP2S).
frameModeintegerFrame format: 0 - RTU, 1 - ASCII. Optional.
fastSearchbooleanEnable fast search (true/false). Optional.

Example Request:

{
"baudRate": 9600,
"charFormat": 3,
"frameMode": 0,
"fastSearch": false
}

Stops the active Modbus device search.

POST /api/modbus/find/stop/

Response:

ParameterTypeDescription
statusstringStatus: DONE - search stopped successfully; BUSY - unable to stop search (try again later).
{
"status": "DONE"
}

Returns the list of found devices.

GET /api/modbus/find/result/?list

Request Parameters:

ParameterDescription
listIf specified, the response includes the list of found devices foundDevices.

Response:

ParameterTypeDescription
foundDevicesarrayList of found devices.
uidintegerDevice UID.
baudRateintegerBaud rate (bps: 75 to 230400).
charFormatintegerByte format:
0 - E1S;
1 - O1S;
2 - SPACE (0P1S);
3 - MARK (1P1S / NP2S);
4 - NP1S;
5 - AUTO STOP (Rx: NP1S / Tx: NP2S).
frameModeintegerFrame format: 0 - RTU, 1 - ASCII.
{
"foundDevices": [
{
"uid": 1,
"baudRate": 9600,
"charFormat": 0,
"frameMode": 0
}
]
}

POST /api/modbus/class-find/search-meta-info/

Request Parameters:

ParameterTypeDescription
filePathstringPath to template file on SD card.

Example Request:

{
"filePath": "/templates/em-481.txt"
}

Response:

ParameterTypeDescription
statusstringStatus: DONE (success), ERROR (failed).
errorCodestring / nullError code if failed. See Error Codes.

POST /api/modbus/class-find/start/?search-meta-info

Request Parameters:

ParameterTypeDescription
filePathstringPath to template file on SD card.
baudRateintegerBaud rate.
charFormatintegerByte format.
frameModeintegerFrame format: 0 - RTU, 1 - ASCII.
uidintegerDevice UID (1-254).

Example Request:

{
"filePath": "/templates/em-481.txt",
"baudRate": 9600,
"charFormat": 3,
"frameMode": 0,
"uid": 111
}

Response:

ParameterTypeDescription
statusstringStatus: DONE (started), ERROR (failed).
errorCodestring / nullError code if failed. See Error Codes.

POST /api/modbus/class-find/stop/

Response:

ParameterTypeDescription
statusstringStatus: DONE (stopped), BUSY (cannot stop).

GET /api/modbus/class-find/result/

Response:

ParameterTypeDescription
mbReqPassedintegerNumber of completed Modbus requests.
checksPassedintegerNumber of executed template commands.
linesPassedintegerNumber of read template lines.
mbUidintegerDevice UID.
deviceClassstring / nullIdentified device class, or null.
scriptTimestring / nullTemplate file creation time (ISO 8601), or null.
scriptVersionstring / nullTemplate file version, or null.
statusstringStatus: DONE (success), BUSY (searching), ERROR (failed).
errorCodestring / nullError code if failed. See Error Codes.
CodeDescription
File System Errors
ERROR_FR_DISK_ERRLow-level disk error
ERROR_FR_INT_ERRInternal file system error
ERROR_FR_NOT_READYStorage device not ready
ERROR_FR_NO_FILEFile not found
ERROR_FR_NO_PATHPath not found
ERROR_FR_INVALID_NAMEInvalid file or path name
ERROR_FR_DENIEDAccess denied
ERROR_FR_EXISTFile already exists
ERROR_FR_INVALID_OBJECTInvalid file object
ERROR_FR_WRITE_PROTECTEDWrite protected
ERROR_FR_INVALID_DRIVEInvalid drive
ERROR_FR_NOT_ENABLEDFile system not mounted
ERROR_FR_NO_FILESYSTEMNo file system
ERROR_FR_MKFS_ABORTEDFormatting aborted
ERROR_FR_TIMEOUTTimeout
ERROR_FR_LOCKEDFile locked
ERROR_FR_NOT_ENOUGH_CORENot enough memory
ERROR_FR_TOO_MANY_OPEN_FILESToo many open files
ERROR_FR_INVALID_PARAMETERInvalid parameter
Search Engine Errors
ERROR_METATemplate structure error
ERROR_LABELInvalid or missing label
ERROR_CONDITIONCondition expression error
ERROR_CHECK_TYPEUnknown check type
ERROR_MODIFIER_PARAMETERModifier parameter error
ERROR_DATA_SOURCEData source error
ERROR_DATA_SOURCE_FUNCTIONUnknown data source function
ERROR_DATA_SOURCE_ADDRESSInvalid data source address
ERROR_CHECK_PARAMETERSCheck parameters error
ERROR_ACTIONAction error
ERROR_ACTION_TYPEUnknown action type
ERROR_UNSUPPORTED_UTF_FORMATUnsupported UTF format
ERROR_FILE_NOT_READFailed to read template file
ERROR_LINE_OUTOFBOUNDLine out of bound
ERROR_UID_HIDDEN_BY_VDEVICEUID hidden by virtual device
ERROR_ARGGeneral argument error
ERROR_MEMMemory allocation error
ERROR_BUSYResource busy
ERROR_SERIAL_IS_SLAVEDevice is in slave mode
ERROR_EOFEnd of file reached

POST /api/modbus/req/

Request Parameters:

ParameterTypeDescription
reqDatastringHexadecimal string of Modbus request (without CRC).

Example Request:

{
"reqData": "010300000002"
}

Response:

ParameterTypeDescription
tidintegerTransaction ID assigned to the packet.

GET /api/modbus/resp/?tid=...

Request Parameters:

ParameterTypeDescription
tidintegerTransaction ID.

Response:

ParameterTypeDescription
respDatastringHexadecimal string of Modbus response.
statusstringStatus: DONE (received), BUSY (pending).

Disconnects and reconnects to the cloud server.

POST /api/cmd/callback/reconnect/

Request Parameters:

FieldTypeDescription
requestNewCodebooleanRequest new activation code upon reconnection.

Example Request:

{
"requestNewCode": true
}