Skip to main content

Action

This document explains the action blocks in Flow.

Overview​

In Flow, action blocks are used to perform actions within an automation process. They represent the key nodes where operations such as device control, data processing, or other results are executed.

Action blocks typically serve as end points in an automation Flow. After a condition is met or a branch is activated, such blocks are used to trigger real operations like "turn on the light", or "modify a variable value". Each action block can support multiple inputs (allowing it to be triggered by different conditions or data sources) and multiple outputs (enabling the sequential execution of multiple actions or synchronizing results with several following blocks).

Within Flow, you can perform the following actions:

  • Device: Directly send specific instructions to a single device, such as "turn on the light" or "turn off the air conditioner" for precise control.
  • Batch Execute: Execute the same operation on multiple devices of the same type at once, such as one-tap turning off multiple switches, for increased efficiency.
  • Scene: Execute an existing scene to reuse its actions, without reconfiguring each device in the current flow.
  • Data Process: Perform calculations, statistics, or string processing for use in subsequent logic.
  • Delay: Delay downstream judgement or actions for flexible process pacing.
  • Variable: Modify or toggle variable values to enable dynamic data flow.
  • Automation: Enable or disable other automations within the current automation for coordination and management.
  • Event State Hold: After an event occurs, the block sets a boolean variable to true, holds it for a duration, then sets it to false.
  • Loop Manage:
  • Script:
  • Message Push:

Device​

The device action block is used to write a custom value, a variable value, or a value from another data source to a property of a single specified device, or to toggle a Boolean state or run a device command with configuration parameters. Typical actions include turning a light on or off, adjusting air conditioner temperature, and toggling a switch.

How to Use​

  1. Click the + button in the left sidebar of the canvas, and under the Action category, select Device. Choose the target device from the device list.
  2. Next, you'll see a list of available blocks for that device, each representing a writable function point. Click the required block to add it to the canvas.
  3. Click the block's parameter to select or input the value or state for the target device's function point.
  4. After configuring the block, connect its input point to a condition block or trigger block so that the operation will be performed when the preceding condition is satisfied.

Batch Execute​

The batch execute block writes the same value to the same function point on multiple devices of the same type, or calls a device command with the same parameters, so you can send one operation in a single step. For example, you can turn off several switches at once, or set the brightness of a group of lights to 50.

How to Use​

  1. In the left sidebar of the canvas, click the + button, select Batch Execute under the Action category, and choose a device type from the popup list.

  2. You will then see the available blocks for this type, each representing a writable function point. Click the required block to add it to the canvas.

  3. Click the block's parameter to set a unified target value.

    Click the + button to batch-select the target devices to operate.

  4. After configuring the block, connect its input point to a condition block or trigger block so that the batch operation will be performed when the preceding condition is satisfied.

Scene​

The scene action block uses a predefined scene in an automation to run the action blocks in that scene, without configuring them again in the current flow.

How to Use​

  1. In the left sidebar of the canvas, click the + button, select Scene under the Action category to add a Scene action block to the canvas.

  2. On the block, select the scene to reuse.

  3. After configuring the block, connect its input point to a condition block or trigger block so that the scene runs when the preceding condition is satisfied.

    Select a scene action block

Data Process​

A data process block is mainly used to perform calculations, statistical aggregation, or string processing on collected data. It is a key tool for complex logic and dynamic decision-making. By flexibly processing variables, device variable, and more, you can address diverse data requirements in automation scenarios to make the flow more intelligent.

Flow supports seven common data processing methods: Math Operation, String Concatenation, String Substring, String Assignment, Case Conversion, Data Aggregation and Random Number, for numeric calculations, text processing, and data statistics, respectively.

Math Operation​

A math operation block applies arithmetic, remainder, rounding, absolute value, power, square root, logarithm, exponential, min/max, bitwise or shift operations to device variable, variables or custom numbers. Reference the result in later cards or write it to a selected variable.

How to Use​

  1. In the left sidebar under Action, select Data Process and add a "Math Operation" block.

    Add a math operation block
  2. Click the first parameter on the block to choose a global variable, local variable, device variable, or custom value as "Number A" for the calculation.

    Set number A
  3. Click the second parameter to choose the desired mathematical operator (e.g., add, substract, multiply, divide, etc.).

    Set function
  4. If the operation is addition, subtraction, multiplication, division, or exponentiation, click the third parameter to set "Number B". For rounding, absolute value, or square root, this parameter is unnecessary.

    Set number B
  5. In the final parameter, select where to output the result, i.e., a global variable, local variable, or device variable.

    Set output path
  6. Once configured, connect the block's input point to a condition block or trigger block so the calculation runs when the preceding condition is met.

String Concatenation​

The string concatenation block converts two source values to text and concatenates them in order. You can reference the result in later blocks or write it to a selected variable or device property. Use it to combine fixed text with live data, for example joining a room name with the current temperature into one message.

How to Use​

  1. In the left sidebar under Action, select Data Process and add a "String Concatenation" block.

    Add a string concatenation block
  2. Click the first parameter to choose a global variable, local variable, device variable, or custom text as the first string.

    Set string A
  3. Click the second parameter to choose the second string. This can also be a variable, device variable, or custom text.

    Set string B
  4. In the final parameter, select where to output the result: a global variable, a local variable, or a device function point.

    Set output path
  5. Once configured, connect the block's input point to a condition block or trigger block so the concatenation runs when the preceding condition is met.

String Substring​

The string substring block extracts text by start position and length. Positions start at 0; negative positions count from the end. If the length is longer than the remaining text, the result goes to the end of the string. If the length is 0 or negative, the result is empty. You can reference the result in later blocks or write it to a selected variable or device property.

How to Use​

  1. In the left sidebar under Action, select Data Process and add a "String Substring" block.

    Add a string substring block
  2. Click the first parameter to choose a global variable, local variable, device variable, or custom text as the source string.

    Set source string
  3. Click the second parameter to set the substring rule:

    • Start position: counting starts at 0; a negative value counts from the end.
    • Length: if the length is longer than the remaining text, the result is the full remaining text; if the length is 0 or negative, the result is empty.
    Set rule
  4. In the final parameter, select where to output the result: a global variable, a local variable, or a device function point.

    Set output path
  5. Once configured, connect the block's input point to a condition block or trigger block so the substring runs when the preceding condition is met.

String Assignment​

The string assignment block reads the current text from one source and assigns that same text to one or more writable variables or device properties. This overwrites the target value rather than finding and replacing a text fragment.

How to Use​

  1. In the left sidebar under Action, select Data Process and add a "String Assignment" block.

    Add a string assignment block
  2. Click the first parameter. Enter a custom string, or select a global variable, local variable, device variable, or trigger value as the new value (the replacement).

    Select the source string
  3. Click the second parameter and select a writable global variable, local variable, or device variable as the original value (the value to be replaced).

    Select the assignment target
  4. Once configured, connect the block's input point to a condition block or trigger block so the target text is overwritten when the preceding condition is met.

Case Conversion​

The case conversion block converts the current text of one or more writable variables or device properties to uppercase or lowercase and writes it back to the same targets. Characters without a case distinction remain unchanged.

How to Use​

  1. In the left sidebar under Action, select Data Process and add a "Case Conversion" block.

    Add a case conversion block
  2. Click the block parameters to select one or more writable global variables, local variables, or device variables as conversion targets.

    Select source string
  3. Choose whether to convert the text to uppercase or lowercase. The result is written back to the original targets; you do not select a separate output.

    Select function
  4. Once configured, connect the block's input point to a condition block or trigger block so the conversion runs when the preceding condition is met.

Data Aggregation​

The data aggregation block can calculate the sum, average, maximum or minimum of numeric inputs. The result can be referenced by later cards or written to a selected variable. Empty inputs or failed aggregation report an execution error.

How to Use​

  1. In the left sidebar under Action, select Data Process and add a "Data Aggregation" block.

    Add a data aggregation block
  2. Click the first parameter of the block to select the Add button to add a global variable, local variable, device variable, or trigger value.

    Add A Variable

    Repeat the above steps to add multiple variables.

  3. Click the second parameter of the block to select a statistical function ("Sum", "Average", "Maximum", or "minimum").

    Select function
  4. For the final parameter, choose the output target for the result: this can be a global variable, local variable, or directly written to a device trait.

    Select output target
  5. Once configured, connect the block's input point to a condition block or trigger block so the conversion runs when the preceding condition is met.

Random Number​

The Random Number block samples one value per execution and writes it to a selected variable. For sampling at a fixed interval, connect the input to an Interval Trigger.

How to Use​

  1. In the left sidebar under Action, select Data Process and add a "Random Number" block.

    Add a random number block
  2. Click the first parameter to set the coefficient and offset used to generate the random number.

    Select the output target
  3. Click the second parameter and choose a global variable, local variable, or device variable to write the random number to.

    Set the random number range
  4. Once configured, connect the block's input point to a condition block or trigger block. Each trigger samples one value. For repeated sampling, connect an Interval Trigger.

Delay​

The delay block inserts a specified duration of waiting within the automation Flow. By setting a delay time, you can buffer between process steps, control the pacing, or achieve timing triggers for special scenarios (e.g., delay before/after an action or judgment).

Wait for the configured duration after an upstream trigger, then continue the flow. A duration of 0 continues immediately. Use it to delay device actions or later checks.

How to Use​

  1. In the left sidebar under Action, select Delay. Click Delay to add the block to your canvas.
  2. Click the block's parameter to set the delay duration.
  3. Once configured, insert the delay block between two blocks in the process.

Variable​

Action blocks related to variables include Set Variable and Toggle Variable. You can set a selected flow, global, or device property variable to a custom value or a source's current value, to store intermediate results or update state used by later steps.

Set Variable​

The set variable block sets a selected flow, global or device property variable to a custom value or a source's current value. Use it to store intermediate results or update state used by later steps.

How to Use​

  1. In the left sidebar under Action, select Variable and click Set Variable to add the block to your canvas.
  2. Click the first parameter to select any global or local variable, or device variable of type string, boolean, or number.
  3. Click the second parameter to set the new value.
  4. Once configured, connect the block's input point to other blocks so that the variable will be modified when prior conditions are met.

Toggle Variable​

The toggle variable block reads and invert a selected boolean variable or device property: true becomes false and false becomes true. Use it to toggle an on/off state.

How to Use​

  1. In the left sidebar under Action, select Variable and click Toggle Variable to add the block to your canvas.
  2. Click the first parameter to select a boolean variable or device variable.
  3. Once configured, connect the block's input point to other blocks so that the Boolean value is toggled when conditions are met.

Automation​

Enable or disable a selected automation to control whether it responds to triggers. This card does not directly execute the target flow. Scenes cannot be enabled or disabled.

Action blocks related to process control include Automation enable/disable · Enable, and Automation enable/disable · Disable.

Automation Enable/Disable​

You can dynamically enable or disable other automations that have already been created from within the current automation.

How to Use​

  1. In the left sidebar under Action, select Automation, then click an Automation Enable/Disable block to add it to the canvas.

    Add an automation enable/disable block
  2. Click the first parameter on the block and choose the desired status: enable or disable.

    Set the automation status
  3. Click the second parameter on the block and select the target automation to enable or disable.

    Select the target automation
  4. Once configured, connect the block's input point to other blocks. When the preceding condition is met, the target automation is enabled or disabled.

Event State Hold​

When the flow reaches this block, the block sets a selected writable boolean variable to true and starts the timer. If the block is triggered again before the hold duration ends, the block restarts the timer and the variable stays true. After the preset hold duration elapses from the last time the block was triggered, the variable is set to false.

How to Use​

  1. In the left sidebar under Action, select Event State Hold and add the block to the canvas.

    Add an event state hold block
  2. Select the boolean variable or writable boolean device property to write to.

    Select a boolean variable
  3. Set how long the selected boolean variable stays true.

    Set the hold duration
  4. Connect the input to a trigger or condition block. After a trigger occurs, the target boolean variable is set to true.

Loop Manage​

Start or stop a selected loop trigger in this or another flow. Starting a stopped loop resets its count and waits one full interval before triggering. Starting an already running loop does not reset its count.

Script​

Run custom JavaScript. Use ctx.readVar and ctx.writeVar to read or write flow, global and device variables. Later cards can reference the latest execution result; execution exceptions report an error.

Message Push​

Send custom text or a source's current value as a text message to a DingTalk or WeCom group bot through the configured webhook. DingTalk supports a signing secret.