Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Examples

Sample flows for flow-engine. Import any of them via the toolbar Import button or POST /api/flows/import. They use placeholder hosts (127.0.0.1/localhost) and addresses — edit them for your setup.

Flows (flows/)

File What it shows
hello.flow.json inject → function → debug — the basics (rhai payload * 2)
logic-pipeline.flow.json inject → range → filter → switch → template → debug — scale a reading, drop unchanged values, route high/low
sequence-demo.flow.json inject → sort → split → template → join → debug — sort an array, process each item, reassemble
mqtt-broker-demo.flow.json a shared MQTT broker config used by mqtt-out + mqtt-in (one connection); publish then receive on the same topic
modbus-demo.flow.json poll a Modbus holding register → MQTT, and MQTT command → Modbus coil write
weigher-demo.flow.json read ASCII lines from a serial scale → MQTT + debug
weigher-gsc-command-demo.flow.json GSC scale: read with byte_map + 7 data bits → MQTT, and MQTT cmd/tarechange → serial write (T\r\n)
modbus-slave-demo.flow.json act as a Modbus TCP server; emit a message on external writes

For mqtt-broker-demo, open the Brokers dialog to set the broker host / credentials (the demo uses localhost:1883); both MQTT nodes reference it, so they share one connection.

Function node languages

The function node has a Language dropdown:

  • rhai (default) / js — write a script; it sees payload and topic, mutates them, and the node emits the result. e.g. payload = payload * 2;
  • wasm — upload a compiled .wasm module (C/C++/Rust/Go/Zig). It runs sandboxed via the pure-Rust wasmi interpreter (works on every target, including 32-bit armv7).

WASM ABI

The module must export:

Export Signature Purpose
memory linear memory
alloc (i32 len) -> i32 ptr allocate an input buffer
transform (i32 ptr, i32 len) -> i64 read UTF-8 JSON payload at [ptr,len); return packed (out_ptr<<32 | out_len); host reads [out_ptr,out_len) as the new JSON payload

See wasm/transform.c for a complete, buildable C example (payload * 2).