device — Modbus Device Representation

Module author: Galen Collins <>

Section author: Galen Collins <>

API Documentation

Modbus Device Controller

These are the device management handlers. They should be maintained in the server context and the various methods should be inserted in the correct locations.

class pymodbus.device.ModbusAccessControl

This is a simple implementation of a Network Management System table. Its purpose is to control access to the server (if it is used). We assume that if an entry is in the table, it is allowed accesses to resources. However, if the host does not appear in the table (all unknown hosts) its connection will simply be closed.

Since it is a singleton, only one version can possible exist and all instances pull from here.


Add allowed host(s) from the NMS table

Parameters:host – The host to add

Check if a host is allowed to access resources

Parameters:host – The host to check

Remove allowed host(s) from the NMS table

Parameters:host – The host to remove
class pymodbus.device.ModbusDeviceIdentification(info=None)

This is used to supply the device identification for the readDeviceIdentification function

For more information read section 6.21 of the modbus application protocol.


Return a summary of the main items

Returns:An dictionary of the main items

Update the values of this identity using another identify as the value

Parameters:input – The value to copy values from
class pymodbus.device.ModbusControlBlock

This is a global singleotn that controls all system information

All activity should be logged here and all diagnostic requests should come from here.


Adds a new event to the event log

Parameters:event – A new event to add to the log

Clears the current list of events


This gets the value in the diagnostic register

Parameters:bit – The bit to get
Returns:The current value of the requested bit

This gets the entire diagnostic register

Returns:The diagnostic register collection

Returns an encoded collection of the event log.

Returns:The encoded events packet

This clears all of the system counters and the diagnostic register


This sets the value in the diagnostic register

Parameters:mapping – Dictionary of key:value pairs to set

Table Of Contents

Previous topic

diag_message — Diagnostic Modbus Messages

Next topic

factory — Request/Response Decoders

This Page