Skip to main content

Other Blocks

note

Screenshots in this guide may look slightly different from what you see on your device. Please follow the actual interface for reference.

Overview

Aqara Studio offers more than basic functions like device control, scheduling, logic, and variables. It also provides Other Blocks that make your automation workflows more flexible and expressive.

This category includes JavaScript, Math, and String Concat. These blocks support advanced scenarios like custom conditions, dynamic value calculations, and formatted text generation. They help you achieve greater precision and customization in automation. With these blocks, you can move beyond basic logic and design more powerful workflows.

The other category includes the following blocks:

Other blocks overview

JavaScript

Feature

Use this block to customize the processing of string, numeric, and boolean variables.

Components

JavaScript components
Connection point / OperationRequiredDescription
Input PointAdd multiple parameter definitions in the script to create multiple input points on the block’s right side. Input points can connect to string, numeric, or boolean blocks (supports local variables, global variables, and point data).
Right-clickRight-click the block to open the script editor.
Output PointConnects to a variable block to record script results, or to other blocks that receive data.

How to Use

Here's how to use the JavaScript:

  1. Right-click the block, select "Script edit" to enter the "Script Editor".

    Select script edit
  2. Click the + button, select 1 parameter type from the dropdown list, and define your parameter name in the "Edit name" popup to add 1 parameter button.

    Select parameter type

    At this point, you can see that 1 new variable has been automatically added within the function. Based on this, you can start writing your own script.

    Double-click parameter button
  3. After completing script editing, click the Confirm button.

    Custom code
  4. At this point, you can see that 1 input point has been added on the left side of the block.

    Connect it to a Point Data block or other blocks that can provide values as an input parameter.

    Connect 1 variable block on the right side of the block (must match the return type) to record the script results.

    JavaScript workflow

Math

Feature

If you want to calculate certain values in automation, you can use the "Math" block.

Components

Math block introduction

This block is multi-point type with 1 configurable parameter:

Connection Point or ParameterRequiredDescription
In A (Input Point)Input A. The first number.
In B (Input Point)Input B. The second number.
Mathematical ExpressionSelect mathematical expression:
  • Add: In A + In B
  • Subtract: In A - In B
  • Multiply: In A * In B
  • Divide: In A / In B
  • Modulus: In A mod In B
  • Pow: In AIn B
  • Bit AND: In A ∧ In B
  • Bit OR: In A ∨ In B
  • Bit Xor: In A ⊕ In B
Output PointConnect to 1 numeric variable block to record calculation result, or to other blocks that receive number.

How to Use

Math example

The above image demonstrates subtracting 2 from the outdoor thermometer reading as the indoor air conditioner's set temperature.

Here's how to use the Math block:

  1. Connect In A and In B to the left side of the block respectively. In A and In B can be Point Data blocks, Global Numeric Variable blocks, Numeric Variable blocks, or other blocks that can provide numeric values.
  2. Select a mathematical expression within the block.
  3. Connect 1 block that can accept numeric values to the right side of the block.

String Concat

Feature

If you want to combine multiple texts or variables into a complete text string, you can use the "String Concat" block.

Components

String Concat block components

This block is multi-point type, supporting 2 input points and 1 output point by default, with 1 add button:

Connection PointRequiredDescription
Input Point 1Connects any variable block as the text to be concatenated.
Input Point 2Connects any variable block as the text to be concatenated.
Add ButtonAdds more input points to connect more text.
Output PointConnects to 1 string variable block for concatenation results.

How to Use

String Concat example

Here's how to use the String Concat block:

  1. Connect the variable blocks you want to concatenate (supports string, numeric, boolean, etc.) to the input points on the left side of the block.
  2. Connect 1 string variable block to the right side of the block to record the concatenation results.

Counter

Feature

The Counter block is used for cumulative counting, supporting operations such as increment, decrement, preset value, and reset. It is suitable for various scenarios that require counting or accumulating values.

Typical scenarios include:

  • People counting: Counting the number of people entering or exiting.
  • Device counting: Recording the number of device switch-ons or runtime counts.
  • Limited-action control: Triggering specific actions after reaching a set count.

Components

Connection Point/ParameterRequiredDescription
Count Up (Input Point)It connects to an Event or a Condition card. Each time the event or condition occurs, the count increases.
Count Down (Input Point)It connects to an Event or a Condition card. Each time the event or condition occurs, the count decreases.
Preset (Input Point)It connects to an Event or a Condition card. Each time the event or condition occurs, the count is reset to the preset value.
Clear (Input Point)It connects to an Event or a Condition card. Each time the event or condition occurs, the count is cleared (set to zero).
Preset Value (Parameter)The value to which the counter will reset when the Preset event occurs.
Count Increment (Parameter)The increment or decrement applied each time. Defaults to 1, customizable.
Output PointIt outputs the current count, connectable to a card receiving numeric values.