pymodbus-repl


Namepymodbus-repl JSON
Version 2.0.4 PyPI version JSON
download
home_pagehttps://github.com/pymodbus-dev/repl
SummaryREPL (Read-Eval-Print Loop) tool for working with Modbus devices using the Pymodbus library.
upload_time2024-08-11 16:30:18
maintainerNone
docs_urlNone
authordhoomakethu
requires_python<4.0,>=3.9.0
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pymodbus-REPL

Pymodbus-REPL is a REPL (Read-Eval-Print Loop) tool for working with Modbus devices using the Pymodbus library.

## Development Setup

### Prerequisites

- Python 3.8+
- Poetry (installed globally or within a virtual environment)

### Dev instructions

1. Clone the repository:

   `git clone https://github.com/pymodbus-dev/repl.git`

2. Navigate to the project directory:

    `cd repl`

3. Install dependencies using Poetry: 

    `poetry install`

**NOTE** This repo is meant to be an helper for [pymodbus](https://github.com/pymodbus-dev/pymodbus) and the usage requires
a working version of pymodbus.

The installed `pymodbus` library for local development can also have impact on the path resolution while working locally on this repo.
To overcome that problem, please make sure to run the [client](./pymodbus/client/main.py) and [server](./pymodbus/server/main.py) files
from with in the respective working directories.

For .e.g

#### Run Server
```
(pymodbus3.8)
❯ python3 main.py --host 0.0.0.0 --verbose run --modbus-config default_config.json --modbus-server tcp --modbus-framer socket --modbus-port 5020 --unit-id 1 --unit-id 2 -u 4 -r 1 --timeout 2
2024-02-28 14:38:24,952 INFO  logging:97 Modbus server started
2024-02-28 14:38:24,952 DEBUG logging:103 Awaiting connections server_listener
2024-02-28 14:38:24,952 INFO  logging:97 Server listening.

__________                          .______.                    _________
\______   \___.__. _____   ____   __| _/\_ |__  __ __  ______  /   _____/ ______________  __ ___________
 |     ___<   |  |/     \ /  _ \ / __ |  | __ \|  |  \/  ___/  \_____  \_/ __ \_  __ \  \/ // __ \_  __ \\
 |    |    \___  |  Y Y  (  <_> ) /_/ |  | \_\ \  |  /\___ \   /        \  ___/|  | \/\   /\  ___/|  | \/
 |____|    / ____|__|_|  /\____/\____ |  |___  /____//____  > /_______  /\___  >__|    \_/  \___  >__|
           \/          \/            \/      \/           \/          \/     \/                 \/
                                                                                                v2.0.2-Pymodbus3.7.0dev


SERVER > 2024-02-28 14:39:15,352 DEBUG logging:103 Connected to server
2024-02-28 14:39:15,352 DEBUG logging:103 recv: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x0 0x1 0x0 0x1 old_data:  addr=None
2024-02-28 14:39:15,352 DEBUG logging:103 Handling data: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x0 0x1 0x0 0x1
2024-02-28 14:39:15,352 DEBUG logging:103 Processing: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x0 0x1 0x0 0x1
2024-02-28 14:39:15,352 DEBUG logging:103 Factory Request[ReadInputRegistersRequest': 4]
2024-02-28 14:39:15,352 DEBUG logging:103 validate: fc-[4] address-1: count-1
2024-02-28 14:39:15,352 DEBUG logging:103 getValues: fc-[4] address-1: count-1
2024-02-28 14:39:15,352 DEBUG logging:103 send: 0x0 0x1 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0xc5 0x7c
2024-02-28 14:39:37,029 DEBUG logging:103 recv: 0x0 0x2 0x0 0x0 0x0 0x6 0x4 0x4 0x0 0x1 0x0 0x1 old_data:  addr=None
2024-02-28 14:39:37,029 DEBUG logging:103 Handling data: 0x0 0x2 0x0 0x0 0x0 0x6 0x4 0x4 0x0 0x1 0x0 0x1
2024-02-28 14:39:37,029 DEBUG logging:103 Processing: 0x0 0x2 0x0 0x0 0x0 0x6 0x4 0x4 0x0 0x1 0x0 0x1
2024-02-28 14:39:37,029 DEBUG logging:103 Factory Request[ReadInputRegistersRequest': 4]
2024-02-28 14:39:37,029 DEBUG logging:103 validate: fc-[4] address-1: count-1
2024-02-28 14:39:37,029 DEBUG logging:103 getValues: fc-[4] address-1: count-1
2024-02-28 14:39:37,029 DEBUG logging:103 send: 0x0 0x2 0x0 0x0 0x0 0x5 0x4 0x4 0x2 0xc7 0xbe
2024-02-28 14:39:41,010 DEBUG logging:103 recv: 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1 old_data:  addr=None
2024-02-28 14:39:41,010 DEBUG logging:103 Handling data: 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1
2024-02-28 14:39:41,010 DEBUG logging:103 Processing: 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1
2024-02-28 14:39:41,010 DEBUG logging:103 Not a valid slave id - 5, ignoring!!
2024-02-28 14:39:41,010 DEBUG logging:103 Resetting frame - Current Frame in buffer - 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1
2024-02-28 14:39:44,015 DEBUG logging:103 -> transport: received eof
2024-02-28 14:39:44,015 DEBUG logging:103 Connection lost server due to None
2024-02-28 14:39:44,015 DEBUG logging:103 Handler for stream [server] has been canceled

```

#### Run client
```
pymodbus/repl/client on  repl-server-startup [!?] via 🐍 v3.8.13 (pymodbus3.8)
❯ python3 main.py tcp --port 5020 --framer tcp

----------------------------------------------------------------------------
__________          _____             .___  __________              .__
\______   \___.__. /     \   ____   __| _/  \______   \ ____ ______ |  |
 |     ___<   |  |/  \ /  \ /  _ \ / __ |    |       _// __ \\\____ \|  |
 |    |    \___  /    Y    (  <_> ) /_/ |    |    |   \  ___/|  |_> >  |__
 |____|    / ____\____|__  /\____/\____ | /\ |____|_  /\___  >   __/|____/
           \/            \/            \/ \/        \/     \/|__|
                                                v2.0.2 - Pymodbus-3.7.0dev
----------------------------------------------------------------------------

> client.read_input_registers address 1 count 1 slave 1
{
    "registers": [
        50556
    ]
}

> client.read_input_registers address 1 count 1 slave 4
{
    "registers": [
        51134
    ]
}

> client.read_input_registers address 1 count 1 slave 5
{
    "original_function_code": "4 (0x4)",
    "error": "[Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)"
}

>

```


### Running Tests
To run tests, use the following command: 

`poetry run pytest`

### Building Distribution
To build the distribution package, use the following command: 

`poetry build`

This will create distribution packages in the dist/ directory.

## Usage

### Pymodbus Client
Refer [REPL Client](./pymodbus_repl/client/README.md)

### Pymodbus Server
Refer [REPL Server](./pymodbus_repl/server/README.md)

## Contributing
* Fork the repository.
* Create a new branch (git checkout -b feature-name).
* Make your changes and commit them (git commit -am 'Add feature').
* Push to the branch (git push origin feature-name).
* Create a new Pull Request.

## License
This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pymodbus-dev/repl",
    "name": "pymodbus-repl",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9.0",
    "maintainer_email": null,
    "keywords": null,
    "author": "dhoomakethu",
    "author_email": "otlasanju@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1d/69/d55bfdb8223c10d3db217854fde7fc2dc0745ce99afd562493988b86f7b6/pymodbus_repl-2.0.4.tar.gz",
    "platform": null,
    "description": "# Pymodbus-REPL\n\nPymodbus-REPL is a REPL (Read-Eval-Print Loop) tool for working with Modbus devices using the Pymodbus library.\n\n## Development Setup\n\n### Prerequisites\n\n- Python 3.8+\n- Poetry (installed globally or within a virtual environment)\n\n### Dev instructions\n\n1. Clone the repository:\n\n   `git clone https://github.com/pymodbus-dev/repl.git`\n\n2. Navigate to the project directory:\n\n    `cd repl`\n\n3. Install dependencies using Poetry: \n\n    `poetry install`\n\n**NOTE** This repo is meant to be an helper for [pymodbus](https://github.com/pymodbus-dev/pymodbus) and the usage requires\na working version of pymodbus.\n\nThe installed `pymodbus` library for local development can also have impact on the path resolution while working locally on this repo.\nTo overcome that problem, please make sure to run the [client](./pymodbus/client/main.py) and [server](./pymodbus/server/main.py) files\nfrom with in the respective working directories.\n\nFor .e.g\n\n#### Run Server\n```\n(pymodbus3.8)\n\u276f python3 main.py --host 0.0.0.0 --verbose run --modbus-config default_config.json --modbus-server tcp --modbus-framer socket --modbus-port 5020 --unit-id 1 --unit-id 2 -u 4 -r 1 --timeout 2\n2024-02-28 14:38:24,952 INFO  logging:97 Modbus server started\n2024-02-28 14:38:24,952 DEBUG logging:103 Awaiting connections server_listener\n2024-02-28 14:38:24,952 INFO  logging:97 Server listening.\n\n__________                          .______.                    _________\n\\______   \\___.__. _____   ____   __| _/\\_ |__  __ __  ______  /   _____/ ______________  __ ___________\n |     ___<   |  |/     \\ /  _ \\ / __ |  | __ \\|  |  \\/  ___/  \\_____  \\_/ __ \\_  __ \\  \\/ // __ \\_  __ \\\\\n |    |    \\___  |  Y Y  (  <_> ) /_/ |  | \\_\\ \\  |  /\\___ \\   /        \\  ___/|  | \\/\\   /\\  ___/|  | \\/\n |____|    / ____|__|_|  /\\____/\\____ |  |___  /____//____  > /_______  /\\___  >__|    \\_/  \\___  >__|\n           \\/          \\/            \\/      \\/           \\/          \\/     \\/                 \\/\n                                                                                                v2.0.2-Pymodbus3.7.0dev\n\n\nSERVER > 2024-02-28 14:39:15,352 DEBUG logging:103 Connected to server\n2024-02-28 14:39:15,352 DEBUG logging:103 recv: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x0 0x1 0x0 0x1 old_data:  addr=None\n2024-02-28 14:39:15,352 DEBUG logging:103 Handling data: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x0 0x1 0x0 0x1\n2024-02-28 14:39:15,352 DEBUG logging:103 Processing: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x0 0x1 0x0 0x1\n2024-02-28 14:39:15,352 DEBUG logging:103 Factory Request[ReadInputRegistersRequest': 4]\n2024-02-28 14:39:15,352 DEBUG logging:103 validate: fc-[4] address-1: count-1\n2024-02-28 14:39:15,352 DEBUG logging:103 getValues: fc-[4] address-1: count-1\n2024-02-28 14:39:15,352 DEBUG logging:103 send: 0x0 0x1 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0xc5 0x7c\n2024-02-28 14:39:37,029 DEBUG logging:103 recv: 0x0 0x2 0x0 0x0 0x0 0x6 0x4 0x4 0x0 0x1 0x0 0x1 old_data:  addr=None\n2024-02-28 14:39:37,029 DEBUG logging:103 Handling data: 0x0 0x2 0x0 0x0 0x0 0x6 0x4 0x4 0x0 0x1 0x0 0x1\n2024-02-28 14:39:37,029 DEBUG logging:103 Processing: 0x0 0x2 0x0 0x0 0x0 0x6 0x4 0x4 0x0 0x1 0x0 0x1\n2024-02-28 14:39:37,029 DEBUG logging:103 Factory Request[ReadInputRegistersRequest': 4]\n2024-02-28 14:39:37,029 DEBUG logging:103 validate: fc-[4] address-1: count-1\n2024-02-28 14:39:37,029 DEBUG logging:103 getValues: fc-[4] address-1: count-1\n2024-02-28 14:39:37,029 DEBUG logging:103 send: 0x0 0x2 0x0 0x0 0x0 0x5 0x4 0x4 0x2 0xc7 0xbe\n2024-02-28 14:39:41,010 DEBUG logging:103 recv: 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1 old_data:  addr=None\n2024-02-28 14:39:41,010 DEBUG logging:103 Handling data: 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1\n2024-02-28 14:39:41,010 DEBUG logging:103 Processing: 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1\n2024-02-28 14:39:41,010 DEBUG logging:103 Not a valid slave id - 5, ignoring!!\n2024-02-28 14:39:41,010 DEBUG logging:103 Resetting frame - Current Frame in buffer - 0x0 0x3 0x0 0x0 0x0 0x6 0x5 0x4 0x0 0x1 0x0 0x1\n2024-02-28 14:39:44,015 DEBUG logging:103 -> transport: received eof\n2024-02-28 14:39:44,015 DEBUG logging:103 Connection lost server due to None\n2024-02-28 14:39:44,015 DEBUG logging:103 Handler for stream [server] has been canceled\n\n```\n\n#### Run client\n```\npymodbus/repl/client on \ue0a0 repl-server-startup [!?] via \ud83d\udc0d v3.8.13 (pymodbus3.8)\n\u276f python3 main.py tcp --port 5020 --framer tcp\n\n----------------------------------------------------------------------------\n__________          _____             .___  __________              .__\n\\______   \\___.__. /     \\   ____   __| _/  \\______   \\ ____ ______ |  |\n |     ___<   |  |/  \\ /  \\ /  _ \\ / __ |    |       _// __ \\\\\\____ \\|  |\n |    |    \\___  /    Y    (  <_> ) /_/ |    |    |   \\  ___/|  |_> >  |__\n |____|    / ____\\____|__  /\\____/\\____ | /\\ |____|_  /\\___  >   __/|____/\n           \\/            \\/            \\/ \\/        \\/     \\/|__|\n                                                v2.0.2 - Pymodbus-3.7.0dev\n----------------------------------------------------------------------------\n\n> client.read_input_registers address 1 count 1 slave 1\n{\n    \"registers\": [\n        50556\n    ]\n}\n\n> client.read_input_registers address 1 count 1 slave 4\n{\n    \"registers\": [\n        51134\n    ]\n}\n\n> client.read_input_registers address 1 count 1 slave 5\n{\n    \"original_function_code\": \"4 (0x4)\",\n    \"error\": \"[Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)\"\n}\n\n>\n\n```\n\n\n### Running Tests\nTo run tests, use the following command: \n\n`poetry run pytest`\n\n### Building Distribution\nTo build the distribution package, use the following command: \n\n`poetry build`\n\nThis will create distribution packages in the dist/ directory.\n\n## Usage\n\n### Pymodbus Client\nRefer [REPL Client](./pymodbus_repl/client/README.md)\n\n### Pymodbus Server\nRefer [REPL Server](./pymodbus_repl/server/README.md)\n\n## Contributing\n* Fork the repository.\n* Create a new branch (git checkout -b feature-name).\n* Make your changes and commit them (git commit -am 'Add feature').\n* Push to the branch (git push origin feature-name).\n* Create a new Pull Request.\n\n## License\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "REPL (Read-Eval-Print Loop) tool for working with Modbus devices using the Pymodbus library.",
    "version": "2.0.4",
    "project_urls": {
        "Homepage": "https://github.com/pymodbus-dev/repl",
        "Repository": "https://github.com/pymodbus-dev/repl"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a6f13a45d105cd3815ef6399fca470f9122fe630bdbc1305e65bf153bbe8dc7",
                "md5": "ca903725aa37814351c9e0d6149e569a",
                "sha256": "be26bfabdc6db2e77d961740645974705880df4097e7daa3aae6026c698019f9"
            },
            "downloads": -1,
            "filename": "pymodbus_repl-2.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ca903725aa37814351c9e0d6149e569a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9.0",
            "size": 35996,
            "upload_time": "2024-08-11T16:30:16",
            "upload_time_iso_8601": "2024-08-11T16:30:16.090152Z",
            "url": "https://files.pythonhosted.org/packages/9a/6f/13a45d105cd3815ef6399fca470f9122fe630bdbc1305e65bf153bbe8dc7/pymodbus_repl-2.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d69d55bfdb8223c10d3db217854fde7fc2dc0745ce99afd562493988b86f7b6",
                "md5": "56d562b4a22c1488dea120d999ada52d",
                "sha256": "46ce229085abd9124d4e9cd62762954fe8296c95759877df8e4ae59156d6bc69"
            },
            "downloads": -1,
            "filename": "pymodbus_repl-2.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "56d562b4a22c1488dea120d999ada52d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9.0",
            "size": 32903,
            "upload_time": "2024-08-11T16:30:18",
            "upload_time_iso_8601": "2024-08-11T16:30:18.812081Z",
            "url": "https://files.pythonhosted.org/packages/1d/69/d55bfdb8223c10d3db217854fde7fc2dc0745ce99afd562493988b86f7b6/pymodbus_repl-2.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-11 16:30:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pymodbus-dev",
    "github_project": "repl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pymodbus-repl"
}
        
Elapsed time: 0.31907s