产品定价 立即试用
PE边缘
文档 > 调度器 > 调度器vs规则链
入门
安装 架构 API 常见问题
目录

调度器与规则链模板对比 - 何时使用

概述

ThingsBoard Edge 支持不同类型的自动化事件——SchedulerRule Chain 事件。

Scheduler事件 是自动执行的周期任务,如遥测和属性更新或RPC命令等。 该功能详情请参阅ThingsBoard Platform Scheduler文档Edge Scheduler文档

文档信息图标

Scheduler 功能仅在 Professional Edition 中支持。

Rule Chain 可根据传入数据或事件执行自动化任务。 这些任务由 rule nodes 执行,即 Rule Chain 的构建块。例如,当设备发送达到阈值的温度数据时,Rule Chain会处理并创建告警通知。 详见 Rule EngineRule 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 上本地执行。

对比矩阵

comparison-matrix

何时使用各自?

  • Scheduler:
    • 需要基于时间触发;
    • 与设备数据无关的周期或计划自动化。
  • Rule Chain:
    • 对事件或遥测进行实时响应;
    • 需要复杂逻辑或外部API调用;
    • 处理本地传入数据、属性更新、告警等。

同时使用两项功能

为在Edge上创建增强自动化逻辑,可同时使用 Scheduler事件Rule Chain模板

both-features-logic

用例

若要在每晚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.

下一步

  • Getting started guide(入门指南)- 快速概览 ThingsBoard Edge 主要功能。预计 15–30 分钟完成:

  • Installation guides(安装指南)- 了解如何在各种操作系统上安装 ThingsBoard Edge 并连接到 ThingsBoard Server。

  • Edge 规则引擎:

  • 安全:
    • gRPC over SSL/TLS - 了解如何为 Edge 与云端之间的通信配置 gRPC over SSL/TLS。
  • 功能:

    • Edge Status(Edge 状态)- 了解 ThingsBoard Edge 上的 Edge Status 页面。

    • Cloud Events(云端事件)- 了解 ThingsBoard Edge 上的 Cloud Events 页面。

  • 使用场景:

  • Roadmap(路线图)- ThingsBoard Edge 路线图。