All Products
Search
Document Center

:Scene orchestrations in the cloud

Last Updated:May 13, 2024

The rules for scene orchestration allow you to automate workflows based on the specified business logic in a visualized manner. You can configure time-based or device-based triggers and conditions for rules. The rules can execute actions that change the statuses of other rules, devices, or functions. This allows you to implement scene orchestration for a large number of devices.

Prerequisites

An edge instance is created. For more information, see Set up environments.

Create a scene rule

  1. Log on to the IoT Platform console.
  2. In the left-side navigation pane, choose Message Forwarding > Scene Orchestration.
  3. Click Create Rule. Scene orchestration
  4. Configure the parameters and click OK. The following table describes the parameters
    ParameterDescription
    Rule NameThe name of the rule. The name must be 1 to 30 characters in length, and can contain letters, digits, underscores (_), and hyphens (-).
    Rule DescriptionOptional. The description of the rule.
  5. After the scene rule is created, click Edit in the message that appears to configure the rule.
    You can also configure the scene rule by clicking View to the right of the rule name.

    For example, you can use a scene rule to automate an air conditioner. When the indoor temperature that is reported by the temperature sensor between 12:00 and 23:59 is lower than 16°C, the air conditioner automatically raises the indoor temperature to 26°C.

    The following figure shows the parameter configurations.

    Configure scene orchestration parameters

    In the upper-right corner of the page that appears, click Edit to change the name of the scene rule. For more information about other parameters, see the following table.

    ParameterDescription
    TriggersThe triggers that set off the rule. Valid values: Device Trigger and Timed Trigger. When the reported device data or the current time meets the triggers, the system checks whether the trigger conditions of the rule are met. You can create one or more triggers for a rule. The triggers are connected by logical OR operators.
    • If you set this parameter to Device Trigger, you must select an existing product, one or all devices, and one or all properties or one or all events.
    • If you set this parameter to Timed Trigger, you must specify a point in time. The point in time must be specified by using a CRON expression. A CRON expression consists of the following five fields: the minute, hour, day, month, and day of a week. For the day of a week, a value of 0 or 7 indicates Sunday and values from 1 to 6 indicate Monday to Saturday. Separate these fields with spaces. For example, you can write a CRON expression to trigger a rule at 18:00:00 every day in the 0 18 * * * format. You can also write a CRON expression to trigger a rule at 18:00:00 every Friday in the 0 18 * * 5 format. The asterisks (*) are wildcard characters. For more information about how to write a CRON expression, see CRONTAB.

      In the preceding example, this parameter is set to Device Trigger. In this case, the trigger refers to a scenario in which the indoor temperature that is reported by the temperature sensor is lower than 16°C.

    ConditionThe conditions. The rule is triggered only if the data meets all conditions. You can set this parameter to Device Status or Time Range. You can configure one or more conditions for a rule. The conditions are connected by logical AND operators.
    • If you set this parameter to Device Status, you must select an existing product, a device of the product, and a property or an event of the device feature.
    • If you set this parameter to Time Range, you must specify the start time and end time in the yyyy-mm-dd hh24:mi:ss format.

    In the preceding example, this parameter is set to Time Range, and the rule can be triggered between 12:00 and 23:59.

    ActionThe action to be performed. You can configure one or more actions. When an action fails, the action does not affect other actions.
    • If you set this parameter to Device Output, you must select an existing product, a device of the product, and a property or a service of the device feature. Only writable properties or services can be selected to perform the action. IoT Platform performs the actions based on the defined device properties or services when the triggers and the conditions of the rule are met.
    • If you set this parameter to Rule Output, you must select another rule. The action invokes the selected rule. The triggers of the invoked rule are skipped and only the conditions of the rule are checked. If the conditions are met, the actions that are defined in the invoked rule are performed.

      For example, if Rule A is triggered, the triggers of Rule A are skipped. The conditions of Rule A are checked. If all conditions of Rule A are met, IoT Platform performs the actions of Rule A. The conditions are connected by logical AND operators.

    In the preceding example, this parameter is set to Device Output. When the rule is triggered, the air conditioner raises the temperature to 26°C.

    Delayed ExecutionThis parameter is displayed after you show the advanced options. After you configure this parameter, the specified actions are performed in a specified period of time. Valid values: 0 to 86400. Unit: seconds.

Start scene rules

After a scene rule is created, you can start the scene rule on the Scene Orchestration page.

To start a scene rule, perform the following steps:

  1. Log on to the IoT Platform console. In the left-side navigation pane, choose Message Forwarding > Scene Orchestration.
  2. Find the scene rule that you want to start and click Start. The rule status changes to Running.
    Start a scene rule

After you start the rule:

  • If the scene rule runs on the cloud, you must configure message routing for the devices of the scene rule. This allows the device properties and events to be sent to IoT Hub that runs on the cloud. For more information about how to configure a message route, see Configure message routing.
  • If the scene rule runs at the edge, you must stop running the scene rule in the cloud and assign the scene rule to the edge instance. For more information, see Other operations for scene orchestration.

View logs

You can view the logs of scene rules and view the results on the details page.

Note A scene rule can run on the cloud and at the edge at the same time. To view all logs of the scene rule, perform the following steps: Log on to the IoT Platform console and choose Message Forwarding > Scene Orchestration.
  1. In the left-side navigation pane of the IoT Platform console, choose Message Forwarding > Scene Orchestration.
  2. Find the scene rule that you want to view and click Log on the right.
  3. Click Details to view the log details.
    log
    Note If a log is in the Failed state, you can click Details in the Actions column to view the details of execution failures.

Other operations for scene orchestration

  • Delete scene rules:
    1. On the Scene Orchestration page, find the rule that you want to delete.
    2. Click Delete to the right of the rule name. In the message that appears, click OK to delete the scene rule.
  • Trigger scene rules:

    After you start a scene rule, you can trigger the rule.

    1. On the Scene Orchestration page, find the rule that you want to trigger.
    2. Click Trigger to the right of the rule name. The rule is triggered once. All actions of the rule are performed regardless of the specified triggers.
  • Run a scene rule on an edge instance:
    To deploy a scene rule on an edge instance, perform the following steps:
    Important Make sure that you have stopped running the scene rule in the cloud.
    1. Log on to the Link IoT Edge console. In the left-side navigation pane, click Edge Instances. Find the edge instance that you created and click View in the Actions column.
    2. On the Instance Details page, click the Scenes tab. Then, click Assign Scene.
    3. In the Assign Scene panel, click Assign to the right of the rule name. Then, click Close. Assign the scene rule to an edge instance
    4. After the scene rule is assigned, redeploy the edge instance.