Skip to main content

A abstraction of python-snap7

Project description

EasyS7Comm

In Development


⚠️ 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: Read
  • Write Variables: Write
  • Simplified Connection: Connection
  • Error Management: Error Handling

Prerequisites

Python

Ensure you have Python installed on your system.

Snap7 DLL

  • Download: You must download the snap7.dll from SourceForge.
  • Configuration: After downloading, place the snap7.dll in a directory that is accessible in your system's PATH. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easys7comm-0.2.4.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easys7comm-0.2.4-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file easys7comm-0.2.4.tar.gz.

File metadata

  • Download URL: easys7comm-0.2.4.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for easys7comm-0.2.4.tar.gz
Algorithm Hash digest
SHA256 065b53b7e401510a48e0f644b021d761614d990c5ab6839d30bbd85f8be37b0a
MD5 34e1cdd626f5a5de15b6613857dea2fc
BLAKE2b-256 f30e75a8e9caaa79cdaebf1cac34e18bddf80d4fedc75c1170cad1b48ea12b19

See more details on using hashes here.

File details

Details for the file easys7comm-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: easys7comm-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for easys7comm-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9acdd92e69921c26bb8492df6d417e7cbddcdcab51d727fefb6e7a6f4a010376
MD5 5d78148d06d83ae823b42c388c9d0fac
BLAKE2b-256 db6e42cf8c33516cc4fc47ef990cffc25609c825504044b0a12cfe3bdd69c080

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page