A abstraction of python-snap7
Project description
EasyS7Comm
⚠️ Important Notice
EasyS7Comm is currently in the early stages of development and is not ready for use in production.
Description
EasyS7Comm is a simplified abstraction of the powerful Python-Snap7 tool. This project was created to make Snap7 accessible to automation professionals with limited programming knowledge. With EasyS7Comm, you can perform read and write operations on variables quickly and efficiently using minimal code.
While EasyS7Comm abstracts some of Python-Snap7's advanced features, this trade-off is ideal for those who need straightforward and easy-to-use automation solutions.
Features
- Read Variables:
- Write Variables:
- Simplified Connection:
- Error Management:
Prerequisites
Python
Ensure you have Python installed on your system.
Snap7 DLL
- Download: You must download the
snap7.dllfrom SourceForge. - Configuration: After downloading, place the
snap7.dllin a directory that is accessible in your system'sPATH. This ensures that EasyS7Comm can locate it during execution.
Installation
Clone the repository and install the dependencies.
# Clone the repository
git clone https://github.com/your-username/easys7comm.git
cd easys7comm
Note: If EasyS7Comm becomes available on PyPI in the future, installation might be as simple as using
pip install easys7comm.
How to Use
Below is an example demonstrating how to use EasyS7Comm for reading and writing operations with a PLC.
# examples/basic_usage.py
from easys7comm import PLC, DataType
def main():
try:
# Create a PLC instance with the specified IP address
plc = PLC("192.168.0.2")
# Write the string "Allan" to the PLC variable
plc.write("DB20.DBX12.0", "Allan", DataType.STRING)
# Read and print the value from the variable
print(plc.read("DB20.DBX12.0", DataType.STRING))
# Check and print if the connection is active
print(plc.get_connected())
except Exception as e:
print("An error occurred:", e)
finally:
# Close the connection with the PLC
plc.close()
Tip: Ensure your PLC is properly configured and your network connection is stable to avoid connection issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easys7comm-0.2.2.tar.gz.
File metadata
- Download URL: easys7comm-0.2.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be4b0c444f7aa8ce4e18d541a57e59422b089045794fa74f29c9467b0e059438
|
|
| MD5 |
1aaadae608e6a8178671f0b5a5d84997
|
|
| BLAKE2b-256 |
7d6876c9849eb37ffa8ca764b090610b68f288056ccc44d55a259a5f26a162cf
|
File details
Details for the file easys7comm-0.2.2-py3-none-any.whl.
File metadata
- Download URL: easys7comm-0.2.2-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
634cdf0d03369d030bbab6516f7d5783a32ae79407e93dce3bc693b98880b6fe
|
|
| MD5 |
ada82229bf1bd9eb7b7fcc625b76db2e
|
|
| BLAKE2b-256 |
d5ad033195c8b01ce13d3013517e43ea22b6504032ade52b24c64cac4f5364dd
|