CLI toolsiec102ctl
Read electricity meters and data concentrators over IEC 102: product information, the clock, integrated totals by period window, events, and the requests of the Spanish REE profile, or simulate a meter for a metering front end. Part of iec60870ctl.
Install
Linux and macOS
curl -fsSL https://get.otfabric.io/iec102ctl | sh
Windows (PowerShell)
irm https://get.otfabric.io/iec102ctl.ps1 | iex
CI, containers and device images
curl -fsSL https://get.otfabric.io/iec102ctl | env OTF_UNMANAGED_INSTALL=/usr/local/bin sh
One static binary for Linux (x86-64, ARM64, ARMv7), macOS (Intel, Apple silicon) and Windows (x86-64, ARM64), with no runtime to install. The installer checks the release's SHA-256 checksum, installs per user without sudo, and upgrades in place when you run it again. Pin a release withOTF_VERSION. All install options. To build from source: go install github.com/otfabric/iec60870ctl/cmd/iec102ctl@latest.
First commands
# No meter at hand: start the built-in demo meter
iec102ctl server start
# Who is it, and what time does it have?
iec102ctl client info --url tcp://127.0.0.1:2401
iec102ctl client time --url tcp://127.0.0.1:2401
# The hourly load profile of one day, in an REE session
iec102ctl client totals --url tcp://127.0.0.1:2401 --record 11 --from 2026-01-01T01:00 --to 2026-01-02T00:00 --access-key 7
# Events of list 52
iec102ctl client events --url tcp://127.0.0.1:2401 --record 52
# REE tariff information of contract I
iec102ctl client ree tariffs --url tcp://127.0.0.1:2401 --access-key 7
The iec102ctl guide walks through every command group, connection option and safety rule.
For scripts, CI and containers
iec102ctl is as easy to read for a pipeline as for a person. It follows the same conventions as every OT Fabric tool, so a script written for one protocol carries over to the next.
- JSON output.
--format json, or IEC102CTL_FORMAT=json for a whole job. One JSON document per command, JSON Lines for streams, and a single {"error": {"kind", "code", "message"}} object on failure. Field names are a documented contract: json-output.md. - Clean streams. The result goes to stdout; progress, connection state and debug traces go to stderr.
- Stable exit codes from the shared OT Fabric table, so a script can tell a missing connection (4) from a timeout (5) or a refusal by the device (6). Which command returns what: exitcodes.md.
- Aligned version reporting.
iec102ctl version --json prints name, version,tag, commit, built, libraries (the OT Fabric stacks inside the binary), go andplatform, with the same keys in every tool. - Pinned installs with
OTF_VERSION, and OTF_UNMANAGED_INSTALL for images that must not touch PATH or shell profiles.
The exit-code table
| Code | Meaning |
|---|
0 | Success |
1 | Findings: the command completed and its result reports problems, such as a file that does not validate or a diagnosis with a failing check |
2 | Usage: unknown command or flag, a missing argument |
3 | Invalid input: a flag value, a file or a combination that does not make sense. Nothing was sent |
4 | Transport: the connection could not be made, or was lost |
5 | Timeout: the device did not answer in time |
6 | Protocol: the device refused the request, or broke the protocol |
7 | Partial success: a valid result was written, and it holds failures |
8 | Unsupported: the device, or this platform, does not support what was asked |
9 | Permission: the device or the operating system refused, such as raw-socket access without the capability |
10 | Output or internal error |
130 | Interrupted by Ctrl-C or SIGTERM before a result |
Each tool uses the codes that apply to it; a code never changes meaning between tools.
In a Dockerfile
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& curl -fsSL https://get.otfabric.io/iec102ctl \
| env OTF_UNMANAGED_INSTALL=/usr/local/bin sh \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["iec102ctl"]
Scripts, CI and containers has GitHub Actions and GitLab CI examples and shows how to use a simulator as a test fixture.
Protocols
- IEC 60870-5-102: Reading integrated totals, the energy values of electricity meters, from meters and data concentrators over serial lines and modems; in Spain the basis of fiscal metering.
The README on GitHub has the full feature list, examples and changelog.