Script Filter
Node ID: scriptFilter · Role: Filter · Realtime config: yes
Description
Programmable filter using Rhai scripts. Receives sensor data, runs a user-defined script, and emits the result. Scripts can transform, filter, or convert data between types at runtime.
Inputs / Outputs
- Inputs:
Any - Outputs:
Any
Config aliases
ScriptFilter, scriptFilter
Properties
Each row shows the setting’s label in the node’s Properties panel and, in code, its key in the node’s settings object in the config file. A setting omitted from the config file uses the default shown here.
| Property | Type | Default | Description |
|---|---|---|---|
Script script | code | `fn process(data) { | |
| data | |||
| }` | Rhai script body. Entry point is fn process(data), which receives the incoming sample and returns the value to emit. | ||
Input Ports inputCount | number | 1 | Number of input ports exposed on the node. |
Output Ports outputCount | number | 1 | Number of output ports exposed on the node. |
Example node definition
A minimal entry in config.json looks like the block below. Paste it under the sinks key, keyed by an instance name of your choice. All settings are optional: anything not listed under settings uses the default from the Properties table above. See The configuration file for how the sections and endpoint wiring work.
{
"sinks": {
"scriptFilter": {
"dataEndpoint": "inproc://scriptFilter_data",
"inputEndpoints": [],
"settings": {}
}
}
}