概述
ThingsBoard Edge 支持不同类型的自动化事件——Scheduler 和 Rule Chain 事件。
Scheduler事件 是自动执行的周期任务,如遥测和属性更新或RPC命令等。 该功能详情请参阅ThingsBoard Platform Scheduler文档和Edge Scheduler文档。
Rule Chain 可根据传入数据或事件执行自动化任务。 这些任务由 rule nodes 执行,即 Rule Chain 的构建块。例如,当设备发送达到阈值的温度数据时,Rule Chain会处理并创建告警通知。 详见 Rule Engine 和 Rule Chain Templates 文档。
Edge特有说明
- 在 Edge 4.0 之前,Rule Chain模板 无法在 ThingsBoard Edge 上直接创建或修改,需在 ThingsBoard Cloud 配置后再同步到 Edge。
- 自 Edge 4.0 起,可在 Edge 上创建和编辑 Rule Chain。
- Scheduler事件 必须在 ThingsBoard Cloud 中配置并分配到 Edge。
- Rule Chain模板 和 Scheduler事件 同步到 Edge 实例后,将完全在边缘执行,不依赖互联网连接。
- Scheduler事件 和 Rule Chain模板 均在 Edge 上本地执行。
对比矩阵

何时使用各自?
- Scheduler:
- 需要基于时间触发;
- 与设备数据无关的周期或计划自动化。
- Rule Chain:
- 对事件或遥测进行实时响应;
- 需要复杂逻辑或外部API调用;
- 处理本地传入数据、属性更新、告警等。
同时使用两项功能
为在Edge上创建增强自动化逻辑,可同时使用 Scheduler事件 和 Rule Chain模板。

用例
若要在每晚7点关闭设备(如泵),并在10分钟后若仍在运行则发出告警,需配置两个 Scheduler事件 并修改 Rule Chain模板。
- The first scheduler event will send command { “action”: “stop_pump” } to stop the pump every night at 7 PM. Select Send RPC Request to Device as the Event type.
- The second scheduler event will send command { "action": "check_pump_status" } to check the pump status every night at 7:10 PM. Enter "Custom" as the Event type and "Other" as the Message type.
- In the Rule Chain template:
- The first scheduler event (turn off pump) enters the rule chain as RPC Request to Device. It comes into Message Type Switch, routed via the "RPC Request to Device" link to the "rpc call request" node.
- The second scheduler event (check pump status) enters the rule chain as a custom message. The "check pump status" script confirms that the message is the second scheduler event. Then, the "originator telemetry" node fetches pumpStatus. The "check pump status script" checks if it's still "ON". If it is, the rule chain template triggers the alarm.
- The first scheduler event (turn off pump) enters the rule chain as RPC Request to Device. It comes into Message Type Switch, routed via the "RPC Request to Device" link to the "rpc call request" node.
- The second scheduler event (check pump status) enters the rule chain as a custom message. The "check pump status" script confirms that the message is the second scheduler event. Then, the "originator telemetry" node fetches pumpStatus. The "check pump status script" checks if it's still "ON". If it is, the rule chain template triggers the alarm.
下一步
-
Getting started guide(入门指南)- 快速概览 ThingsBoard Edge 主要功能。预计 15–30 分钟完成:
-
Installation guides(安装指南)- 了解如何在各种操作系统上安装 ThingsBoard Edge 并连接到 ThingsBoard Server。
-
Edge 规则引擎:
-
Rule Chain Templates(规则链模板)- 了解如何使用 ThingsBoard Edge 规则链模板。
-
Provision Rule Chains from cloud to edge(从云端向 Edge 下发规则链)- 了解如何从云端向 Edge 下发边缘规则链。
-
- 安全:
- gRPC over SSL/TLS - 了解如何为 Edge 与云端之间的通信配置 gRPC over SSL/TLS。
-
功能:
-
Edge Status(Edge 状态)- 了解 ThingsBoard Edge 上的 Edge Status 页面。
-
Cloud Events(云端事件)- 了解 ThingsBoard Edge 上的 Cloud Events 页面。
-
-
使用场景:
-
Manage alarms and RPC requests on edge devices(在边缘设备上管理告警和 RPC 请求)- 本指南展示如何在 Edge 上生成本地告警并向连接到 Edge 的设备发送 RPC 请求:
-
Data filtering and traffic reduce(数据过滤与流量削减)- 本指南展示如何从 Edge 向云端仅发送过滤后的设备数据:
-
- Roadmap(路线图)- ThingsBoard Edge 路线图。