The function: command executes an automation.function and returns an output dictionary.

With this automation function named example.math.sum:



inputs:
  array/numbers:
    required@bool: yes

start:
  return:
    sum@text,int:
      {{array_sum(inputs.numbers)}}


This automation uses the function:



start:
  function/sum:
    uri: cerb:automation:example.math.sum
    output: result
    inputs:
      numbers@csv: 2,4,8
    on_success:
      return:
        sum@key: result:sum


To return:


  sum: 14

Syntax

uri:

The automation.function to run.

inputs:

The inputs vary based on the automation function.

output:

Save the results in this placeholder.

on_simulate:

The commands to run during simulation instead of the function.

If omitted, the function is executed during simulation.

on_success:

The commands to run on success.

The output: placeholder receives the return dictionary from the function.

on_error:

The commands to run on failure. If omitted, the automation exits in the error state.

The output: placeholder receives a dictionary with these keys:

Key  
error The error message.