You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在ThingsBoard规则链中获取设备标签?

获取设备Label并传递至外部服务的规则链配置方案
  • 添加实体属性节点到规则链

    • 将originator节点的输出连接到该节点的输入
    • 节点配置:
      • 实体来源选择Originator
      • 属性类型选Server attributes
      • 属性键填写label(对应设备的label字段)
      • 勾选Add metadata to message,让获取到的label被加入消息元数据
  • 验证消息结构(可选)

    • 添加日志节点查看消息内容,确认metadata字段中包含label,示例结构:
      {
        "deviceId": "xxx",
        "deviceName": "xxx",
        "metadata": {
          "label": "目标设备名称"
        }
      }
      
  • 传递至外部服务

    • 使用REST API调用节点(或对应外部服务集成节点),在请求中通过${metadata.label}引用设备label:
      • 如POST请求Body中嵌入:{"deviceLabel": "${metadata.label}"}
      • 或URL参数中使用:http://your-external-service.com/api?deviceName=${metadata.label}
  • 注意点

    • 由于device label无唯一性约束,如需去重需在外部服务端做额外校验
    • 确保规则链拥有读取设备服务器属性的权限,避免获取失败

内容的提问来源于stack exchange,提问作者Umesh Kandhalu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 14:40:28