diag_message
— Diagnostic Modbus Messages¶
API Documentation¶
Diagnostic Record Read/Write¶
These need to be tied into a the current server context or linked to the appropriate data
-
class
pymodbus.diag_message.
DiagnosticStatusRequest
(**kwargs)[source]¶ This is a base class for all of the diagnostic request functions
-
encode
()[source]¶ Base encoder for a diagnostic response we encode the data set in self.message
Returns: The encoded packet
-
-
class
pymodbus.diag_message.
DiagnosticStatusResponse
(**kwargs)[source]¶ This is a base class for all of the diagnostic response functions
It works by performing all of the encoding and decoding of variable data and lets the higher classes define what extra data to append and how to execute a request
-
class
pymodbus.diag_message.
DiagnosticStatusSimpleRequest
(data=0, **kwargs)[source]¶ A large majority of the diagnostic functions are simple status request functions. They work by sending 0x0000 as data and their function code and they are returned 2 bytes of data.
If a function inherits this, they only need to implement the execute method
-
class
pymodbus.diag_message.
DiagnosticStatusSimpleResponse
(data=0, **kwargs)[source]¶ A large majority of the diagnostic functions are simple status request functions. They work by sending 0x0000 as data and their function code and they are returned 2 bytes of data.
-
class
pymodbus.diag_message.
ReturnQueryDataRequest
(message=0, **kwargs)[source]¶ The data passed in the request data field is to be returned (looped back) in the response. The entire response message should be identical to the request.
-
class
pymodbus.diag_message.
ReturnQueryDataResponse
(message=0, **kwargs)[source]¶ The data passed in the request data field is to be returned (looped back) in the response. The entire response message should be identical to the request.
-
class
pymodbus.diag_message.
RestartCommunicationsOptionRequest
(toggle=False, **kwargs)[source]¶ The remote device serial line port must be initialized and restarted, and all of its communications event counters are cleared. If the port is currently in Listen Only Mode, no response is returned. This function is the only one that brings the port out of Listen Only Mode. If the port is not currently in Listen Only Mode, a normal response is returned. This occurs before the restart is executed.
-
class
pymodbus.diag_message.
RestartCommunicationsOptionResponse
(toggle=False, **kwargs)[source]¶ The remote device serial line port must be initialized and restarted, and all of its communications event counters are cleared. If the port is currently in Listen Only Mode, no response is returned. This function is the only one that brings the port out of Listen Only Mode. If the port is not currently in Listen Only Mode, a normal response is returned. This occurs before the restart is executed.
-
class
pymodbus.diag_message.
ReturnDiagnosticRegisterRequest
(data=0, **kwargs)[source]¶ The contents of the remote device’s 16-bit diagnostic register are returned in the response
-
class
pymodbus.diag_message.
ReturnDiagnosticRegisterResponse
(data=0, **kwargs)[source]¶ The contents of the remote device’s 16-bit diagnostic register are returned in the response
-
class
pymodbus.diag_message.
ChangeAsciiInputDelimiterRequest
(data=0, **kwargs)[source]¶ The character ‘CHAR’ passed in the request data field becomes the end of message delimiter for future messages (replacing the default LF character). This function is useful in cases of a Line Feed is not required at the end of ASCII messages.
-
class
pymodbus.diag_message.
ChangeAsciiInputDelimiterResponse
(data=0, **kwargs)[source]¶ The character ‘CHAR’ passed in the request data field becomes the end of message delimiter for future messages (replacing the default LF character). This function is useful in cases of a Line Feed is not required at the end of ASCII messages.
-
class
pymodbus.diag_message.
ForceListenOnlyModeRequest
(data=0, **kwargs)[source]¶ Forces the addressed remote device to its Listen Only Mode for MODBUS communications. This isolates it from the other devices on the network, allowing them to continue communicating without interruption from the addressed remote device. No response is returned.
-
class
pymodbus.diag_message.
ForceListenOnlyModeResponse
(**kwargs)[source]¶ Forces the addressed remote device to its Listen Only Mode for MODBUS communications. This isolates it from the other devices on the network, allowing them to continue communicating without interruption from the addressed remote device. No response is returned.
This does not send a response
-
class
pymodbus.diag_message.
ClearCountersRequest
(data=0, **kwargs)[source]¶ The goal is to clear ll counters and the diagnostic register. Also, counters are cleared upon power-up
-
class
pymodbus.diag_message.
ClearCountersResponse
(data=0, **kwargs)[source]¶ The goal is to clear ll counters and the diagnostic register. Also, counters are cleared upon power-up
-
class
pymodbus.diag_message.
ReturnBusMessageCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages that the remote device has detected on the communications systems since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnBusMessageCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages that the remote device has detected on the communications systems since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnBusCommunicationErrorCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of CRC errors encountered by the remote device since its last restart, clear counter operation, or power-up
-
class
pymodbus.diag_message.
ReturnBusCommunicationErrorCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of CRC errors encountered by the remote device since its last restart, clear counter operation, or power-up
-
class
pymodbus.diag_message.
ReturnBusExceptionErrorCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of modbus exception responses returned by the remote device since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnBusExceptionErrorCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of modbus exception responses returned by the remote device since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnSlaveMessageCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnSlaveMessageCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnSlaveNoResponseCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnSlaveNoReponseCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device, or broadcast, that the remote device has processed since its last restart, clear counters operation, or power-up
-
class
pymodbus.diag_message.
ReturnSlaveNAKCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device for which it returned a Negative Acknowledge (NAK) exception response, since its last restart, clear counters operation, or power-up. Exception responses are described and listed in section 7 .
-
class
pymodbus.diag_message.
ReturnSlaveNAKCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device for which it returned a Negative Acknowledge (NAK) exception response, since its last restart, clear counters operation, or power-up. Exception responses are described and listed in section 7.
-
class
pymodbus.diag_message.
ReturnSlaveBusyCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device for which it returned a Slave Device Busy exception response, since its last restart, clear counters operation, or power-up.
-
class
pymodbus.diag_message.
ReturnSlaveBusyCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device for which it returned a Slave Device Busy exception response, since its last restart, clear counters operation, or power-up.
-
class
pymodbus.diag_message.
ReturnSlaveBusCharacterOverrunCountRequest
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device that it could not handle due to a character overrun condition, since its last restart, clear counters operation, or power-up. A character overrun is caused by data characters arriving at the port faster than they can be stored, or by the loss of a character due to a hardware malfunction.
-
class
pymodbus.diag_message.
ReturnSlaveBusCharacterOverrunCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the remote device that it could not handle due to a character overrun condition, since its last restart, clear counters operation, or power-up. A character overrun is caused by data characters arriving at the port faster than they can be stored, or by the loss of a character due to a hardware malfunction.
-
class
pymodbus.diag_message.
ReturnIopOverrunCountRequest
(data=0, **kwargs)[source]¶ An IOP overrun is caused by data characters arriving at the port faster than they can be stored, or by the loss of a character due to a hardware malfunction. This function is specific to the 884.
-
class
pymodbus.diag_message.
ReturnIopOverrunCountResponse
(data=0, **kwargs)[source]¶ The response data field returns the quantity of messages addressed to the slave that it could not handle due to an 884 IOP overrun condition, since its last restart, clear counters operation, or power-up.
-
class
pymodbus.diag_message.
ClearOverrunCountRequest
(data=0, **kwargs)[source]¶ Clears the overrun error counter and reset the error flag
An error flag should be cleared, but nothing else in the specification mentions is, so it is ignored.
-
class
pymodbus.diag_message.
ClearOverrunCountResponse
(data=0, **kwargs)[source]¶ Clears the overrun error counter and reset the error flag
-
class
pymodbus.diag_message.
GetClearModbusPlusRequest
(data=0, **kwargs)[source]¶ In addition to the Function code (08) and Subfunction code (00 15 hex) in the query, a two-byte Operation field is used to specify either a ‘Get Statistics’ or a ‘Clear Statistics’ operation. The two operations are exclusive - the ‘Get’ operation cannot clear the statistics, and the ‘Clear’ operation does not return statistics prior to clearing them. Statistics are also cleared on power-up of the slave device.
-
class
pymodbus.diag_message.
GetClearModbusPlusResponse
(data=0, **kwargs)[source]¶ Returns a series of 54 16-bit words (108 bytes) in the data field of the response (this function differs from the usual two-byte length of the data field). The data contains the statistics for the Modbus Plus peer processor in the slave device.