# 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.
```bash
pip install modbus-event-connect
```
2. **Basic Usage**: Define your DataPointKeys to a Modbus device with minimal code.
```python
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](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/HairingX/modbus_event_connect",
"name": "modbus-event-connect",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "modbus, unabto, micronabto, micro_nabto, modbustcp, modbus_tcp, event, remote, connect, library",
"author": "HairingX",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c0/10/a2884fefb74140df9613d73aa24a296cb8bcdd891b52d9e754b2610f9117/modbus_event_connect-0.1.8.tar.gz",
"platform": null,
"description": "# Modbus Event Connect\n\nWelcome to **Modbus Event Connect** \u2013 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.\n\n## Features\n\n- **Event-Driven Architecture**: React to changes and events in real-time.\n- **Easy Configuration**: Intuitive setup for Modbus devices.\n- **Flexible Connectivity**: Supports connection through TCP or Unabto.\n- **User-Friendly**: Handles the interaction; you just define the Modbus register items.\n\n## Getting Started\n\n1. **Installation**: Install the library using pip.\n ```bash\n pip install modbus-event-connect\n ```\n2. **Basic Usage**: Define your DataPointKeys to a Modbus device with minimal code.\n ```python\n from collections.abc import Callable\n from src.modbus_event_connect import *\n\n class MyDatapointKey(ModbusDatapointKey):\n MAJOR_VERSION = \"major_version\"\n \n class MySetpointKey(ModbusSetpointKey):\n MY_SETPOINT = \"my_setpoint\"\n\n class MyModbusDevice(ModbusDeviceBase):\n def __init__(self, device_info: ModbusDeviceInfo):\n super().__init__(device_info)\n\n self._attr_manufacturer=\"<manufacturer>\"\n self._attr_model_name=\"<model_name>\"\n self._attr_datapoints = [\n ModbusDatapoint(key=MyDatapointKey.MAJOR_VERSION, read_address=1, divider=1, signed=True),\n ]\n self._attr_setpoints = [\n ModbusSetpoint(key=MySetpointKey.MY_SETPOINT, read_address=1, write_address=1 ,divider=1, min=1, max=10, signed=True),\n ]\n\n class MyModbusDeviceAdapter(ModbusDeviceAdapter):\n\n def _translate_to_model(self, device_info: ModbusDeviceInfo) -> Callable[[ModbusDeviceInfo], ModbusDevice]|None: \n return MyModbusDevice\n\n class MyModbusTCPEventConnect(ModbusTCPEventConnect):\n _attr_adapter = MyModbusDeviceAdapter()\n ```\n\n## Documentation\n### Client Capabilities\n\nThe Modbus Event Connect offers a range of methods to facilitate seamless interaction with Modbus devices. Key features include:\n\n- **Subscribe**: Easily subscribe to data points and receive updates.\n- **Unsubscribe**: Manage your subscriptions effortlessly.\n- **Comprehensive Methods**: A variety of methods to handle different Modbus operations.\n\nLet the Event Connect handle the communication, allowing you to focus on responding to changes and managing your Modbus devices efficiently.\n\n## Disclaimer\n\nModbus 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.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library designed for seamless interaction with Modbus devices using an event-driven approach, supporting TCP, unabto and other protocols.",
"version": "0.1.8",
"project_urls": {
"Homepage": "https://github.com/HairingX/modbus_event_connect"
},
"split_keywords": [
"modbus",
" unabto",
" micronabto",
" micro_nabto",
" modbustcp",
" modbus_tcp",
" event",
" remote",
" connect",
" library"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "51cfdc99e7d4f451cc633a3d94034c540bb9613635a62bfe054633577cd75521",
"md5": "981d091003df9a886b2cfaff4505df50",
"sha256": "d387f0f1ab92424ccce275d559b0022884ca813c4e4cfa5aa012a3f70d8dec37"
},
"downloads": -1,
"filename": "modbus_event_connect-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "981d091003df9a886b2cfaff4505df50",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 31045,
"upload_time": "2024-11-01T08:16:31",
"upload_time_iso_8601": "2024-11-01T08:16:31.829675Z",
"url": "https://files.pythonhosted.org/packages/51/cf/dc99e7d4f451cc633a3d94034c540bb9613635a62bfe054633577cd75521/modbus_event_connect-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c010a2884fefb74140df9613d73aa24a296cb8bcdd891b52d9e754b2610f9117",
"md5": "a13ced90b6224d532f2be59c039a9bd0",
"sha256": "d8174815364bc5daa5e6f963a69a82305a6c959ad72af08cc52ccee8709a2a93"
},
"downloads": -1,
"filename": "modbus_event_connect-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "a13ced90b6224d532f2be59c039a9bd0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 28752,
"upload_time": "2024-11-01T08:16:33",
"upload_time_iso_8601": "2024-11-01T08:16:33.427362Z",
"url": "https://files.pythonhosted.org/packages/c0/10/a2884fefb74140df9613d73aa24a296cb8bcdd891b52d9e754b2610f9117/modbus_event_connect-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-01 08:16:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HairingX",
"github_project": "modbus_event_connect",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "setuptools",
"specs": []
},
{
"name": "pytest",
"specs": []
},
{
"name": "pytest-asyncio",
"specs": []
},
{
"name": "pyModbusTCP",
"specs": [
[
"==",
"0.3.0"
]
]
}
],
"lcname": "modbus-event-connect"
}