Esacode

Docs / Blocks / Devices

Network

Talks to devices and services on the worker's network: HTTP requests, TCP and UDP messages, listening, and a live bridge.

Runs on a worker (Python) Devices Version 1.0 Code you can open and adapt

How it works

Runs on the worker, so it reaches what that worker reaches (a robot's controller, a PLC, a sensor, a local server). HTTP: a request and its answer. TCP / UDP send: a message (text, or hex: 0a 1b …) and, for TCP, the reply. Listen: what arrives on a port for a while.

Bridge: keeps a TCP connection or a UDP port open and forwards the messages sent from the dashboard (Controls view, channel below; the value is sent as text) while it streams what comes back as live telemetry (channel reply). Everything received is also saved in received.jsonl.

Inputs

InputTakesWhat it is
Payload
payload
FilesOptional: a file sent as the request body or the message Optional.

Outputs

OutputGivesWhat it is
Received
received
Files
jsonl, bin, txt
received.jsonl (one line per message), and an HTTP answer's body
Live telemetry
telemetry
Live telemetryWhat the block sends while it runs, for views such as Chart or 3D view.

Settings

SettingDefaultWhat it does
Mode
mode
http
One of: http, tcp send, udp send, listen udp, listen tcp, bridge tcp, bridge udp
Address (HTTP)
url
http://192.168.1.10/ http:// or https:// (certificates are checked)
HTTP method
method
GET
One of: GET, POST, PUT, PATCH, DELETE
HTTP headers
headers
empty One per line: Name: value
Host (TCP, UDP)
host
192.168.1.10
Port
port
5000
From 1 to 65535
Message or body
payload
empty Text, or hex: followed by bytes (hex: 01 03 00 00); empty = the Payload file, if any
End text messages with a new line
newline
on
Wait or listen for (seconds)
seconds
5
From 0 to 86400
Channel of the messages to forward (bridge)
channel
control

Where it runs

On one of your computers with the EsaSim worker: Any worker.

In its code, settings are ctx.params["key"], inputs ctx.inputs["id"] and outputs ctx.output("id", "name.ext"); see Custom blocks.

More in Devices