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.3.tar.gz (13.8 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.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easys7comm-0.2.3.tar.gz
  • Upload date:
  • Size: 13.8 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.3.tar.gz
Algorithm Hash digest
SHA256 7a6abc5c321fd548895f5b642dad06f403012ff808d75970ae94cdc0465bf84c
MD5 3af10a2a8089500fb2b37dc61dd5c0c4
BLAKE2b-256 c227f98693f08657e202ae5abfdd9b129581e46e9c32943a9cba1d7685c8280a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easys7comm-0.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 97ba5bb341e3a5e48e44ee97e81de4d0b16f3d0836e0aa167828f9d4dd92cb43
MD5 e384f04af53f2df100f29cece3b37001
BLAKE2b-256 f45e27690dcb411a6a65ea85776454adf577c9396ac8b620b94d61033b3ab7c8

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