device — Modbus Device Representation

Module author: Galen Collins <bashwork@gmail.com>

Section author: Galen Collins <bashwork@gmail.com>

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(host)

Add allowed host(s) from the NMS table

Parameters:host – The host to add
check(host)

Check if a host is allowed to access resources

Parameters:host – The host to check
remove(host)

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.

summary()

Return a summary of the main items

Returns:An dictionary of the main items
update(input)

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.

addEvent(event)

Adds a new event to the event log

Parameters:event – A new event to add to the log
clearEvents()

Clears the current list of events

getDiagnostic(bit)

This gets the value in the diagnostic register

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

This gets the entire diagnostic register

Returns:The diagnostic register collection
getEvents()

Returns an encoded collection of the event log.

Returns:The encoded events packet
reset()

This clears all of the system counters and the diagnostic register

setDiagnostic(mapping)

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