Skip to content

Where a node's values come from

Function nodes receive values as named arguments. Each comes from a message port, a node setting or a Python default.

Ports: what the graph carries

A port binds to a message name and reads its current value. Declare inputs reading and setpoint, and output heat:

def process(reading, setpoint):
    return {"heat": reading < setpoint}

Matching message names connect nodes. A port can have a different name from its message: bind port reading to house.temperature, for example.

Settings: constants of this node

Use settings for values that stay fixed while the flow runs: units, retries, thresholds. Add them in the Function node's Settings section; they are stored with the flow and passed beside the ports:

def process(reading, unit="C"):
    return {"shown": reading if unit == "C" else reading * 1.8 + 32}

With a unit setting, its configured value is passed to the function. Without one, the Python default applies. A setting cannot share a name with a port.

Changing a setting edits the flow draft, so publish it to apply the change. For a value that should change at runtime, use a message. To share a constant between nodes, publish it from one node and let the others consume it.

Flow inputs: what arrives from outside

Dashboard controls, the API and batch runs can supply messages without a producer node. Declare them as Inputs in the flow settings:

{"inputs": [{"spec": {"name": "setpoint", "dtype": "float"}, "initial": 21.0}]}

The initial value seeds an unset live message. Later publications take over; changing the starting value does not overwrite a value already in state. Use Publish this value now in the input row to send it immediately.

The canvas draws flow inputs as labelled endpoints, marked run or panel by what writes them. A panel input is one a dashboard or panel control writes, and the run form does not ask for it. Without a producer or declared input, a consuming node reports unconnected_input.

A batch flow's inputs are run parameters. Its Result section selects the messages returned when the run finishes. See Runs.

See also