Constants

Constants For Modbus Server/Client.

This is the single location for storing default values for the servers and clients.

class pymodbus.constants.DeviceInformation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: int, Enum

Represents what type of device information to read.

BASIC

This is the basic (required) device information to be returned. This includes VendorName, ProductCode, and MajorMinorRevision code.

REGULAR

In addition to basic data objects, the device provides additional and optional identification and description data objects. All of the objects of this category are defined in the standard but their implementation is optional.

EXTENDED

In addition to regular data objects, the device provides additional and optional identification and description private data about the physical device itself. All of these data are device dependent.

SPECIFIC

Request to return a single data object.

BASIC = 1
EXTENDED = 3
REGULAR = 2
SPECIFIC = 4
class pymodbus.constants.Endian(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

An enumeration representing the various byte endianness.

AUTO

This indicates that the byte order is chosen by the current native environment.

BIG

This indicates that the bytes are in big endian format

LITTLE

This indicates that the bytes are in little endian format

Note

I am simply borrowing the format strings from the python struct module for my convenience.

AUTO = '@'
BIG = '>'
LITTLE = '<'
class pymodbus.constants.ModbusPlusOperation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: int, Enum

Represents the type of modbus plus request.

GET_STATISTICS

Operation requesting that the current modbus plus statistics be returned in the response.

CLEAR_STATISTICS

Operation requesting that the current modbus plus statistics be cleared and not returned in the response.

CLEAR_STATISTICS = 4
GET_STATISTICS = 3
class pymodbus.constants.ModbusStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: int, Enum

These represent various status codes in the modbus protocol.

WAITING

This indicates that a modbus device is currently waiting for a given request to finish some running task.

READY

This indicates that a modbus device is currently free to perform the next request task.

ON

This indicates that the given modbus entity is on

OFF

This indicates that the given modbus entity is off

SLAVE_ON

This indicates that the given modbus slave is running

SLAVE_OFF

This indicates that the given modbus slave is not running

OFF = 0
ON = 65280
READY = 0
SLAVE_OFF = 0
SLAVE_ON = 255
WAITING = 65535
class pymodbus.constants.MoreData(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: int, Enum

Represents the more follows condition.

NOTHING

This indicates that no more objects are going to be returned.

KEEP_READING

This indicates that there are more objects to be returned.

KEEP_READING = 255
NOTHING = 0