This is a simple boilerplate for setting up modbus scripts to read from and write to.
Use the bundled pyproject.toml to setup your python environment. pyproject.toml expects UV as the python package and environment manager. However, you can use any alternatives (conda/venv).
If you are not using uv, then the following are the requirements for the environment:
- Python version (3.10)
- Pymodbus package version (2.5.3)
As long as you have any python environment with the above restrictions, the script will work. The pymodbus package version is important!
There's a single file which you can reuse/copy into your own projects - modbus.py. Example script using it to read and write is main.py.