Explainer
Why Node-RED on a Neuron reaches I/O through Evok WebSocket
Short answer
A Neuron's I/O sits behind the Evok API service, not on a GPIO header, so the Raspberry Pi GPIO nodes cannot see it. Node-RED reaches the terminals with a WebSocket client to Evok, served by the Evok development branch, and routes on device and circuit identifiers instead of pin numbers. The Neuron keeps full Linux, so you install Node-RED the standard way.

On this page
- Why the GPIO nodes cannot see a Neuron's I/O
- Full Linux: install Node-RED, keep Evok
- The WebSocket path, hop by hop
- Run an Evok build that serves WebSockets
- The published package, or a generic client
- Connected is not correct: map circuits at the terminal
- Mapping all 34 digital inputs on an M303
- Outputs, and the restart check
- The decisions
- Questions asked
Node-RED runs on a Neuron as an ordinary Linux application, and it reaches the controller's I/O the way any client does: through Evok, the API service, over a WebSocket. The Raspberry Pi GPIO nodes cannot do this job, because they drive header pins on a Raspberry Pi's own processor, while a Neuron's terminals sit on the controller's I/O hardware behind Evok. Evok decodes that hardware and publishes every channel as a device with circuits, so your flows route on device and circuit identifiers instead of pin numbers. You keep full Linux access: install Node-RED with the standard method, run an Evok build that serves WebSockets, and point a WebSocket client at it. What follows is the path hop by hop, the checks that name the failing hop, and the mapping pass that makes the addressing trustworthy.
Why the GPIO nodes cannot see a Neuron's I/O #
A GPIO node takes a pin number and switches a header line, a model that fits a single-board computer with a handful of exposed pins. A Neuron is built differently: an M303 puts 34 digital inputs on its terminal blocks, and those terminals do not map one-to-one onto any host pin. Reaching them without Evok would mean raw bus work (I2C, SPI or similar) and decoding register maps yourself, which is exactly the labour Evok already performs. Evok is the primary API for accessing the I/Os of NEURON, PATRON, GATE and Unipi 1.1 devices, extension modules included, and it presents each channel by device and circuit. Node-RED therefore needs a network client, not a pin driver. That is the whole answer; the rest of this article makes the client work and proves it.
Full Linux: install Node-RED, keep Evok #
The Neuron is a full Linux system, so yes, you can replace the OS and run your own distribution. Log in over SSH, confirm a shell with package-install rights, and install Node-RED the standard Linux way. What you must not lose is the Neuron-specific layer underneath:
- Shipped image kept: Evok is already installed and maintained. Change nothing at the OS level and go straight to the WebSocket checks.
- Your own image flashed: the Neuron-specific layer went with the old image. Install Evok from its repository first; Node-RED alone will never see the I/O.
- No shell access: fix SSH or console access before anything else, because nothing downstream can be diagnosed without it.
The WebSocket path, hop by hop #
The WebSocket protocol (RFC 6455) begins as a TCP connection that is upgraded in place, so a successful TCP connect proves nothing about the handshake. The failure modes split cleanly across four hops:
| Hop | Element | How it fails |
|---|---|---|
| 1 | Node-RED flow with the WebSocket client | Wrong address, wrong node direction, flow not deployed |
| 2 | TCP connection: loopback on the Neuron, Ethernet from another host | Cable, switch, IP, subnet, firewall |
| 3 | Evok service | Stopped, build without WebSocket support, non-default port |
| 4 | Evok hardware layer to the terminals | Device not detected, wrong circuit identifier |
Test bottom-up so the failing hop names itself. From the Node-RED host, ping the Neuron first in the remote case: no reply is a cable, link LED, VLAN or subnet fault, and you fix it before touching software. Next, attempt a TCP connect to the Evok port: a refusal means Evok is not running or listens on another port; a timeout means a firewall or route drops the connection attempt. Then read the WebSocket node status: connected means the transport is good, and repeated connect/disconnect means a wrong path or a build without WebSocket support, which sends you to the next section.
Take the Neuron address, the Evok port and the WebSocket path from the configuration and documentation of your installed Evok build; they are not fixed here, so read them and do not guess them. The client URL then has the shape ws://<neuron-ip>:<evok-port>/<ws-path>. When Node-RED runs on the Neuron itself, point the client at the loopback address. Treat the Evok port like a PLC port: it belongs on the segmented control network, not the business network. And when Evok runs but reports no board on the SPI bus, that is a hardware-layer fault with its own fix, covered in resolving Neuron M203 Evok no-board-on-SPI errors.
Run an Evok build that serves WebSockets #
The WebSocket interface comes from the current development branch of Evok. A release package that predates it accepts TCP connections on its web port and still never completes a WebSocket handshake, a symptom that looks like a Node-RED fault and is not one. Read the installed version and, for a Git install, the checked-out branch:
cd <evok install directory>
git branch --show-current
git log -1 --format="%h %ad %s"
Development branch checked out: proceed. Release package or an older tag: switch to the development branch, restart the Evok service, and read the version again. Development commits change behaviour, so record the commit you validated with that git log line and stay on it; retest the whole path before moving to a newer commit.
The published package, or a generic client #
You do not have to hand-roll the client. The published package node-red-contrib-unipi-evok provides two nodes that reach the device over a WebSocket to the Evok API, and it states support for EVOK API v2.0 only, so confirm the version your build serves before wiring flows to it. A Node.js wrapper from the same publisher fetches the full device list, stores it under unipi.devices(), and then opens the socket with unipi.connect(). A generic WebSocket client node followed by a JSON node does the identical work in a flow, and it is the right choice whenever your build serves an API version the package does not support. On a gateway that never touches the internet, the vendor package still installs; the offline procedure with pinned versions is in stable Node-RED gateway flows with vendor-pinned nodes.
Connected is not correct: map circuits at the terminal #
A green connected status proves transport, not addressing. Attach a debug node to the WebSocket output and toggle one wired input at a time at the terminal:
- No message on toggle: the device may be absent from the device list Evok reports, or the build answers only on request instead of pushing state changes to connected clients. Confirm both before blaming the flow.
- Message with an unexpected circuit: record the identifier each terminal actually sends, against the device list, and route on what you recorded, never on what the silkscreen suggests.
- Correct circuit, wrong value: the fault is in the field wiring (input type, sink or source, supply voltage), not in Node-RED. The wiring rules are covered in connecting 12 V sensors to Neuron M303 digital inputs.
Parse each payload as JSON and route on the device and circuit fields exactly as the debug output of your build names them; do not borrow field names from another Evok version.
Mapping all 34 digital inputs on an M303 #
The inputs for the pass:
- Digital inputs on the M303 in front of you: 34, the count for the model you brought.
- Toggles per input during the pass: 1, this article's procedure.
- Acceptance rule: every toggle is answered by exactly one message, and the identifiers behind the terminals must all be distinct, because each terminal lives at its own device and circuit.
The arithmetic: expected messages = 34 inputs x 1 toggle = 34; distinct identifiers required = 34; on a healthy controller the pass records 34 messages and 34 distinct identifiers, so missing = 34 - 34 = 0 and duplicates = 34 - 34 = 0.
The result: a complete table, every terminal with one identifier, nothing missing and nothing doubled.
The decision: at 34 of 34 distinct identifiers, freeze the table with the project documentation and route every flow on it. Below 34, or with any identifier seen twice, stop: one terminal is not reaching Evok, the fault is in detection or wiring rather than in Node-RED, and you fix it before writing any flow logic.
Outputs, and the restart check #
Outputs travel back through the same socket: add a WebSocket-out node and send commands in the format your Evok build documents, then confirm the change at the physical terminal, because a relay that clicks is worth more than a green status dot. A relay command that executes yet reads back None is an Evok-side fault with its own cause, covered in troubleshooting EVOK relay_get returning None. Finish with the restart check: power-cycle the Neuron and confirm the socket reconnects without a manual redeploy. A flow that needs a redeploy after every power cycle is not finished.
The decisions #
- GPIO nodes are out. No terminal on a Neuron answers to a pin number; the address is a device and circuit identifier served by Evok over the WebSocket.
- Keep the shipped OS image and add Node-RED with the standard Linux method. Flash your own distribution only when you accept reinstalling and maintaining Evok yourself.
- Run the Evok development branch, record the validated commit, and match the client to the API version it serves: the published package for v2.0, a generic WebSocket client otherwise.
- Record the circuit table at the terminal once, freeze it with the project, and route on it, never on pin numbers or silkscreen guesses.
Questions asked
Which Evok API versions do the Node-RED clients support?
The published package states support for EVOK API v2.0 only, so on a build serving v3 it is the wrong tool. For v3, a community WebSocket client library documents support including EVOK v3, or you drive a generic WebSocket client node with the command format your build documents. Decide by the API version the installed Evok reports, not by which package is newest.
What replaces a GPIO node in an existing flow?
A switch node that filters the WebSocket messages on the circuit identifier you recorded, wired into the logic you already wrote. The downstream flow does not change; only the trigger does. For outputs, swap the GPIO output node for a WebSocket-out node sending the command format your Evok build documents, and verify each one at the terminal rather than in the debug sidebar.
Should Node-RED run on the Neuron itself or on a separate host?
Both work and the flow is identical; only the address in the client configuration changes. Run it on the Neuron over the loopback address when the logic belongs to that one machine, because nothing then depends on a cable, a subnet or a firewall. Run it on a separate host when the flow serves a line or a site, keep the Evok port on the segmented control network, and reach it from outside only through the remote-access path you already use for the PLC.

