Python Library – pymodbus

library icon
Python pymodbus

Voor communicatie van

  • Modbus RTU
  • Modbus ASCII
  • Modbus RTU over TCP

Niet voor

  • Modbus TCP/IP

Installatie:

Installatie voor Python 3:

Informatie (ENG):

Summary

Pymodbus is a full Modbus protocol implementation using twisted for its asynchronous communications core. It can also be used without any third party dependencies (aside from pyserial) if a more lightweight project is needed. Furthermore, it should work fine under any python version > 2.3 with a python 3.0 branch currently being maintained as well.

Features

Client Features

  • Full read/write protocol on discrete and register
  • Most of the extended protocol (diagnostic/file/pipe/setting/information)
  • TCP, UDP, Serial ASCII, Serial RTU, and Serial Binary
  • asynchronous(powered by twisted) and synchronous versions
  • Payload builder/decoder utilities

Server Features

  • Can function as a fully implemented modbus server
  • TCP, UDP, Serial ASCII, Serial RTU, and Serial Binary
  • asynchronous(powered by twisted) and synchronous versions
  • Full server control context (device information, counters, etc)
  • A number of backing contexts (database, redis, a slave device)

Use Cases

Although most system administrators will find little need for a Modbus server on any modern hardware, they may find the need to query devices on their network for status (PDU, PDR, UPS, etc). Since the library is written in python, it allows for easy scripting and/or integration into their existing solutions.

Continuing, most monitoring software needs to be stress tested against hundreds or even thousands of devices (why this was originally written), but getting access to that many is unwieldy at best. The pymodbus server will allow a user to test as many devices as their base operating system will allow (allow in this case means how many Virtual IP addresses are allowed).

Example Code

For those of you that just want to get started fast, here you go:

For more advanced examples, check out the examples included in the respository. If you have created any utilities that meet a specific need, feel free to submit them so others can benefit.


Download pymodbus@github.com