Wrapper for python-snap7 library.
Install as a package from source files
git clone https://github.com/Jaimead7/PyPLC.git
cd PyPLC
py -m pip install .Install as a package from pypi
py -m pip install jaimead7-pyplc
Create a .toml file with the structure descrived in ./docs/examples/plc.toml.
from pathlib import Path
import pyPLC
file_path: Path = Path('./docs/examples/plc.toml')
manager: PyPLC = PyPLC.from_file(file_path)
ret = manager.connect()
ret, value = manager.read_var(var= 'Var1') # value = 10.5
ret, value = manager.write_var(var= 'Var1', value= 3.4)
ret, value = manager.read_var(var= 'Var1') # value = 3.4Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.