EtherNetIPDevice#
- class EtherNetIPDevice(
- config: EtherNetIPConfig | dict | Path | str,
- connection: EtherNetIPConnectionInfo | dict | None = None,
- name: str | None = None,
- publishers: list[Publisher] | None = None,
- autostart: bool = False,
- **kwargs,
Bases:
InstrumentEtherNet/IP device with config-driven tag access.
Initialize an Instrument.
- Parameters:
name
Channel-name prefix for published data.
publishers
Publishers that receive emitted Measurement/Command data.
background_config
Background-daemon settings; default if omitted.
legacy_naming
When True, publish channels under their pre-v1.0 names (e.g.
main.ch1_vinstead ofmain.ch1.voltagefor PSU) for dashboards or recorded datasets keyed on those names. The setting is all-or-nothing per instrument. PSU, ELoad, I2C, InstroScope, and DAQ digital channels honor the flag; the categories with no v1.0 rename (DMM, Modbus, DAQ analog and relay channels) ignore it. Scheduled for removal in v2.0.**kwargs
Default tags applied to every emitted
MeasurementorCommand. Passdataset_rid="<rid>"to auto-create a NominalCorePublisher (uses the on-disk ‘default’ Nominal credential).
Attributes
EtherNet/IP endpoint address.
Seconds between background daemon iterations (0 = no wait).
Return an insertion-ordered snapshot of all published channel names.
Methods
Append
methodto the daemon's call list.Register a publisher to receive this instrument's Measurement/Command data.
Close the EtherNet/IP session and stop background polling.
Replace all daemon functions with a single
method(called with the given args).Return the most recent
lengthsamples forchannel_namefrom the in-memory buffer.Return the most recent sample for
channel_namefrom the in-memory buffer.Open the EtherNet/IP session.
Fan
dataout to every configured publisher;kwargspass through.Read one configured tag by alias and publish the result.
Read one configured tag by alias and publish the result.
Start background polling for poll-enabled EtherNet/IP tags.
Signal the background daemon to stop and join it.
Write one configured tag by alias and publish the command.
Write one configured tag by alias and publish the command.
- property background_interval#
Seconds between background daemon iterations (0 = no wait).
- read_tag(
- alias: str,
- **kwargs,
Read one configured tag by alias and publish the result.
- read(
- alias: str,
- **kwargs,
Read one configured tag by alias and publish the result.
- add_background_daemon_function(
- method: Callable,
- *args,
- **kwargs,
Append
methodto the daemon’s call list. Usedefine_background_daemonto replace instead.
- add_publisher(
- publisher: Publisher,
Register a publisher to receive this instrument’s Measurement/Command data.
- property channel_names: tuple[str, ...]#
Return an insertion-ordered snapshot of all published channel names.
Names are complete after one full daemon iteration: {name}.loop_time publishes every iteration, so call get_channel(“loop_time”, wait_for_new_samples=True) then read channel_names to ensure the complete set has arrived.
- Raises:
RuntimeError – No background buffer;
start()was not called.
- define_background_daemon(
- method: Callable,
- *args,
- **kwargs,
Replace all daemon functions with a single
method(called with the given args).
- get_channel( ) Measurement#
Return the most recent
lengthsamples forchannel_namefrom the in-memory buffer.If the channel does not exist yet, or no sample is available, the code will always block until
timeoutexpires.- Parameters:
channel_name
Name of the channel to retrieve.
length
Number of trailing samples to return.
wait_for_new_samples
Block until at least
lengthnew values arrive.timeout
Seconds to wait when insufficient data exists or
wait_for_new_samples=True.
- Raises:
RuntimeError – No background buffer;
start()was not called.ChannelNotFoundError – channel had no values and no data appeared before
timeout.wait_for_new_samples=Trueand channel did not appear withintimeout.ChannelValueTimeoutError –
wait_for_new_samples=Trueand values did not arrive withintimeout.
- get_single_channel_value(
- channel_name: str,
Return the most recent sample for
channel_namefrom the in-memory buffer.This will not wait, if data is not available then
Noneis returned.- Parameters:
channel_name
Name of the channel to retrieve.
- Raises:
RuntimeError – No background buffer;
start()was not called.
- publish(
- data: Measurement | Command,
- **kwargs,
Fan
dataout to every configured publisher;kwargspass through.
- stop()#
Signal the background daemon to stop and join it. No-op if not running.