⏱ Coming soon — package and repository not yet published.
EtherNet/IP adapts CIP over standard Ethernet to let PLCs and field devices exchange real-time I/O and configuration data using implicit and explicit messaging.
This adapter implementation turns a Python-hosted application into a full EtherNet/IP I/O device, exposing CIP objects over UDP for Class 1 I/O and TCP for Class 3 explicit messaging. The library runs as a compiled binary module that you call from Python, so application code remains focused on behavior rather than protocol framing.
The current release targets Linux and Windows environments, with LLDP object behavior available on Linux hosts only.
Imports & Setup
import Adapter
import os
import time
from random import randint as R
Callback Functions
Running = False
Output_Data = {}
def Log():
global Running
if not Running:
Running = True
os.system('cls')
for Key, Value in Output_Data.items():
print(f"{Key}: {Value}")
time.sleep(0.02)
Running = False
def IO(Data):
global Output_Data
for Key, Value in Data.items():
Run, IO = Value
Output_Data[Key] = [Run, IO]
Log()
def Config(Data):
for Key, Value in Data.items():
print(Key, Value)
def Random_List(Length, Start, Stop):
return [R(Start, Stop) for Index in range(Length)]
Adapter Configuration
Adapter.Config(IP='192.168.7.7')
Adapter.Register('IO', IO)
Adapter.Register('Config', Config)
Adapter.Register('Assembly', Config)
Adapter.Register('TCPIP', Config)
Adapter.Register('Ethernet', Config)
Adapter.Register('Reset', Config)
Adapter.Register('LED', Config)
Adapter.Register('LLDP', Config)
Adapter.Register('QoS', Config)
Adapter.Add(Name='A', Datatype='UDINT', T_O_Length=4, O_T_Length=8, Config_Length=6,
T_O_Instance=100, O_T_Instance=101, Config_Instance=102, Input_Only_Instance=111,
Listen_Only_Instance=112, Inhibit=False, O_T_Header=True, T_O_Header=True, Run=True)
Adapter.Add(Name='B', Datatype='USINT', T_O_Length=64, O_T_Length=64, Config_Length=32,
T_O_Instance=150, O_T_Instance=151, Config_Instance=152, Input_Only_Instance=161,
Listen_Only_Instance=162, Inhibit=False, O_T_Header=False, T_O_Header=False, Run=True)
Start & Runtime Loop
Adapter.Start()
while True:
time.sleep(0.01)
Adapter.Write('A', Random_List(4, 1, 10))
Adapter.Write('B', Random_List(64, 11, 20))The adapter is currently in a pre-conformance phase: the implementation targets ODVA specifications but has not yet been through official CT testing.