# IO-Link

Read IO-Link sensors and actuators through their master, named and in units from each device's IODD

- Category: Industrial
- Capabilities: trellis, Streams, Assets, Commands, Parameters, Operations, Entities
- Runs on: Linux x64, Linux ARM64, macOS Apple silicon, macOS Intel, Windows x64

Read the IO-Link sensors and actuators on an IO-Link master — temperature,
pressure, flow, distance, valve terminals, I/O hubs — with every value named
and in its unit straight from the device's own description file (its IODD).
Nothing is mapped by hand.

## What you get

- **Every port of the master, and the device on each.** The master is asked
  which device sits on each port (vendor, device id, serial number), and the
  device's IODD says what its process data means.
- **Named, unit-correct channels.** A pressure sensor lands as
  `/iolink/<master>/port2/pressure` in bar, a temperature sensor as
  `…/port1/temperature` in °C, a switching output as a two-state channel
  labelled the way the IODD labels it. When a device's display unit is one of
  its own settings (°C or °F), the channel follows the device's setting.
- **Events, never silence.** Unplugging a device, plugging one in, swapping
  it for another of the same model (a new serial) or for a different device,
  switching a port to another mode, the device's own IO-Link events and the
  master going offline are each a line on a text channel and, where data
  stops, a gap on exactly the channels that stopped.
- **Device parameters.** Read and write a device's parameters by the names in
  its IODD, in its units; writes are checked against the IODD before they are
  sent and read back from the device after.
- **Outputs.** Process-data outputs (a valve terminal's coils, a hub's
  outputs) are commands, written into the layout the IODD gives them.
- **The master itself.** Its temperature, supply voltage and current.

## Before you start

- An ifm IO-Link master with IoT Core, reachable from this computer over the
  network: AL1350, AL1352, AL1950, or the IoT port of the AL13xx/AL19xx
  fieldbus masters. Firmware 3.x.
- Its IP address. Open `http://<address>/` in a browser to check it answers.
- Ports in **IO-Link** mode for IO-Link devices (a port in digital-input mode
  is read as one on/off channel).
- If the master is in **security mode**, its password.
- IODDs: nothing to do if this computer can reach the internet — a missing
  IODD is fetched once from IODDfinder, the IO-Link Community's catalogue, and
  kept on this computer. Offline, put the IODD files (the `.xml`, or the `.zip`
  as downloaded) in a folder and name it in the settings.

## Set up

1. **Inputs → Add input → IO-Link.**
2. **Master name**: a short name; it becomes part of every channel path
   (`/iolink/line3-master/…`).
3. **Master address**: the IP address (or `address:port`).
4. **Test connection.** The answer names the master and every port: the
   device on it, whether its IODD was found and how many values it gives.
5. Save. Channels appear as each device's IODD is read.

| Setting | Default | What it does |
|---|---|---|
| Master name | — | The `<master>` in every channel path |
| Master address | — | IP address or `address:port` |
| Master password | empty | Only for a master in security mode |
| Ports | all | Which ports to read, e.g. `1,2,4` |
| Read every (ms) | 10 | Pause between reads; `0` reads as fast as the master answers |
| IODD folder | none | A folder of IODD files you supply; it wins over every other source |
| Find missing IODDs online | Yes | Fetch an IODD not in your folder or on this computer from IODDfinder |
| Channel names in | English | The language of channel names, when the IODD has it |
| Master timeout (ms) | 1000 | How long one request may take before it counts as unanswered |
| IODD service | IODDfinder | Where missing IODDs are looked up |

## Reference

### Channels

Per port (`/iolink/<master>/port<n>/…`):

| Channel | What it is |
|---|---|
| one per value in the IODD | e.g. `pressure` (bar), `temperature` (°C), `switching_output_1` (on/off). The name is the IODD's own, in lower case with `_` |
| `status` | What is on the port, in words: operating (and where its IODD came from), no device, port disabled, digital input, communication error |
| `device` | The device: vendor, product, vendor and device id, serial number |
| `event` | Plug, unplug and swap, port mode changes, the device's IO-Link events (by name, from its IODD), and "no reading" when the device reports it has no measurement |
| `di` | For a port in digital-input mode: its level |
| `raw` | Only when no IODD can be found: the process data as hex, so nothing is lost |

The master (`/iolink/<master>/master/…`): `temperature` (°C),
`supply_voltage` (V), `supply_current` (A), `status` (connected, not
answering, back after an outage — with how long it was gone).

### Where an IODD comes from

In this order: the **IODD folder** you name; then the copies **this computer**
already keeps; then **IODDfinder** (when allowed). An IODD fetched online is
checked before it is used and kept, so the device reads offline from then on.
An IODD is refused — and the device's data lands as `raw` with the reason on
`status` — when it does not parse, names another device, describes no process
data, or its built-in checksum (its Stamp) shows it was changed after it was
published. A lookup that found nothing online is not repeated for 15 minutes.

When a device has several process-data layouts (chosen by one of its
settings), or shows its value in a unit chosen by a setting, that setting is
read from the device when it is plugged in. If it cannot be read, the IODD's
default is used and `status` says so.

### Timing

Every port is read in one request per cycle. Values are stamped by this
computer's clock at the middle of the request that read them. Who is on each
port is checked about once a second, and at once when a read suggests a
change. A device's value that the device itself marks as having no reading
(an IODD value such as "No measurement data") lands as a missing sample and
the reason is said on `event`; process data the master flags invalid lands
as missing samples.

### Parameters

- **List** a port's parameters: `param.list` with `port` (add `read: true` to
  read each current value).
- **Read**: `param.get` with `port` and `name` — the parameter's name in the
  IODD (`set_point_1`), its IODD id (`V_SP1`) or its index.
- **Write**: `param.set` with `port`, `name` and `value`, in the parameter's
  unit (a set point in bar is written in bar). Each writable parameter is also
  a command path, `/iolink/<master>/port<n>/param/<name>`.
- A write is refused before it reaches the device when the IODD says the
  parameter is read-only, the value is outside its range or not one of its
  allowed values, or the value is not a whole step of its resolution. A
  readable parameter is read back after the write and the device's own
  answer is returned. The device's refusals are named (for example "Index not
  available", "Parameter value out of range").
- `isdu.read` reads any index raw, for one the IODD does not describe.

### Outputs and the safe state

A device with process-data outputs has one command path per output,
`/iolink/<master>/port<n>/out/<name>`, written into the bit layout its IODD
gives. Outputs are written only while the input is running. **When the input
stops, every output it wrote is set to all-zero**, the de-energised state of
an IO-Link output. The master's own behaviour when this computer disappears
(rather than stopping cleanly) is the master's configuration; IoT Core offers
no watchdog this connector can arm.

### Faults

| What happens | What you see |
|---|---|
| Device unplugged | `event`: device unplugged (and which); `status`: no device; a gap on that port's values |
| Device plugged in | `event`: device plugged in; its channels come back |
| Same model, new serial | `event`: the serial change; the channels carry on |
| A different device | `event`: device swapped; a gap on the old device's channels; the new device's channels from its own IODD |
| Port mode changed | `event` and `status` |
| Master stops answering (rebooting, unplugged) | master `status`: stopped answering; one gap on every channel it fed; reconnects every 0.25–5 s |
| Master back | master `status`: back after N s; every port checked again against what was there |
| One unanswered or garbled answer | retried; master `status` says so; no gap |
| No IODD, or a refused one | the port's values land as `raw`; `status` says why |

## What has not run on real hardware

| | |
|---|---|
| ifm masters | Every behaviour above is tested against a simulator written from ifm's IoT Core documentation (firmware 3.1 and 3.3 manuals), not yet against a physical master |
| Security mode | The password is sent the way ifm documents; a master in security mode serves HTTPS, and an HTTPS master with a self-signed certificate is not supported yet |
| IODDs | The IODD reader is tested against 19 real published IODDs from 12 vendors; devices themselves have not been read |
| Other makers' masters | Not supported yet |

## Troubleshooting

- **Test connection says "no answer".** Check the address in a browser
  (`http://<address>/`) and that nothing between this computer and the master
  blocks port 80.
- **A port lands `raw`.** Its `status` says why: no IODD found (put the IODD
  in your IODD folder, or allow looking online), or the IODD was refused (its
  file is damaged or was edited — download it again).
- **401 Unauthorized** on `status`: the master is in security mode; enter its
  password.
- **532 PLC connected**: a fieldbus controller holds the master; writes are
  refused until it releases it.
- **A value shows °C but the device shows °F.** The display unit is read
  when the device is plugged in, and again whenever it is written through
  this connector. After changing it on the device's own buttons, unplug and
  plug the device, or restart the input.

## Supports

- ifm IO-Link masters with IoT Core (AL1350, AL1352, AL1950 and the AL13xx/AL19xx fieldbus masters' IoT port)
- Any IO-Link device on the master: process data decoded from its IODD, found online (IODDfinder) or in a folder you name

## Connection fields

| Field | Type | Required | Notes |
|---|---|---|---|
| Master name | Text | Yes |  |
| Master address | Text | Yes |  |
| Master password (security mode) | Secret | No |  |
| Ports | Text | No |  |
| Read every (ms) | Number | No |  |
| IODD folder | Folders | No |  |
| Find missing IODDs online | One of | No |  |
| Channel names in | One of | No |  |
| Master timeout (ms) | Number | No |  |
| IODD service | Text | No |  |
