Scenario orchestrations deployed at the edge enable quick response to local messages and can take proper effect in cases of network disconnections. This topic takes the following scenario as an example to describe how to configure scene rules: The Light device is turned off when the light detected by the LightSensor device is greater than or equal to 500 lumens. The Light device is turned on when the light is less than or equal to 200 lumens.
The following figure shows the process.
- Create a scene rule.
- On the Edge Instances page, find the edge instance that you have created in Prerequisites and click View in the Actions column.
- On the Instance Details page, click the Scenes tab and click Assign Scene.
You can assign an existing scene rule to an edge instance. If no rules are available, perform the following two steps to create a new scene rule.
- In the Assign Scene dialog box, click Add Scene Orchestration. The page appears. On the page, the Create Scene Orchestration dialog box is displayed.
- Create a scene rule named Rule_Light_Open. For more information, see Scene orchestrations on the cloud.
- After the rule is created, edit the scene rule, as shown in the following figure.
After editing the scene rule, click Next to go back to the Assign Scene dialog box.Note After you are redirected to the Assign Scene dialog box on the Scenes tab of the Instance Details page, the Next button instead of Save is displayed at the bottom of the page for editing a scene rule. This allows you to go back to the Assign Scene dialog box after editing the rule. Then, you can assign the rule to the edge instance.page from the
- Find the created scene rule, and click Assign in the Actions column. Assign the rule to the edge instance.
- In the Assign Scene dialog box, click Add Scene Orchestration to create a scene rule named Rule_Light_Close. The creation procedure is the same as that used to create the Rule_Light_Open scene rule.
- Edit the Rule_Light_Close scene rule, as shown in the following figure.
- Deploy the edge instance.
- In the upper-right corner of the Instance Details page, click Deploy. In the message that appears, click OK to deploy the edge instance.
- If the status of the edge instance is Deployed, it indicates that the edge instance has been deployed. You can click View Logs to view the details of the deployment. You can also click View Deployment Logs in the upper-right corner of the Instance Details page to view deployment records.
If the deployment fails, click the plus sign (
+) that is followed by the resource name on the Deployment Details page to view the cause of the failure.
After the edge instance is deployed, the scene rules start to run at the edge. The rules monitor the environment, and trigger execution if required.
- View scene orchestration logs of the edge instance.
Note If a scene rule runs on the cloud and at the edge, you can view the logs by choosingin the IoT Platform console.
- On the Scenes tab of the Instance Details page, find the target scene rule, and click Logs in the Actions column.
- On the Rule Execution Log page, click Details to view logs.
- Optional. Go to the Instance Details page, click the Monitoring tab, and then click Scene Orchestration. You can view the metrics of a scene rule that is assigned to the edge instance as
Find the target rule, and click View in the Actions column.