The Nominal Instrumentation Library is in alpha testing. To request access, open the Support Portal.
EtherNet/IP
EtherNet/IP config files declare an Allen-Bradley PLC endpoint, an optional local backplane route, and the scalar tags Nominal reads or writes.EtherNetIPDevice exposes those tags by local alias from Python and can publish boolean and numeric tag values to Nominal Core or Nominal Connect.
The EtherNet/IP client lives under
instro.ethernetip and is provided by the instro-ethernetip package (a native backend). Install it with the instro[ethernetip] extra; it is also included in instro[all].Install
Install with the EtherNet/IP extra:pip install instro-ethernetip.
EtherNet/IP graduated out of the experimental
instro-unstable package. If you used a pre-release
build, update imports from instro.unstable.ethernetip to instro.ethernetip (and the native
module from instro.unstable._ethernetip to instro.ethernetip._ethernetip), and install
instro[ethernetip] instead of instro-unstable[ethernetip].Quickstart
This example opens a CompactLogix connection, polls scalar tags, and publishes numeric samples to Nominal Core.- Code
- Config (compactlogix.json)
Current support
EtherNet/IP support is intentionally narrow. It targets PLC tags whose names and scalar data types are known before runtime.Other Allen-Bradley Logix-family PLCs may work through the same underlying protocol. Current hardware testing covers only CompactLogix 5332E 1769-L32E.
When to use each feature
A connection, scalar tag definitions, andautostart=True cover the common path. Use the fields and APIs below for specific EtherNet/IP requirements.
Key concepts
Lifecycle
The EtherNet/IP workflow has six steps:- Define PLC tags in a JSON config file or an
EtherNetIPConfig. - Instantiate
EtherNetIPDevice(config)with an optional connection override. - Call
open()to establish the native EtherNet/IP session. - Call
start()to begin background polling when timing is configured. - Read or write tags by alias with type validation.
- Call
close()to close the session and stop background polling.
with statement for normal scripts so close() runs when the block exits. close() stops the background polling daemon, closes publishers, and closes the native EtherNet/IP session.
Opening the session and validating the config do not probe the PLC tag map. Tag existence and actual PLC type are only validated when PLC I/O touches the tag: either when the background polling task reads poll: true tags, or when the user explicitly calls read_tag(), read_tags(), or write_tag().
Example timing section:
Supported data types
The config-driven API supports scalar PLC tag types. Thedata_type field is required for every tag so reads can validate that the PLC returned the expected kind before publishing. If the PLC returns a different kind than the configured data_type, EtherNetIPDevice.read_tag() raises TypeError.
Strings
Allen-Bradley LogixSTRING tags are encoded as LEN (DINT) plus DATA (SINT[]), which is unsupported at this time. Furthermore, string measurements are not supported by Nominal Core or Nominal Connect.
Batched reads
Use the private native session to read several PLC tags in one request:read_tags() preserves input order. The call raises EtherNetIpError only when the whole batch cannot be dispatched or parsed. Individual tag failures are returned in the result list as typed EtherNetIpBatchError instances such as TagNotFoundError, DataTypeMismatchError, or CipError, so successful tags in the same batch remain available.
Background polling
Withtiming configured and polling started, EtherNetIPDevice reads every tag with poll: true in one batched native request at the configured interval.
If one tag in the batch fails, that tag is skipped for the current measurement and the other successful tag values are still published.
Poll only streamable scalar tags:
bool- signed and unsigned integer types
reallreal
Route paths
Route paths are limited to local backplane slot hops:Tag discovery
Tag discovery is not supported. Every tag must be declared explicitly in thetags array with:
- a local
alias - the PLC
tag_name - the expected scalar
data_type - optional
poll,write_min, andwrite_max
data_type, an EtherNetIPDevice.read_tag() call raises TypeError.
Write limits
Setwrite_min and write_max to reject unsafe writes before they reach the PLC:
Configuration
Every EtherNet/IP config file must include:version: identifies the config schema version.protocol: must be"ethernetip"so the wrong protocol config fails clearly.device: metadata used for channel naming.tags: explicit tag definitions.
Full configuration example
Device section
Thedevice section describes the physical PLC. EtherNetIPDevice uses the name field as a prefix for published channel names.
Connection section
Route path
Each hop must be:
Tag definitions
Each tag entry defines one aliasable PLC tag:Timing section
When the
timing section is present, EtherNetIPDevice reads tags with poll: true in a batched background request at the specified interval. Successful values are published and buffered for retrieval.
Validation rules
EtherNetIPDevice validates configuration at load time:
protocolmust be"ethernetip".- Tag aliases must be unique.
- Every tag must declare
data_type. data_typemust be one of the supported scalar types.- Only numeric tags can use
write_minandwrite_max. write_minmust be less than or equal towrite_max.- Integer write limits must fit in the configured PLC integer type.
- Route path hops must be local backplane hops with slots from 0 to 255.
data_type; those checks happen only when the background polling task runs or when the user explicitly initiates a read_tag(), read_tags(), or write_tag() operation.
Create an EtherNetIPDevice instance
- JSON config
- Connection override
- Python config
Read and write
ReturnedMeasurement and Command objects use channel names in the pattern {device_name}.{tag_alias}. Write commands append .cmd to the channel name.
Background polling
Useautostart=True to open the session and begin background polling immediately:
Error handling
EtherNet/IP raises these errors for common failures:Known limitations
- EtherNet/IP support is installed through
instro[ethernetip](or the standaloneinstro-ethernetippackage). - Hardware testing covers Allen-Bradley CompactLogix 5332E 1769-L32E.
- Route paths support local backplane hops only. Network hops are unsupported.
- Current testing covers one local backplane hop.
- Tag discovery is unsupported.
- Arrays and UDTs are unsupported.
- PLC string tags are not exposed through the Python EtherNet/IP API.