Skip to main content

A library designed for seamless interaction with Modbus devices using an event-driven approach, supporting TCP, unabto and other protocols.

Project description

Modbus Event Connect

Welcome to Modbus Event Connect – a user-friendly, event-driven Python library designed to simplify the configuration of Modbus devices and interact with them in an event-driven way. Whether you're connecting via TCP or Unabto, Modbus Event Connect has got you covered.

Features

  • Event-Driven Architecture: React to changes and events in real-time.
  • Easy Configuration: Intuitive setup for Modbus devices.
  • Flexible Connectivity: Supports connection through TCP or Unabto.
  • User-Friendly: Handles the interaction; you just define the Modbus register items.

Getting Started

  1. Installation: Install the library using pip.
    pip install modbus-event-connect
    
  2. Basic Usage: Define your DataPointKeys to a Modbus device with minimal code.
    from collections.abc import Callable
    from src.modbus_event_connect import *
    
    class MyDatapointKey(ModbusDatapointKey):
        MAJOR_VERSION = "major_version"
        
    class MySetpointKey(ModbusSetpointKey):
        MY_SETPOINT = "my_setpoint"
    
    class MyModbusDevice(ModbusDeviceBase):
        def __init__(self, device_info: ModbusDeviceInfo):
            super().__init__(device_info)
    
            self._attr_manufacturer="<manufacturer>"
            self._attr_model_name="<model_name>"
            self._attr_datapoints = [
                ModbusDatapoint(key=MyDatapointKey.MAJOR_VERSION, read_address=1, divider=1, signed=True),
            ]
            self._attr_setpoints = [
                ModbusSetpoint(key=MySetpointKey.MY_SETPOINT, read_address=1, write_address=1 ,divider=1, min=1, max=10, signed=True),
            ]
    
    class MyModbusDeviceAdapter(ModbusDeviceAdapter):
    
        def _translate_to_model(self, device_info: ModbusDeviceInfo) -> Callable[[ModbusDeviceInfo], ModbusDevice]|None: 
            return MyModbusDevice
    
    class MyModbusTCPEventConnect(ModbusTCPEventConnect):
        _attr_adapter = MyModbusDeviceAdapter()
    

Documentation

Client Capabilities

The Modbus Event Connect offers a range of methods to facilitate seamless interaction with Modbus devices. Key features include:

  • Subscribe: Easily subscribe to data points and receive updates.
  • Unsubscribe: Manage your subscriptions effortlessly.
  • Comprehensive Methods: A variety of methods to handle different Modbus operations.

Let the Event Connect handle the communication, allowing you to focus on responding to changes and managing your Modbus devices efficiently.

Disclaimer

Modbus Event Connect is provided "as is", without warranty of any kind. The authors and contributors are not responsible for any damage or data loss that may occur from using this library. Users are solely responsible for ensuring the proper and safe operation of their Modbus devices.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modbus_event_connect-0.1.7.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

modbus_event_connect-0.1.7-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file modbus_event_connect-0.1.7.tar.gz.

File metadata

  • Download URL: modbus_event_connect-0.1.7.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for modbus_event_connect-0.1.7.tar.gz
Algorithm Hash digest
SHA256 24d149a9d097891b293102522e0f051125a267d3f720c1665ea18ac60f843c1c
MD5 b1f028666da15d6ca7fe9ee0cfff0b98
BLAKE2b-256 d2f8a6f24dbd3bf8a3ab335db5638a2cf7a44ddeba8155e5ab5e9a6b7864f2e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_event_connect-0.1.7.tar.gz:

Publisher: release.yml on HairingX/modbus_event_connect

Attestations:

File details

Details for the file modbus_event_connect-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for modbus_event_connect-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5e288615d7e29c7c21f1cf86c818afcb36ce34ca58c51876af14c48c39b02eb9
MD5 dfa9dc4efe2f02c61e1740075d4612e1
BLAKE2b-256 6876162b63ea3d057fc714e894e6fdbefc3798ed8594301e4b247756c9f2829c

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_event_connect-0.1.7-py3-none-any.whl:

Publisher: release.yml on HairingX/modbus_event_connect

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page