Tier0 技术指导手册

快速开始

选择最合适的版本

Edge、Tier0 云服务版或 Enterprise:通过定位、套餐和能力矩阵选择适合你的 Tier0 版本。

查看 这里 了解每个产品的详细功能,并选择最适合你的版本。

快速开始

安装

按版本安装 Tier0。

Tier0 提供三个版本:

  • Edge - 开源版,可通过 Docker 在本地运行。
  • Tier0 云服务版 - 云端托管 SaaS。
  • Enterprise - 面向企业环境的私有化部署版本。

请参阅 选择最合适的版本 来判断哪个版本最符合用户需求。

在体验 Tier0 云服务版之前,需要申请试用账号。

  1. 在 注册 Tier0 页面注册账号。
  2. 用发到邮箱的验证码进行验证后,使用注册账号登录。
  3. 创建一个工作空间并开始体验 Tier0.

使用 Tier0

工厂数据基础

Unified Namespace 模型:Metric、State、Action,以及 UNS 如何存储工厂数据。

在 Tier0 中,工厂数据会基于 UNS(Unified Namespace)方法组织成清晰的树形模型,形成统一的数据基础。

  • Broker 通过模型 topic 接收和发送数据。
  %%{init: {"flowchart": {"defaultRenderer": "elk", "nodeSpacing": 32, "rankSpacing": 48, "diagramPadding": 8}}}%%
  flowchart TB
  source["数据源 / 消费者"]
  subgraph UNS["Unified Namespace"]
      direction LR
      Model["模型<br/>定义路径、topic 和 payload"]
      Broker["Broker<br/>处理数据交换"]
      Storage["存储<br/>持久化数据"]
      Model <--> Broker
      Broker --> Storage
  end
  source <-- "MQTT / API" --> UNS
  classDef broker fill:#F7FAF2,stroke:#D8E6B8,stroke-width:1px,color:#2A2A2A,stroke-dasharray:5 5
  class Broker broker
  • 模型分为 Metric、State 和 Action 三种类型。
  • 数据会根据模型类型存储到不同数据库中。
    • Action/State: JSONB (PostgreSQL)
    • Metric: 实时数据(TSDB)
    %%{init: {
      "themeVariables": {
        "fontSize": "14pt"
      },
      "flowchart": {
        "defaultRenderer": "elk",
        "nodeSpacing": 40,
        "rankSpacing": 56,
        "diagramPadding": 8
      }
    }}%%
    flowchart LR
    subgraph Model["模型类型"]
        direction TB
        metric["Metric<br/>高频数值数据"]
        state["State<br/>当前事实或状态"]
        action["Action<br/>命令或请求操作"]
    end
    subgraph Storage["存储"]
        direction TB
        tsdb["TSDB<br/>Metric 历史的时序存储"]
        jsonb["JSONB<br/>State 和 Action 的文档存储"]
    end
    metric --> tsdb
    state --> jsonb
    action --> jsonb

在 Tier0 中,broker 是平台组件,它会基于数据模型,通过 MQTT 或 OpenAPI 接收和发送数据。

  • 通过 MQTT:模型树中每个节点的完整路径会作为 topic 地址,用于传递消息内容。
  • 通过 OpenAPI:通过 HTTP 请求对数据模型执行 CRUD 操作。

工业数据变化频率不同,目的也不同,因此 Tier0 将 UNS 模型固定分为三类。

类型 对象 示例
METRIC 面向连续采集、需要时序存储的高频数据。 设备温度/压力/电压
STATE 面向变化频率较低、用于描述对象当前状态或事实的数据。 设备运行状态
ACTION 面向低频命令数据,用于记录外部系统或操作员应执行的动作。 启动批次、停止设备

每个 UNS 模型都包含 path、topic 和消息内容。它们共同形成一棵树,既承载业务上下文,也传输工业数据。

  • Path/Topic:path 表示数据归属,topic 承载消息内容。二者共同定义 模型地址。
  • 消息内容:topic 中保存的消息内容。它是 键值对 格式的 JSON,用来定义 模型数据。

例如,UNS 中的模型可以像下面这样表示:

Terminal window
Factory_A
└── Site_01
└── SMT_Line_1
└── Metric
└── Machine_001
  • Path:Factory_A/Site_01/SMT_Line_1/Metric
  • Topic:/Machine_001。
  • 消息内容
    Terminal window
    "temperature": 85,
    "vibration": 2.8,

Tier0 使用 PostgreSQL 存储数据。不同数据类型变化频率不同,也有不同的存储要求。

数据类型 存储 说明
Metric TSDB 针对温度、压力等高频测量数据优化。每个 topic 默认包含 timestamp 和 quality 字段。
State PostgreSQL 以灵活的 JSONB 格式存储设备或系统状态。
Action PostgreSQL 以灵活的 JSONB 格式存储命令或动作。
使用 Tier0

准备数据基础

为应用连接外部数据,并在 Tier0 中建模与集成。

Tier0 为自定义应用建立数据基础:接收应用业务数据、连接现有系统和设备的数据源,并将数据集成到统一模型供应用使用。

所有数据都建模到 Namespace 下的 Collections,并按数据类型组织。

  • 主要来自业务系统的关系数据存储在 Record 表中。
  • 主要来自设备的时序数据存储在 Sample 表中。
flowchart TB
  namespace["Namespace"] --> collection["Collection"]
  collection --> record["Record 表<br/>关系数据"]
  collection --> sample["Sample 表<br/>时序数据"]
  classDef t0accent fill:#B2ED1D,stroke:#73B200,color:#171717
  class collection t0accent

业务数据可来自应用操作或外部系统;时序数据主要来自已连接的设备。

flowchart LR
  app["应用"] -->|"业务数据"| record["Record"]
  stream["Stream"] -->|"设备数据"| sample["Sample"]
  classDef t0accent fill:#B2ED1D,stroke:#73B200,color:#171717
  class record,sample t0accent
  • Source:连接外部数据服务器,通常需要认证。
  • Stream:从服务器采集数据,按需处理,并存入 Namespace 模型。
flowchart LR
  source["Source<br/>连接服务器"] --> stream["Stream<br/>采集并处理"]
  classDef t0accent fill:#B2ED1D,stroke:#73B200,color:#171717
  class source,stream t0accent
  1. 在 Builder 中构建应用,让 Agent 在 Namespace 中准备业务数据模型。除非 Prompt 明确指定,否则 Agent 会根据应用业务逻辑自动生成模型。

    除非 Prompt 明确指定,否则 Agent 会根据应用业务逻辑自动生成数据模型。

  2. 在 Connect > Source 中连接所需数据源并配置认证。
  3. 让 Agent 创建 Stream,从已连接的 Source 采集和处理数据,写入应用生成的 Namespace 模型。
使用 Tier0

从中心到边缘管理数据

从中心节点无缝管理已连接边缘节点上的数据。

在真实工厂中,数据通常由边缘设备采集,并从中心节点统一管理,从而减少网络带宽占用并提升数据安全性。 Tier0 提供 Fleet Management 解决方案,让你可以从中心节点管理边缘节点上的数据。

  1. 先在中心节点上创建 Fleet 节点。

  2. 使用中心节点生成的 Token 连接每个边缘节点。

  • UNS 数据只能从边缘节点选择并同步到中心节点。同步后,所选 Topic 的历史数据和实时数据都可以在中心节点使用。
  • 你可以从中心节点为边缘节点分配用户或用户组,以便进行节点管理。
使用 Tier0

操作工厂数据

通过 MQTT 和 API 操作 UNS 数据,并查看 API 参考。

你可以通过 MQTT 和 API 操作 UNS 数据。

Tier0 生成的凭据可用于让 MQTT 客户端连接 UNS broker。

在 Connect > Source > MQTT Device 中生成 MQTT 凭据并记录。

  1. 安装并打开 MQTTX。
  2. 使用 UNS broker 信息和生成的凭据添加连接。
    Terminal window
    {
    "Host": "mqtt.tier0.dev",
    "Port": 1883,
    "Client ID": "<generated client ID>",
    "Username": "<generated username>",
    "Password": "<generated password>"
    }
  1. 确认客户端状态正常。
  2. 复制 UNS 模型 Topic,通过客户端向其发布一条消息。
  • Base URL: https://<your-tier0-host>/openapi/v2
  • Authentication: 将从 Tier0 获取的 API Key 放在 x-api-key 请求头中。
  • POST /uns/metadata:find — 列出 Collections 并获取 Collection ID

    Terminal window
    const base = "https://your-tier0-host/openapi/v2";
    const response = await fetch(`${base}/uns/metadata:find`, {
    method: "POST",
    headers: { "content-type": "application/json", "x-api-key": "your-api-key" },
    body: JSON.stringify({"kind": "collection", "filter": {}, "page": {"mode": "offset", "page": 1, "size": 20}}),
    });
    const result = await response.json();
    if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);
    console.log(result.data.items);
  • POST /uns/collections/{collectionId}/records:find — 列出 Records 并获取 Record ID

    Terminal window
    const base = "https://your-tier0-host/openapi/v2";
    const collectionId = "your-collection-id";
    const response = await fetch(`${base}/uns/collections/${encodeURIComponent(collectionId)}/records:find`, {
    method: "POST",
    headers: { "content-type": "application/json", "x-api-key": "your-api-key" },
    body: JSON.stringify({"limit": 20}),
    });
    const result = await response.json();
    if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);
    console.log(result.data);
  • POST /uns/collections/{collectionId}/samples:latest — 获取 Record 的最新 Sample

    Terminal window
    const base = "https://your-tier0-host/openapi/v2";
    const collectionId = "your-collection-id";
    const response = await fetch(`${base}/uns/collections/${encodeURIComponent(collectionId)}/samples:latest`, {
    method: "POST",
    headers: { "content-type": "application/json", "x-api-key": "your-api-key" },
    body: JSON.stringify({"recordIds": ["record_123"]}),
    });
    const result = await response.json();
    if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);
    console.log(result.data);
  • POST /uns/collections/{collectionId}/samples:find — 获取指定时间范围内的 Samples

    Terminal window
    const base = "https://your-tier0-host/openapi/v2";
    const collectionId = "your-collection-id";
    const response = await fetch(`${base}/uns/collections/${encodeURIComponent(collectionId)}/samples:find`, {
    method: "POST",
    headers: { "content-type": "application/json", "x-api-key": "your-api-key" },
    body: JSON.stringify({"recordIds": ["record_123"], "from": 1792454400000, "to": 1792540800000, "filter": {"temperature": {"$gt": 20}}, "limit": 20}),
    });
    const result = await response.json();
    if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);
    console.log(result.data);
使用 Tier0

构建应用

通过 AI 对话构建自定义工业应用。

通过 AI 对话构建自定义工业应用。应用可以使用工厂数据,并提供基于角色的访问控制、版本管理和外部部署能力。

  • 文件夹仅用于归类应用。
  • 系统会根据你的 Prompt 自动匹配模板,以节省开发时间。
  • 设备管理、生产监控、能源管理等通用工业应用已有模板 Prompt。

说明应用的目标、功能及是否需要外部数据。

  • 应用目标:应用的用途是什么?
Terminal window
为工厂技术人员创建一个设备维护应用。
  • 应用功能:应用需要做什么?
Terminal window
允许用户监控设备状态、提交维护请求并跟踪维修进度。
  • 应用数据:应用是否需要外部数据?
Terminal window
应用应使用 xxx collection 中的报警记录和维护历史。

应用采用基于角色的访问控制(RBAC),管理成员访问和允许执行的操作。

  • 如果没有明确指定角色,Agent 会根据业务逻辑自动生成;也可复用其他应用中职责相符的角色。
  • 应用角色只能分配给 Workspace 成员。
  • 如果 Prompt 明确说明不需要角色,应用会向所有成员开放。
  • 未发布:应用的最新状态;未部署的修改不会影响其他版本。
  • 快照:保存创建时的应用状态;部署快照会替换当前在线版本。
  • 已发布:当前在线版本。

部署未发布版本会更新在线应用;部署快照会回滚到较早版本。快照列在应用预览页面中。

应用准备就绪后,可从 Preview 页面导出至第三方环境或 Tier0 Enterprise。

  • 下载源代码:用于二次开发。
  • 导出 Bundle:用于在 Tier0 Enterprise 本地导入。

如需某个快照版本的源代码,先保存快照,再下载该快照。

使用 Tier0

构建数字孪生

将实时 UNS 数据绑定到 3D 模型,并组合成完整的工厂场景进行数字孪生可视化。

连接到 Tier0 的工厂数据可以通过 Digital Twin 可视化为具有真实动作和环境的 3D 场景。整体流程是先把数据映射到 3D 模型,再把多个模型组合起来,构建完整的工厂场景。

  1. 在 模型库 中上传模型后,选择需要用 UNS 数据驱动实时动作的节点。
  2. 在同一个模型上添加绑定不同 UNS 数据的实例,用来模拟不同机器。
  3. 将数据绑定到模型,并使用 预览 检查模型是否会随着数据变化而移动和旋转。
    • 位置:模型会沿所选坐标方向移动。
    • 旋转:模型会围绕坐标原点旋转。
  4. 使用 数据标签 添加用于静态信息展示的标签。
  1. 从 实例库 中添加场景里应存在的实例。
  2. 使用顶部工具移动、缩放和旋转模型,让模型适配场景,并调整视角和坐标位置。
  3. 可以通过右侧的 对象 确认模型位置,其中会显示绑定的 UNS 数据。
  4. 视口和光照用于调整环境细节。

只有实例可以按模型或按场景分享。

  • 分享模型:生成一个 Tier0 平台链接,用于展示带有实时 UNS 数据的模型。
  • 分享场景:生成一个 Tier0 平台链接,用于展示带有实时 UNS 数据和环境设置的模型及其场景。
使用 Tier0

使用 Agent 操作 Tier0

通过 MCP 将 AI Agent 连接到 Tier0。

通过 MCP 将 AI Agent 连接到 Tier0。Agent 可以在你授予的权限范围内查找并调用平台 API。

使用你偏好的 AI agent 操作 Tier0。
Claude Code
Codex
Gemini CLI
Cursor
GitHub Copilot

以下以 Codex 为例。

  1. 在 设置 > 插件 > MCP 中添加 MCP 服务器,填写从 Tier0 获取的 URL。
  2. 在 Tier0 的 设置 > API Keys > Personal Keys 中创建具有所需权限的个人 API Key。
  3. 将个人 API Key 添加到 Codex 中的 MCP 服务器:
    Terminal window
    { "Authorization": "Bearer <your-personal-api-key>" }
  4. 让 Agent 调用 whoami,检查连接。
MCP 工具 用途
whoami 检查身份和权限。
docs 阅读 API 文档。
search 查找 API 操作。
execute 调用 API 操作。

先让 Agent 使用 docs 和 search 找到所需操作,再使用 execute 调用。例如:

Terminal window
读取我的 Workspace 中 `Plant/Line1/Metric/Temperature` 的当前值。

最佳实践

工厂数据建模

Demo UNS 设计:避免 topic explosion 和 payload structure 的最佳实践。

来自有物理位置的机器和设备的工业数据,通常基于 ISA-95 标准建模。

Terminal window
Enterprise (Level 4)
└── Site (Level 3/4)
└── Area (Level 3)
└── Work Center / Process Cell (Level 2/3)
└── Equipment / Unit (Level 1/2)
└── Control Module / Device (Level 0/1)

对于 ERP 中的生产订单、工单计划等业务计划和流程对象,应根据业务上下文进行建模。

Terminal window
Factory / Business Domain / Business Object / Topic Type / Topic
  • 业务域:确认数据所属的业务流程或系统。

    Terminal window
    ERP
    MES
    WMS
    QMS
    EAM
    LIMS
    Planning
    Inventory
    Maintenance
    Quality
    Logistics
    ...
  • 业务对象:业务域中被管理的核心对象。

    Terminal window
    ProductionOrders
    WorkOrderPlan
    MaterialInventory
    QualityInspection
    MaintenanceOrders
    PurchaseOrders
    Shipments
    ...
  • Topic 类型:从 Metric、Action 和 State 中选择数据类型。

    Topic 类型 用途 示例
    STATE 当前状态或当前事实 工单状态、订单状态、设备状态
    METRIC 连续变化的数值 温度、速度、产量、OEE、能耗
    ACTION 给外部执行者的命令 启动设备、停止设备、重置报警、请求下发工单
Terminal window
DemoFactory
└── ERP
├── ProductionOrders
│ └── State
│ ├── UpsertProductionOrder
│ └── OrderList
└── WorkOrderPlan
├── Metric
│ └── SplitCount
└── State
├── PlanStatus
└── WorkOrderList

设计 topic 消息内容时,需要同时考虑要消费的数据和要回写的数据。

  • Action

    Action 消息内容会自动包含 _timestamp,用于记录数据存入 Tier0 数据库的时间。

    Terminal window
    {
    "light_turn_on": true,
    "height_adjust": 12.5,
    "_timestamp": "2026-07-10T10:00:00Z"
    }
  • Metric

    Metric 消息内容会自动包含 _timestamp 和 _quality:前者记录数据存入 Tier0 数据库的时间,后者用于映射数据质量。

    Terminal window
    {
    "production_order_id": "PO-20260710-001",
    "plan_id": "PLAN-001",
    "plan_number": "WOP-20260710-001",
    "split_count": 3,
    "updated_at": "2026-07-10T10:00:00Z",
    "_timestamp": "2026-07-10T10:00:00Z",
    "_quality": "Good"
    }
  • State

    State 消息内容会自动包含 _timestamp,用于记录数据存入 Tier0 数据库的时间。

    Terminal window
    {
    "event_id": "EVT-001",
    "event_type": "UPSERT",
    "source": "ERP",
    "production_order_id": "PO-20260710-001",
    "order_number": "PO-001",
    "product_code": "SKU-1001",
    "planned_qty": 1200,
    "unit": "pcs",
    "status": "Released",
    "due_date": "2026-07-12T00:00:00Z",
    "updated_at": "2026-07-10T10:00:00Z",
    "_timestamp": "2026-07-10T10:00:00Z"
    }

Tier0 设计了三种固定的 Topic 类型, Metric, Action 和 State 来避免 topic 爆炸.

  • 将 Metric 用于高频实时数据

    将高频测量值和遥测数据统一放在 Metric 下,而不是为每个信号细节创建 topic。

    Terminal window
    Factory_A
    └── SMT_Line_1
    └── Machine_001
    ├── Temperature_Value
    ├── Temperature_Unit
    ├── Temperature_Status
    └── Speed_Value
  • 将 State 用于低频状态数据

    将低频状态、快照和当前业务状态放在 State 下。避免为作业、批次或订单等变化实体分别创建新 topic。

    Terminal window
    Factory_A
    └── SMT_Line_1
    └── State
    ├── Job_001
    ├── Job_002
    └── Job_003
  • 将 Action 用于低频动作数据

    将命令、请求和操作员动作放在 Action 下。动作输入应作为 topic 的字段,而不是为每个参数创建一个 topic。

    Terminal window
    Factory_A
    └── SMT_Line_1
    └── Machine_001
    ├── Start_Command
    ├── Target_Height
    └── Light_On
最佳实践

连接数据源

Tier0 支持连接多种工业协议,包括 OPC UA、Modbus、MQTT 等。

  • 输入服务器地址后,系统会自动从服务器获取安全配置。
  • 支持用户名和密码或证书身份验证。
Terminal window
{
"name": "ua",
"description": "",
"protocol": "opcua",
"endpoint": "opc.tcp://220.184.175.73:4841/demo/",
"runtimeLocation": "local",
"opcua": {
"securityMode": "None",
"securityPolicy": "None"
}
}

只需提供服务器地址和单元 ID。

Terminal window
{
"name": "modbus",
"description": "",
"protocol": "modbus-tcp",
"endpoint": "tcp://220.184.175.73:1502",
"runtimeLocation": "local",
"modbus": {
"unitId": 1
}
}

Tier0 既可以作为 MQTT Broker 接收设备数据,也可以作为客户端连接外部 MQTT Broker。

  • 作为 Broker:

    1. 连接 MQTT Device 时,系统会生成客户端 ID、用户名和密码等连接凭据。
    2. 第三方客户端必须使用连接面板中显示的发布主题来发布消息。
    3. 让 Agent 创建以发布主题为输入的 Stream,将数据发送到指定的 Namespace。
  • 作为客户端:连接第三方 Broker。

    Terminal window
    {
    "name": "111",
    "description": "",
    "protocol": "mqtt",
    "endpoint": "mqtt://220.184.175.73:1883",
    "runtimeLocation": "local",
    "mqtt": {
    "clientId": "tier0UxxxxxxxxuwQVfi"
    }
    }

Tier0 既可以作为 HTTP 服务器供第三方访问,也可以作为客户端调用其他 HTTP 服务器的 API。

  • 作为服务器:

    1. 在 Tier0 中添加 HTTP 服务器,并从信息面板获取完整地址。
    2. 让 Agent 创建 Stream,定义数据和后续路由,共同构成 API。
    3. 第三方使用该地址和设定的路由调用 API 并获取数据。
  • 作为客户端:连接第三方 HTTP 服务器。

Terminal window
{
"name": "222",
"description": "",
"protocol": "http-api",
"endpoint": "http://220.184.175.73:8088/api/telemetry",
"runtimeLocation": "local",
"role": "client",
"http": {
"authentication": "none"
}
}
  • 数据库地址必须同时包含端口和数据库名。
  • 需要提供初始查询命令。
  • 如果数据库允许匿名连接,可以跳过身份验证。
Terminal window
{
"name": "eee",
"description": "",
"protocol": "edge-sql",
"endpoint": "mysql://hzoffice.tier0.dev:3307/demo_factory",
"runtimeLocation": "local",
"sql": {
"queries": {
"query1": "SELECT * FROM telemetry ORDER BY id DESC LIMIT 5"
},
"tlsMode": "verify-full"
},
"credentialRef": "ref_9ce47b8778xxxxxxxx7dad49a86dbad"
}
  1. 通过 OAuth 连接 Tier0 Github。
  2. 在数据源信息面板中查找该组织的资源。
  3. 让 Agent 创建 Stream 以获取所需数据。
  1. 让 Agent 创建 Stream,从已连接的数据源获取数据。
  2. 在提示词中提供必要信息,例如 Modbus 寄存器、数据库查询语句、UA 命名空间 URI 和 MQTT 主题。
最佳实践

安全与可靠性

Tier0 身份认证、数据访问、部署可用性与恢复机制概览。

Tier0 支持从安全和可靠性两个方面来确保数据安全。

  • 安全:控制谁能访问平台、应用和数据;
  • 可靠性:发生故障后服务能否继续,以及数据能否恢复。
版本 安全能力范围
云服务版 提供平台访问控制,以及需要身份认证的 MQTT 和 API 数据访问。
企业版 除平台和数据访问控制外,还提供适用于私有部署的部署可用性、备份与恢复方案。
Edge(开源版) 用于本地数据连接与建模,内置 MQTT Broker 支持匿名订阅。

各版本定位请参阅选择合适的产品版本。

范围 Tier0 机制 详情
平台访问
  • 云服务版通过 Workspace 成员资格控制访问。
  • 企业版通过用户账号控制访问。
用户管理
Agent 访问 Agent 通过 MCP 连接,并在获得的权限范围内操作平台。 连接 Agent
应用访问 Tier0 基于 RBAC 实现应用访问控制。 访问控制
访问方式 Tier0 机制 详情
MQTT
  • 客户端使用 Tier0 生成的 Credential 凭据完成鉴权。
  • TLS 和安全 WebSocket 对传输中的数据进行加密。
MQTT 凭据与连接
REST API 必须使用 Tier0 生成的 Key 才能访问数据。 API 参考

企业版目前为中心节点提供两种部署方案:

方案 可用性边界 详情
标准部署
  • 数据库支持主备故障切换。
  • Enterprise 应用和 EMQX 仍为单点。
标准部署方案
高可用部署
  • 增加 Enterprise 主备节点,并明确数据库、缓存、对象存储及运行文件的故障切换机制。
  • 不承诺零中断或零数据丢失。
高可用部署方案

企业版提供数据库备份和恢复。恢复后需要检查部署状态、执行基础功能验证,并确认能够正常登录平台。

最佳实践

用 Agent 构建车间工作流

使用 UNS Agent 构建覆盖数据建模、数据连接和数据事件的工作流。

UNS Agent 支持通过自然语言对话简单快速对工厂数据进行建模,连接机器数据并针对数据构建报警事件。

一个搅拌罐在加热材料的同时完成混合。构建数据模型并采集温度、水位和加热器状态,用于判断搅拌罐是否过热并触发报警。

flowchart RL
  source["数据连接<br/>(连接数据源)"]
  event["事件流程<br/>(事件逻辑与报警)"]
  uns["UNS<br/>(建模)"]

  source -->|"搅拌罐数据"| uns
  event -->|"报警数据"| uns

  classDef t0accent fill:#EFFFD2,stroke:#8AC926,stroke-width:1px,color:#18230B
  classDef t0node fill:#F8FAFC,stroke:#CBD5E1,stroke-width:1px,color:#111827
  class uns t0accent
  class source,event t0node
  1. 在 UNS 中使用 full_access 与 UNS Agent 开始对话。

  2. 输入提示词来构建 UNS 模型。

    Terminal window
    创建一个表示搅拌罐温度、水位和加热器状态的数据模型,温度和水位放在一个 metric topic 中,加热器状态放在一个 state topic 中。
  3. 确认模型完整后,输入提示词,让 Agent 将对应数据连接到模型。

    Terminal window
    创建一个数据连接,向这 2 个 topic 发送数据,并模拟合理的数据。
  4. 输入提示词,按照以下逻辑创建事件。

    • 低水位预警:当水位低于 20% 且加热器开启时触发。
    • 干烧报警:当水位低于 15%、温度高于 90°C 且加热器开启时触发。
    Terminal window
    为以下报警逻辑创建一个事件流程:
    - Warning:当 level < 20 且 heater_status = true 时触发。
    - Critical:当 level < 15、temperature > 90 且 heater_status = true 时触发。
    - 当 level > 25 或 heater_status = false 时清除当前报警。
    在现有 UNS 模型下创建一个新 topic 来接收报警结果。输出中包含报警等级、消息、是否激活和时间戳。
  5. 在 UNS 中检查结果。

最佳实践

使用数字孪生展示数据

在 3D 模型和场景中实时查看 UNS 数据。

Tier0 的数字孪生功能用于在逼真的 3D 模型和场景中实时查看 UNS 数据。 本节会把一个车间场景构建出来。该车间包含以下设备:

  • 2 台车床
  • 1 台在车床之间工作的机械臂
  • 1 个进料缓存站和 1 个出料缓存区
  • 1 台质量检测设备
  • 1 套统一控制系统
  • 2 个原料货架和 2 个成品货架
  • 1 台 AGV

将所有数据采集到 UNS,包括控制机器动作的数据、表示机器状态的数据,以及车间环境数据。

  1. 在 UNS 中构建数据模型。

    查看 UNS 模型 JSON
    Terminal window
    {
    "namespace": [
    {
    "name": "Metric",
    "alias": "metric_151a7edd68bf4269a229",
    "type": "PATH",
    "children": [
    {
    "name": "RobotArm",
    "alias": "Robot_0_9d5dc450dc1f4c0c9a86",
    "type": "TOPIC",
    "topicType": "METRIC",
    "extendProperties": {
    "J0_Cur": "0"
    },
    "fields": [
    {
    "name": "J1_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J1_Init",
    "type": "FLOAT"
    },
    {
    "name": "J2_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J2_Init",
    "type": "FLOAT"
    },
    {
    "name": "J3_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J3_Init",
    "type": "FLOAT"
    },
    {
    "name": "J4_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J4_Init",
    "type": "FLOAT"
    },
    {
    "name": "J5_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J5_Init",
    "type": "FLOAT"
    },
    {
    "name": "J6_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J6_Init",
    "type": "FLOAT"
    },
    {
    "name": "Model_Name",
    "type": "STRING"
    },
    {
    "name": "Max_Payload_kg",
    "type": "FLOAT"
    },
    {
    "name": "Reach_Radius_mm",
    "type": "FLOAT"
    },
    {
    "name": "Gripper_Force_N",
    "type": "FLOAT"
    }
    ],
    "enableHistory": "TRUE",
    "mockData": "FALSE"
    },
    {
    "name": "ProLathe-01",
    "alias": "ProLathe_ef325e0a9db047d6abac",
    "type": "TOPIC",
    "topicType": "METRIC",
    "fields": [
    {
    "name": "J_Changer_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Door_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Finger_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Spindle_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_TailStock_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_X_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Y_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Z_Cur",
    "type": "FLOAT"
    },
    {
    "name": "Model_Name",
    "type": "STRING"
    },
    {
    "name": "Max_Placement_Rate_cph",
    "type": "INTEGER"
    },
    {
    "name": "Placement_Speed_cph",
    "type": "INTEGER"
    },
    {
    "name": "Feeder_Usage_pct",
    "type": "INTEGER"
    },
    {
    "name": "Machine_State_code",
    "type": "INTEGER"
    }
    ],
    "enableHistory": "FALSE",
    "mockData": "FALSE"
    },
    {
    "name": "ProLathe-02",
    "alias": "ProLathe2_ef325e0a9db047d6abac",
    "type": "TOPIC",
    "topicType": "METRIC",
    "fields": [
    {
    "name": "J_Changer_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Door_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Finger_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Spindle_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_TailStock_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_X_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Y_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J_Z_Cur",
    "type": "FLOAT"
    },
    {
    "name": "Model_Name",
    "type": "STRING"
    },
    {
    "name": "Max_Placement_Rate_cph",
    "type": "INTEGER"
    },
    {
    "name": "Placement_Speed_cph",
    "type": "INTEGER"
    },
    {
    "name": "Feeder_Usage_pct",
    "type": "INTEGER"
    },
    {
    "name": "Machine_State_code",
    "type": "INTEGER"
    }
    ],
    "enableHistory": "FALSE",
    "mockData": "FALSE"
    },
    {
    "name": "AGV",
    "alias": "AGV_7eddee0054a0",
    "type": "TOPIC",
    "topicType": "METRIC",
    "fields": [
    {
    "name": "Position_X_Cur",
    "type": "FLOAT"
    },
    {
    "name": "Position_X_Init",
    "type": "FLOAT"
    },
    {
    "name": "Position_Y_Cur",
    "type": "FLOAT"
    },
    {
    "name": "Position_Y_Init",
    "type": "FLOAT"
    },
    {
    "name": "Rotation_Y_Cur",
    "type": "FLOAT"
    },
    {
    "name": "Rotation_Y_Init",
    "type": "FLOAT"
    },
    {
    "name": "Tray_Height_Cur",
    "type": "FLOAT"
    },
    {
    "name": "Tray_Height_Init",
    "type": "FLOAT"
    },
    {
    "name": "State_Cur",
    "type": "STRING"
    },
    {
    "name": "State_Init",
    "type": "STRING"
    },
    {
    "name": "Position_Z_Cur",
    "type": "FLOAT"
    },
    {
    "name": "Position_Z_Init",
    "type": "FLOAT"
    },
    {
    "name": "Model_Name",
    "type": "STRING"
    },
    {
    "name": "Max_Load_kg",
    "type": "FLOAT"
    },
    {
    "name": "Task_Progress_pct",
    "type": "INTEGER"
    },
    {
    "name": "Remaining_Distance_m",
    "type": "FLOAT"
    },
    {
    "name": "AGV_State_code",
    "type": "INTEGER"
    }
    ],
    "enableHistory": "FALSE",
    "mockData": "FALSE"
    },
    {
    "name": "RobotArm-1",
    "alias": "RobotArm_1_b9f06e21346d",
    "type": "TOPIC",
    "topicType": "METRIC",
    "fields": [
    {
    "name": "J1_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J1_Init",
    "type": "FLOAT"
    },
    {
    "name": "J2_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J2_Init",
    "type": "FLOAT"
    },
    {
    "name": "J3_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J3_Init",
    "type": "FLOAT"
    },
    {
    "name": "J4_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J4_Init",
    "type": "FLOAT"
    },
    {
    "name": "J5_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J5_Init",
    "type": "FLOAT"
    },
    {
    "name": "J6_Cur",
    "type": "FLOAT"
    },
    {
    "name": "J6_Init",
    "type": "FLOAT"
    }
    ],
    "enableHistory": "TRUE",
    "mockData": "FALSE"
    }
    ]
    },
    {
    "name": "State",
    "alias": "state_3912d0df3fee",
    "type": "PATH",
    "children": [
    {
    "name": "RawMaterialStorage",
    "alias": "RawMaterialS_c3307f680405",
    "type": "TOPIC",
    "topicType": "STATE",
    "fields": [
    {
    "name": "StockAmount",
    "type": "INTEGER"
    }
    ],
    "enableHistory": "FALSE",
    "mockData": "FALSE"
    },
    {
    "name": "ProductStorage",
    "alias": "ProductStora_3c145f140bd9",
    "type": "TOPIC",
    "topicType": "STATE",
    "fields": [
    {
    "name": "StockAmount",
    "type": "INTEGER"
    }
    ],
    "enableHistory": "FALSE",
    "mockData": "FALSE"
    },
    {
    "name": "InboundBuffer",
    "alias": "LoaderBuffer_9feece9b3231",
    "type": "TOPIC",
    "topicType": "STATE",
    "fields": [
    {
    "name": "Amount",
    "type": "INTEGER"
    }
    ],
    "enableHistory": "FALSE",
    "mockData": "FALSE"
    },
    {
    "name": "OutboundBuffer",
    "alias": "OutboundBuff_75433b98fde6",
    "type": "TOPIC",
    "topicType": "STATE",
    "fields": [
    {
    "name": "Amount",
    "type": "INTEGER"
    }
    ],
    "enableHistory": "FALSE",
    "mockData": "FALSE"
    }
    ]
    }
    ]
    }
  2. 使用 数据连接 将数据源连接到 UNS 模型。

    • Robot Arm
    查看机械臂数据连接 JSON
    Terminal window
    [
    {
    "id": "03933a7eb1a7b992",
    "type": "function",
    "z": "8daeb61ebd9e5f52",
    "name": "Cache Data",
    "func": "const CONFIG = {\n fields: ['Joint_1', 'Joint_2', 'Joint_3', 'Joint_4', 'Joint_5', 'Joint_6'],\n payloadFields: {\n value: 'CurrentValue',\n initialValue: 'InitialValue',\n name: 'Name',\n timeStamp: 'timeStamp',\n time_stamp: 'time_stamp',\n quality: 'quality'\n }\n};\n\nlet cache = flow.get('dataCache') || { instant: {}, metadata: {} };\n\nconst topicParts = msg.topic.split('/');\nconst fieldName = topicParts[topicParts.length - 1];\n\nlet payload = msg.payload;\nif (typeof payload === 'string') {\n try {\n payload = JSON.parse(payload);\n } catch (e) {\n return null;\n }\n}\n\nlet value = payload[CONFIG.payloadFields.value];\nif (value === undefined) return null;\n\nconst metadata = {\n timeStamp: payload[CONFIG.payloadFields.timeStamp],\n time_stamp: payload[CONFIG.payloadFields.time_stamp],\n quality: payload[CONFIG.payloadFields.quality],\n name: payload[CONFIG.payloadFields.name],\n initialValue: payload[CONFIG.payloadFields.initialValue]\n};\n\nif (CONFIG.fields.includes(fieldName)) {\n cache.instant[fieldName] = value;\n cache.metadata[fieldName] = metadata;\n} else {\n return null;\n}\n\nflow.set('dataCache', cache);\nreturn null;",
    "outputs": 0,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 880,
    "y": 500,
    "wires": []
    },
    {
    "id": "0c4dbdcbe5e3db92",
    "type": "mqtt in",
    "z": "8daeb61ebd9e5f52",
    "name": "Subscribe Joint_1~6",
    "topic": "FactorySim_Supos/Flow_Group__1/MechEquips/Transporter_Kawasaki_BX100N/Motor_Joints/+",
    "qos": "1",
    "datatype": "auto",
    "broker": "c11decb07a68083d",
    "nl": false,
    "rap": true,
    "rh": 0,
    "inputs": 0,
    "x": 610,
    "y": 480,
    "wires": [
    [
    "03933a7eb1a7b992"
    ]
    ]
    },
    {
    "id": "ba42bca5aa9dc561",
    "type": "inject",
    "z": "8daeb61ebd9e5f52",
    "name": "100ms Timer",
    "props": [
    {
    "p": "payload"
    },
    {
    "vt": "str",
    "p": "topic"
    }
    ],
    "repeat": "0.1",
    "crontab": "",
    "once": true,
    "onceDelay": "0.1",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "x": 520,
    "y": 600,
    "wires": [
    [
    "0fc94449c377ad9a"
    ]
    ]
    },
    {
    "id": "0fc94449c377ad9a",
    "type": "function",
    "z": "8daeb61ebd9e5f52",
    "name": "Aggregate & Publish (Flat)",
    "func": "const CONFIG = {\n fieldMapping: {\n 'Joint_1': 'J1',\n 'Joint_2': 'J2',\n 'Joint_3': 'J3',\n 'Joint_4': 'J4',\n 'Joint_5': 'J5',\n 'Joint_6': 'J6'\n },\n missingStrategy: 'lastValue',\n outputTopic: 'robot/state',\n windowMs: 100\n};\n\nconst FIELDS = Object.keys(CONFIG.fieldMapping);\n\nlet cache = flow.get('dataCache') || { instant: {}, metadata: {} };\nlet lastValues = flow.get('lastValues') || {};\nlet lastMetadata = flow.get('lastMetadata') || {};\n\nlet output = {\n timestamp: new Date().toISOString()\n};\n\nfor (const field of FIELDS) {\n const shortName = CONFIG.fieldMapping[field];\n \n if (cache.instant[field] !== undefined) {\n output[shortName + '_Cur'] = cache.instant[field];\n output[shortName + '_Init'] = cache.metadata[field] ? cache.metadata[field].initialValue : 0;\n output[shortName + '_Qly'] = cache.metadata[field] ? cache.metadata[field].quality : 0;\n \n lastValues[field] = cache.instant[field];\n lastMetadata[field] = cache.metadata[field];\n } else {\n let fallbackValue = CONFIG.missingStrategy === 'lastValue' \n ? (lastValues[field] !== undefined ? lastValues[field] : 0) \n : 0;\n \n output[shortName + '_Cur'] = fallbackValue;\n output[shortName + '_Init'] = lastMetadata[field] ? lastMetadata[field].initialValue : 0;\n output[shortName + '_Qly'] = -1;\n }\n}\n\nmsg.payload = output;\nmsg.topic = CONFIG.outputTopic;\n\nflow.set('dataCache', { instant: {}, metadata: {} });\nflow.set('lastValues', lastValues);\nflow.set('lastMetadata', lastMetadata);\n\nreturn msg;",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 760,
    "y": 600,
    "wires": [
    [
    "c9eee2264fe78846",
    "a685279629e73d9a",
    "4ce075fda1d3d993",
    "8e8779918eab6f89"
    ]
    ]
    },
    {
    "id": "c9eee2264fe78846",
    "type": "mqtt out",
    "z": "8daeb61ebd9e5f52",
    "name": "Publish robot/state",
    "topic": "Metric/RobotArm",
    "qos": "1",
    "retain": "false",
    "respTopic": "",
    "contentType": "",
    "userProps": "",
    "correl": "",
    "expiry": "",
    "broker": "9836929a70c74929",
    "x": 1070,
    "y": 540,
    "wires": []
    },
    {
    "id": "c11decb07a68083d",
    "type": "mqtt-broker",
    "name": "supos-demo.supos.app",
    "broker": "supos-demo.supos.app",
    "port": 1883,
    "clientid": "",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": 4,
    "keepalive": 60,
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    },
    {
    "id": "9836929a70c74929",
    "type": "mqtt-broker",
    "z": "8daeb61ebd9e5f52",
    "name": "emqx",
    "broker": "mqtt.pre.tier0.dev",
    "port": "1883",
    "clientid": "336462685553088&336463047745872",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": "4",
    "keepalive": "60",
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    }
    ]
    • AGV
    查看 AGV 数据连接 JSON
    Terminal window
    [
    {
    "id": "fa46cf31be8d751e",
    "type": "tab",
    "label": "Metric/AGV",
    "disabled": false,
    "info": ""
    },
    {
    "id": "1f0e9d8c7b6a5a41",
    "type": "mqtt in",
    "z": "fa46cf31be8d751e",
    "name": "Subscribe AGV telemetry",
    "topic": "FactorySim_Supos/Flow_Group__1/MechEquips/AGV_zOnron/Motor_Joints/+",
    "qos": "1",
    "datatype": "auto",
    "broker": "c11decb07a68083d",
    "nl": false,
    "rap": true,
    "rh": 0,
    "inputs": 0,
    "x": 190,
    "y": 380,
    "wires": [
    [
    "2a1b3c4d5e6f7081"
    ]
    ]
    },
    {
    "id": "2a1b3c4d5e6f7081",
    "type": "function",
    "z": "fa46cf31be8d751e",
    "name": "Cache AGV telemetry",
    "func": "const CONFIG = {\n fields: [\n 'Position_X',\n 'Position_Y',\n 'Position_Z',\n 'Rotation_Y',\n 'Tray_Height',\n 'State'\n ],\n payloadFields: {\n value: 'CurrentValue',\n initialValue: 'InitialValue',\n name: 'Name',\n timeStamp: 'timeStamp',\n timeStampAlt: 'time_stamp'\n }\n};\n\nlet cache = flow.get('agvDataCache') || { instant: {}, metadata: {} };\n\nconst topicParts = (msg.topic || '').split('/');\nconst fieldName = topicParts[topicParts.length - 1];\nif (!CONFIG.fields.includes(fieldName)) {\n return null;\n}\n\nlet payload = msg.payload;\nif (typeof payload === 'string') {\n try {\n payload = JSON.parse(payload);\n } catch (error) {\n return null;\n }\n}\n\nif (typeof payload !== 'object' || payload === null) {\n return null;\n}\n\nconst currentValue = payload[CONFIG.payloadFields.value];\nif (currentValue === undefined) {\n return null;\n}\n\ncache.instant[fieldName] = currentValue;\ncache.metadata[fieldName] = {\n name: payload[CONFIG.payloadFields.name] || fieldName,\n initialValue: payload[CONFIG.payloadFields.initialValue],\n timeStamp: payload[CONFIG.payloadFields.timeStampAlt] ?? payload[CONFIG.payloadFields.timeStamp] ?? 0\n};\n\nflow.set('agvDataCache', cache);\nreturn null;",
    "outputs": 0,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 470,
    "y": 380,
    "wires": []
    },
    {
    "id": "3b2c1d0e9f8a7b61",
    "type": "inject",
    "z": "fa46cf31be8d751e",
    "name": "100ms Timer",
    "props": [
    {
    "p": "payload"
    },
    {
    "p": "topic",
    "vt": "str"
    }
    ],
    "repeat": "0.1",
    "crontab": "",
    "once": true,
    "onceDelay": "0.1",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "x": 150,
    "y": 500,
    "wires": [
    [
    "4c3d2e1f0a9b8c71"
    ]
    ]
    },
    {
    "id": "4c3d2e1f0a9b8c71",
    "type": "function",
    "z": "fa46cf31be8d751e",
    "name": "Aggregate AGV UNS payload",
    "func": "const CONFIG = {\n fields: [\n 'Position_X',\n 'Position_Y',\n 'Position_Z',\n 'Rotation_Y',\n 'Tray_Height',\n 'State'\n ],\n outputTopic: 'Metric/AGV',\n defaultNumeric: 0,\n defaultString: ''\n};\n\nlet cache = flow.get('agvDataCache') || { instant: {}, metadata: {} };\nlet lastValues = flow.get('agvLastValues') || {};\nlet lastMetadata = flow.get('agvLastMetadata') || {};\nlet lastTimestamp = flow.get('agvLastTimestamp') || 0;\n\nlet output = {};\nlet candidateTimestamps = [];\n\nfor (const field of CONFIG.fields) {\n const hasCurrentFrameValue = Object.prototype.hasOwnProperty.call(cache.instant, field);\n const metadata = hasCurrentFrameValue ? cache.metadata[field] : lastMetadata[field];\n const currentValue = hasCurrentFrameValue ? cache.instant[field] : lastValues[field];\n const isStringField = field === 'State';\n\n output[field + '_Cur'] = currentValue !== undefined\n ? currentValue\n : (isStringField ? CONFIG.defaultString : CONFIG.defaultNumeric);\n output[field + '_Init'] = metadata && metadata.initialValue !== undefined\n ? metadata.initialValue\n : (isStringField ? CONFIG.defaultString : CONFIG.defaultNumeric);\n\n if (hasCurrentFrameValue) {\n lastValues[field] = cache.instant[field];\n lastMetadata[field] = cache.metadata[field];\n\n const rawTime = cache.metadata[field] ? Number(cache.metadata[field].timeStamp) : NaN;\n if (!Number.isNaN(rawTime)) {\n candidateTimestamps.push(rawTime);\n }\n }\n}\n\nif (candidateTimestamps.length > 0) {\n lastTimestamp = Math.max(...candidateTimestamps);\n}\n\noutput.timestamp = lastTimestamp;\n\nmsg.topic = CONFIG.outputTopic;\nmsg.payload = output;\n\nflow.set('agvDataCache', { instant: {}, metadata: {} });\nflow.set('agvLastValues', lastValues);\nflow.set('agvLastMetadata', lastMetadata);\nflow.set('agvLastTimestamp', lastTimestamp);\n\nreturn msg;",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 460,
    "y": 500,
    "wires": [
    [
    "6d5e4f3a2b1c0d91",
    "7c6b5a4d3e2f1098"
    ]
    ]
    },
    {
    "id": "6d5e4f3a2b1c0d91",
    "type": "mqtt out",
    "z": "fa46cf31be8d751e",
    "name": "Publish Metric/AGV",
    "topic": "Metric/AGV",
    "qos": "1",
    "retain": "false",
    "respTopic": "",
    "contentType": "",
    "userProps": "",
    "correl": "",
    "expiry": "",
    "broker": "f2d431c2d2264341",
    "x": 710,
    "y": 400,
    "wires": []
    },
    {
    "id": "7c6b5a4d3e2f1098",
    "type": "debug",
    "z": "fa46cf31be8d751e",
    "name": "Debug AGV payload",
    "active": true,
    "tosidebar": true,
    "console": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 740,
    "y": 580,
    "wires": []
    },
    {
    "id": "c11decb07a68083d",
    "type": "mqtt-broker",
    "name": "supos-demo.supos.app",
    "broker": "supos-demo.supos.app",
    "port": 1883,
    "clientid": "",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": 4,
    "keepalive": 60,
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    },
    {
    "id": "f2d431c2d2264341",
    "type": "mqtt-broker",
    "z": "fa46cf31be8d751e",
    "name": "emqx",
    "broker": "mqtt.pre.tier0.dev",
    "port": "1883",
    "clientid": "336462685553088&341668146888752",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": "4",
    "keepalive": "60",
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    }
    ]
    • Lathe 1
    查看车床 1 数据连接 JSON
    Terminal window
    [
    {
    "id": "88fed08889390f28",
    "type": "tab",
    "label": "Metric/ProLathe-01",
    "disabled": false,
    "info": ""
    },
    {
    "id": "f2bae08de3b55bb0",
    "type": "mqtt in",
    "z": "88fed08889390f28",
    "name": "Subscribe ProLathe joints",
    "topic": "FactorySim_Supos/Flow_Group__1/MechEquips/porcess_prolathe_gs_260ms_1/Motor_Joints/+",
    "qos": "1",
    "datatype": "auto",
    "broker": "6f8ade8021b85933",
    "nl": false,
    "rap": true,
    "rh": 0,
    "inputs": 0,
    "x": 590,
    "y": 340,
    "wires": [
    [
    "ac84eab3cf5bb664",
    "8a8a5572465dac5b"
    ]
    ]
    },
    {
    "id": "ac84eab3cf5bb664",
    "type": "function",
    "z": "88fed08889390f28",
    "name": "Cache Data",
    "func": "const CONFIG = {\n fields: [\"JointChanger\", \"JointDoors\", \"JointFinger\", \"JointSpindle\", \"JointTailStock\", \"Joint_X\", \"Joint_Y\", \"Joint_Z\"],\n payloadFields: {\n value: 'CurrentValue',\n initialValue: 'InitialValue',\n name: 'Name',\n timeStamp: 'timeStamp',\n time_stamp: 'time_stamp',\n quality: 'quality'\n }\n};\n\nlet cache = flow.get('dataCache') || { instant: {}, metadata: {} };\n\nconst topicParts = msg.topic.split('/');\nconst fieldName = topicParts[topicParts.length - 1];\n\nlet payload = msg.payload;\nif (typeof payload === 'string') {\n try {\n payload = JSON.parse(payload);\n } catch (e) {\n return null;\n }\n}\n\nlet value = payload[CONFIG.payloadFields.value];\nif (value === undefined) return null;\n\nconst metadata = {\n timeStamp: payload[CONFIG.payloadFields.timeStamp],\n time_stamp: payload[CONFIG.payloadFields.time_stamp],\n quality: payload[CONFIG.payloadFields.quality],\n name: payload[CONFIG.payloadFields.name],\n initialValue: payload[CONFIG.payloadFields.initialValue]\n};\n\nif (CONFIG.fields.includes(fieldName)) {\n cache.instant[fieldName] = value;\n cache.metadata[fieldName] = metadata;\n} else {\n return null;\n}\n\nflow.set('dataCache', cache);\nreturn null;",
    "outputs": 0,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 860,
    "y": 360,
    "wires": []
    },
    {
    "id": "ca4b6b2146df5093",
    "type": "inject",
    "z": "88fed08889390f28",
    "name": "100ms Timer",
    "props": [
    {
    "p": "payload"
    },
    {
    "vt": "str",
    "p": "topic"
    }
    ],
    "repeat": "0.1",
    "crontab": "",
    "once": true,
    "onceDelay": "0.1",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "x": 500,
    "y": 460,
    "wires": [
    [
    "e47cbdc7b7dae23f"
    ]
    ]
    },
    {
    "id": "e47cbdc7b7dae23f",
    "type": "function",
    "z": "88fed08889390f28",
    "name": "Aggregate & Publish (Flat)",
    "func": "const CONFIG = {\n fieldMapping: {\n \"JointChanger\": \"J_Changer\",\n \"JointDoors\": \"J_Door\",\n \"JointFinger\": \"J_Finger\",\n \"JointSpindle\": \"J_Spindle\",\n \"JointTailStock\": \"J_TailStock\",\n \"Joint_X\": \"J_X\",\n \"Joint_Y\": \"J_Y\",\n \"Joint_Z\": \"J_Z\"\n},\n missingStrategy: 'lastValue',\n outputTopic: \"Metric/porcess_prolathe_gs_260ms_1\",\n windowMs: 100\n};\n\nconst FIELDS = Object.keys(CONFIG.fieldMapping);\n\nlet cache = flow.get('dataCache') || { instant: {}, metadata: {} };\nlet lastValues = flow.get('lastValues') || {};\nlet lastMetadata = flow.get('lastMetadata') || {};\nlet output = {};\n\noutput.timestamp = new Date().toISOString();\n\nfor (const field of FIELDS) {\n const shortName = CONFIG.fieldMapping[field];\n\n if (cache.instant[field] !== undefined) {\n output[shortName + '_Cur'] = Number(cache.instant[field]);\n output[shortName + '_Init'] = cache.metadata[field] && cache.metadata[field].initialValue !== undefined\n ? Number(cache.metadata[field].initialValue)\n : 0;\n lastValues[field] = cache.instant[field];\n lastMetadata[field] = cache.metadata[field] || {};\n } else {\n let fallbackValue = CONFIG.missingStrategy === 'lastValue'\n ? (lastValues[field] !== undefined ? lastValues[field] : 0)\n : 0;\n output[shortName + '_Cur'] = Number(fallbackValue);\n output[shortName + '_Init'] = lastMetadata[field] && lastMetadata[field].initialValue !== undefined\n ? Number(lastMetadata[field].initialValue)\n : 0;\n }\n}\n\nmsg.payload = output;\nmsg.topic = CONFIG.outputTopic;\n\nflow.set('dataCache', { instant: {}, metadata: {} });\nflow.set('lastValues', lastValues);\nflow.set('lastMetadata', lastMetadata);\n\nreturn msg;",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 740,
    "y": 460,
    "wires": [
    [
    "ad22bd2f8b228324"
    ]
    ]
    },
    {
    "id": "ad22bd2f8b228324",
    "type": "mqtt out",
    "z": "88fed08889390f28",
    "name": "Metric/Prolathe",
    "topic": "Metric/ProLathe-01",
    "qos": "1",
    "retain": "false",
    "respTopic": "",
    "contentType": "",
    "userProps": "",
    "correl": "",
    "expiry": "",
    "broker": "c14ef68b0e3b48ac",
    "x": 1060,
    "y": 360,
    "wires": []
    },
    {
    "id": "8a8a5572465dac5b",
    "type": "debug",
    "z": "88fed08889390f28",
    "name": "Debug Output",
    "active": true,
    "tosidebar": true,
    "console": false,
    "complete": "payload",
    "statusVal": "",
    "statusType": "auto",
    "x": 980,
    "y": 540,
    "wires": []
    },
    {
    "id": "6f8ade8021b85933",
    "type": "mqtt-broker",
    "name": "supos-demo.supos.app",
    "broker": "supos-demo.supos.app",
    "port": 1883,
    "clientid": "",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": 4,
    "keepalive": 60,
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    },
    {
    "id": "c14ef68b0e3b48ac",
    "type": "mqtt-broker",
    "z": "88fed08889390f28",
    "name": "emqx",
    "broker": "mqtt.pre.tier0.dev",
    "port": "1883",
    "clientid": "336462685553088&337035452420768",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": "4",
    "keepalive": "60",
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    }
    ]
    • Lathe 2
    查看车床 2 数据连接 JSON
    Terminal window
    [
    {
    "id": "c974bfc5fbc79b0e",
    "type": "tab",
    "label": "Metric/ProLathe-02",
    "disabled": false,
    "info": ""
    },
    {
    "id": "2ff367f08cbe470f",
    "type": "mqtt in",
    "z": "c974bfc5fbc79b0e",
    "name": "Subscribe ProLathe joints",
    "topic": "FactorySim_Supos/Flow_Group__1/MechEquips/porcess_prolathe_gs_260ms_2/Motor_Joints/+",
    "qos": "1",
    "datatype": "auto",
    "broker": "6f8ade8021b85933",
    "nl": false,
    "rap": true,
    "rh": 0,
    "inputs": 0,
    "x": 590,
    "y": 340,
    "wires": [
    [
    "7c54f7852fb5430e"
    ]
    ]
    },
    {
    "id": "7c54f7852fb5430e",
    "type": "function",
    "z": "c974bfc5fbc79b0e",
    "name": "Cache Data",
    "func": "const CONFIG = {\n fields: [\"JointChanger\", \"JointDoors\", \"JointFinger\", \"JointSpindle\", \"JointTailStock\", \"Joint_X\", \"Joint_Y\", \"Joint_Z\"],\n payloadFields: {\n value: 'CurrentValue',\n initialValue: 'InitialValue',\n name: 'Name',\n timeStamp: 'timeStamp',\n time_stamp: 'time_stamp',\n quality: 'quality'\n }\n};\n\nlet cache = flow.get('dataCache') || { instant: {}, metadata: {} };\n\nconst topicParts = msg.topic.split('/');\nconst fieldName = topicParts[topicParts.length - 1];\n\nlet payload = msg.payload;\nif (typeof payload === 'string') {\n try {\n payload = JSON.parse(payload);\n } catch (e) {\n return null;\n }\n}\n\nlet value = payload[CONFIG.payloadFields.value];\nif (value === undefined) return null;\n\nconst metadata = {\n timeStamp: payload[CONFIG.payloadFields.timeStamp],\n time_stamp: payload[CONFIG.payloadFields.time_stamp],\n quality: payload[CONFIG.payloadFields.quality],\n name: payload[CONFIG.payloadFields.name],\n initialValue: payload[CONFIG.payloadFields.initialValue]\n};\n\nif (CONFIG.fields.includes(fieldName)) {\n cache.instant[fieldName] = value;\n cache.metadata[fieldName] = metadata;\n} else {\n return null;\n}\n\nflow.set('dataCache', cache);\nreturn null;",
    "outputs": 0,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 860,
    "y": 360,
    "wires": []
    },
    {
    "id": "a69b0f994c614213",
    "type": "inject",
    "z": "c974bfc5fbc79b0e",
    "name": "100ms Timer",
    "props": [
    {
    "p": "payload"
    },
    {
    "vt": "str",
    "p": "topic"
    }
    ],
    "repeat": "0.1",
    "crontab": "",
    "once": true,
    "onceDelay": "0.1",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "x": 500,
    "y": 460,
    "wires": [
    [
    "a182dc40725e4801"
    ]
    ]
    },
    {
    "id": "a182dc40725e4801",
    "type": "function",
    "z": "c974bfc5fbc79b0e",
    "name": "Aggregate & Publish (Flat)",
    "func": "const CONFIG = {\n fieldMapping: {\n \"JointChanger\": \"J_Changer\",\n \"JointDoors\": \"J_Door\",\n \"JointFinger\": \"J_Finger\",\n \"JointSpindle\": \"J_Spindle\",\n \"JointTailStock\": \"J_TailStock\",\n \"Joint_X\": \"J_X\",\n \"Joint_Y\": \"J_Y\",\n \"Joint_Z\": \"J_Z\"\n},\n missingStrategy: 'lastValue',\n outputTopic: \"Metric/porcess_prolathe_gs_260ms_2\",\n windowMs: 100\n};\n\nconst FIELDS = Object.keys(CONFIG.fieldMapping);\n\nlet cache = flow.get('dataCache') || { instant: {}, metadata: {} };\nlet lastValues = flow.get('lastValues') || {};\nlet lastMetadata = flow.get('lastMetadata') || {};\nlet output = {};\n\noutput.timestamp = new Date().toISOString();\n\nfor (const field of FIELDS) {\n const shortName = CONFIG.fieldMapping[field];\n\n if (cache.instant[field] !== undefined) {\n output[shortName + '_Cur'] = Number(cache.instant[field]);\n output[shortName + '_Init'] = cache.metadata[field] && cache.metadata[field].initialValue !== undefined\n ? Number(cache.metadata[field].initialValue)\n : 0;\n lastValues[field] = cache.instant[field];\n lastMetadata[field] = cache.metadata[field] || {};\n } else {\n let fallbackValue = CONFIG.missingStrategy === 'lastValue'\n ? (lastValues[field] !== undefined ? lastValues[field] : 0)\n : 0;\n output[shortName + '_Cur'] = Number(fallbackValue);\n output[shortName + '_Init'] = lastMetadata[field] && lastMetadata[field].initialValue !== undefined\n ? Number(lastMetadata[field].initialValue)\n : 0;\n }\n}\n\nmsg.payload = output;\n\nmsg.payload.Model_Name = \"Turbo\";\nmsg.payload.Max_Carry_Weight_kg = 15.0;\n\nmsg.topic = CONFIG.outputTopic;\n\nflow.set('dataCache', { instant: {}, metadata: {} });\nflow.set('lastValues', lastValues);\nflow.set('lastMetadata', lastMetadata);\n\nreturn msg;",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 740,
    "y": 460,
    "wires": [
    [
    "b4e1817aa3744ab9",
    "84c88149d8d24eae"
    ]
    ]
    },
    {
    "id": "b4e1817aa3744ab9",
    "type": "mqtt out",
    "z": "c974bfc5fbc79b0e",
    "name": "Metric/Prolathe2",
    "topic": "Metric/ProLathe-02",
    "qos": "1",
    "retain": "false",
    "respTopic": "",
    "contentType": "",
    "userProps": "",
    "correl": "",
    "expiry": "",
    "broker": "6befe0f78bf64759",
    "x": 1060,
    "y": 360,
    "wires": []
    },
    {
    "id": "84c88149d8d24eae",
    "type": "debug",
    "z": "c974bfc5fbc79b0e",
    "name": "Debug Output",
    "active": true,
    "tosidebar": true,
    "console": false,
    "complete": "payload",
    "statusVal": "",
    "statusType": "auto",
    "x": 980,
    "y": 540,
    "wires": []
    },
    {
    "id": "6f8ade8021b85933",
    "type": "mqtt-broker",
    "name": "supos-demo.supos.app",
    "broker": "supos-demo.supos.app",
    "port": 1883,
    "clientid": "",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": 4,
    "keepalive": 60,
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    },
    {
    "id": "6befe0f78bf64759",
    "type": "mqtt-broker",
    "z": "c974bfc5fbc79b0e",
    "name": "emqx",
    "broker": "mqtt.pre.tier0.dev",
    "port": "1883",
    "clientid": "336462685553088&338098843755632",
    "autoConnect": true,
    "usetls": false,
    "protocolVersion": "4",
    "keepalive": "60",
    "cleansession": true,
    "autoUnsubscribe": true,
    "birthTopic": "",
    "birthQos": "0",
    "birthRetain": "false",
    "birthPayload": "",
    "birthMsg": {},
    "closeTopic": "",
    "closeQos": "0",
    "closeRetain": "false",
    "closePayload": "",
    "closeMsg": {},
    "willTopic": "",
    "willQos": "0",
    "willRetain": "false",
    "willPayload": "",
    "willMsg": {},
    "userProps": "",
    "sessionExpiry": ""
    }
    ]
  1. 在 模型库 中导入车间中的模型,将 UNS 数据映射到模型,并创建对应实例。
  2. 进入 场景,从 实例库 将车间中的实例添加到场景中。
  3. 移动模型到车间中的对应位置,并设置环境光照等细节。

参考资料

API 参考

连接 Tier0 API、检查响应,并安全地重试写入。

  • 基础 URL:https://<your-tier0-host>/openapi/v2
  • 认证:在 x-api-key 请求头中发送 Tier0 API Key。
  • 对 /uns/ 请求同时检查 HTTP 状态和响应体。成功响应的状态为 2xx 且 code: 0,结果在 data 中。
  • 失败时查看 error.code,并保留 requestId 以便排查。
  • 批量请求即使返回 HTTP 200,也要逐项检查,部分项目可能失败。
  • 查看 error.execution,判断写入是否未开始、已回滚、已提交或结果未知。
  • 仅当 error.retry.safe 为 true 时,才使用相同幂等键重试同一请求。如果给出等待时间,至少等待 error.retry.afterMs 或 Retry-After 响应头指定的时长。
  • 如果批量请求部分提交,先核对成功项目,再提交剩余工作。若结果未知且响应未确认可安全重试,先验证写入是否生效。
参考资料

CLI 命令参考

CLI 和 Agent Skill 命令参考。

全局参数这些参数可以用于任何 tier0 命令。
--json输出原始 JSON--debug打印 HTTP 请求/响应详情

基础操作

tier0 doctor诊断本地 Tier0 CLI 连接和认证

用法

Terminal window
tier0 doctor

说明

  • 检查本地配置、OpenAPI 连通性、API key 是否存在以及 API key 身份。

示例

Terminal window
tier0 doctor
tier0 config查看或更新配置

用法

Terminal window
tier0 config

参数

--base-url
设置平台 base URL
--api-key
设置 API key(可替代 tier0 login)
--lang
已弃用的兼容参数;CLI 输出仅支持英文已弃用

示例

Terminal window
tier0 config
Terminal window
tier0 config --base-url https://tier0.dev
Terminal window
tier0 config --api-key sk-per-xxxxxx
tier0 login通过 Device Flow 认证

用法

Terminal window
tier0 login

参数

--no-wait
打印授权 URL 后退出,不进行轮询
--setup-code
使用已有 setup code 轮询,而不是创建新的 setup code
--base-url
覆盖平台 base URL

说明

  • 未使用 --no-wait 时,CLI 每 5 秒轮询一次,最长 10 分钟。
  • 使用 --no-wait --json 时,CLI 会返回 verification_url、setup_code 和 expires_in。

示例

Terminal window
tier0 login
Terminal window
tier0 login --no-wait --json
Terminal window
tier0 login --setup-code <setup_code>
tier0 api直接调用 API endpoint

用法

Terminal window
tier0 api <endpoint>

参数

--body
请求体 JSON 字符串
--body-file
从文件读取请求体
--method
HTTP 方法(GET|POST|PUT|DELETE)默认值: POST
--dry-run
预览请求但不执行

说明

  • --body 和 --body-file 互斥。

示例

Terminal window
tier0 api /openapi/v1/uns/browse --body '{"path":"/"}'
Terminal window
tier0 api /openapi/v1/uns/read --body '{"topics":["demo"]}'
Terminal window
tier0 api /openapi/v1/uns/write --body-file body.json
tier0 upgrade将 CLI 升级到最新版本

用法

Terminal window
tier0 upgrade

参数

--dry-run
检查更新但不安装
-v, --version
升级到指定版本(默认 latest)

示例

Terminal window
tier0 upgrade
Terminal window
tier0 upgrade --dry-run
tier0 uninstall卸载 tier0 CLI

用法

Terminal window
tier0 uninstall

参数

--purge
同时删除配置文件(凭据)
--remove-skills
同时从检测到的 AI agents 中移除 Tier0 Skill
--keep-skills
保留 agent skills(已弃用;现在默认如此)已弃用

说明

  • 默认保留 Agent Skills 和配置。
  • CLI 卸载时会删除本地内置 skills 目录。

示例

Terminal window
tier0 uninstall
Terminal window
tier0 uninstall --purge
Terminal window
tier0 uninstall --remove-skills
Terminal window
tier0 uninstall --purge --remove-skills
tier0 version显示版本

用法

Terminal window
tier0 version

示例

Terminal window
tier0 version

技能

tier0 skills install安装或修复 CLI 内置的 Skill

用法

Terminal window
tier0 skills install

参数

--force
用内置基线替换当前启用的 Skill
--no-sync
仅本地安装,不同步到检测到的 AI agents

示例

Terminal window
tier0 skills install
Terminal window
tier0 skills install --force
tier0 skills list列出已安装的 skills别名: ls

用法

Terminal window
tier0 skills list

示例

Terminal window
tier0 skills list
tier0 skills update将 skills 升级到最新版本别名: upgrade

用法

Terminal window
tier0 skills update

参数

--dry-run
检查更新但不安装

示例

Terminal window
tier0 skills update
Terminal window
tier0 skills update --dry-run
tier0 skills version显示 skills 版本信息别名: ver

用法

Terminal window
tier0 skills version

示例

Terminal window
tier0 skills version
tier0 skills status显示当前启用和内置 Skill 状态

用法

Terminal window
tier0 skills status

示例

Terminal window
tier0 skills status
tier0 skills sync将当前启用的 Skill 同步到检测到的 AI agents

用法

Terminal window
tier0 skills sync

示例

Terminal window
tier0 skills sync

认证

tier0 auth whoami显示当前 API key 身份

用法

Terminal window
tier0 auth whoami

说明

  • 显示用户、workspace、key 名称、key 类型、角色和权限。

示例

Terminal window
tier0 auth whoami
Terminal window
tier0 auth whoami --json

UNS

tier0 uns browse浏览 UNS namespace 树

用法

Terminal window
tier0 uns browse

参数

-p, --path
要浏览的 UNS 树路径默认值: /
-d, --max-depth
最大递归深度(0 = 不限制)默认值: 1
--include-metadata
包含节点元数据
--include-leaf-value
包含叶子节点值

示例

Terminal window
tier0 uns browse
Terminal window
tier0 uns browse --path /devices
Terminal window
tier0 uns browse --path / --max-depth 2
tier0 uns search搜索 UNS topics

用法

Terminal window
tier0 uns search

参数

-k, --keyword
按名称关键字搜索
--path-prefix
按路径前缀过滤默认值: /
--topic-type
按 topic type 过滤
--page
页码默认值: 1
-l, --size
每页数量(最大结果数)默认值: 20
--include-metadata
包含节点元数据
--include-leaf-value
包含叶子节点值

示例

Terminal window
tier0 uns search --keyword temp
Terminal window
tier0 uns search --path-prefix /devices --size 50
Terminal window
tier0 uns search --keyword temp --include-metadata
tier0 uns read读取 UNS topics 的当前值

用法

Terminal window
tier0 uns read [topic...]
Terminal window
tier0 uns read --topic <topic>

参数

-t, --topic
要读取的 topic 名称(可重复;也接受位置参数)可重复
--include-metadata
包含 topic 元数据(topicType、fields、description)
--include-leaf-value
包含叶子节点值

说明

  • 必须通过位置参数或 --topic 提供至少一个 topic。

示例

Terminal window
tier0 uns read demo
Terminal window
tier0 uns read --topic demo
Terminal window
tier0 uns read temp humidity
Terminal window
tier0 uns read --topic sensor1 --include-metadata
tier0 uns write向 UNS topic 写入值

用法

Terminal window
tier0 uns write

参数

-t, --topic
要写入的 topic 名称(必填)必填
-v, --value
JSON 值字符串(与 --file 互斥)
-f, --file
从文件读取值(与 --value 互斥)
--qos
MQTT QoS 等级(0/1/2)默认值: 0
--retain
设置 MQTT retain flag
--dry-run
预览请求但不执行

说明

  • --value 和 --file 互斥。
  • 值必须是符合 topic fields 的有效 JSON object。

示例

Terminal window
tier0 uns write --topic demo --value '{"temp":25}'
Terminal window
tier0 uns write --topic demo --file payload.json
Terminal window
tier0 uns write --topic sensor1 --value '{"on":true}' --qos 1 --retain
tier0 uns history查询 topics 历史数据

用法

Terminal window
tier0 uns history

参数

-t, --topic
topic 名称(可重复,必填)必填可重复
--start
开始时间:相对时间(-1h/-30m/-7d)、ISO 8601 或 'now'(必填)必填
--end
结束时间:相对时间、ISO 8601 或 'now'(默认 now)默认值: now
--page
页码默认值: 1
-l, --size
每页数量(最大数据点数)默认值: 100
--interval
聚合间隔(例如 1m、1h、1d)
--fn
聚合函数(avg/max/min/sum/count)
--field
聚合字段名

示例

Terminal window
tier0 uns history -t demo --start -1h
Terminal window
tier0 uns history -t demo --start -24h --end now --fn avg --interval 1h
Terminal window
tier0 uns history -t demo --start 2026-01-01T00:00:00Z --end 2026-01-02T00:00:00Z
tier0 uns create创建 UNS namespace 节点

用法

Terminal window
tier0 uns create

参数

-t, --topic
topic 路径或叶子名称(不使用 --file 时必填)
--parent
父级路径前缀(可选,会与 --topic 组合)
--type
节点类型:'path'(文件夹)或 'topic'(数据点)
-d, --display-name
显示名称
--description
描述
--alias
别名
-f, --file
从 JSON 文件读取 namespace 定义({"namespace":[]} 或裸数组)
--topic-type
已弃用:topic type 现在由路径推导(叶子节点前的 Metric/Action/State 文件夹)已弃用
--fields
schema fields JSON 数组
--fields-file
从文件读取 schema fields JSON 数组
--dry-run
预览请求但不执行

说明

  • 不使用 --file 时,必须提供 --topic 和 --type。
  • --fields 和 --fields-file 互斥。
  • 对于 topic 节点,叶子节点前一级路径必须是 Metric、Action 或 State。

示例

Terminal window
tier0 uns create --topic Plant/Line1/Metric/Temperature --type topic
Terminal window
tier0 uns create --parent Factory1/Line1/Station1 --topic Metric/ProductionCount --type topic
Terminal window
tier0 uns create --topic Plant/Line1 --type path --display-name 'Line 1'
Terminal window
tier0 uns create --file namespace.json
tier0 uns update更新 UNS topic 元数据

用法

Terminal window
tier0 uns update

参数

-p, --path
要更新的 topic 路径(必填)必填
-n, --name
新名称
--alias
新别名
--description
新描述
--clear-description
清空描述,不依赖空 shell 参数
-d, --display-name
新的显示名称
--extend-properties
扩展属性 JSON 对象
--fields
schema fields JSON 数组
--fields-file
从文件读取 schema fields JSON 数组
--update-mask
要更新的字段(可重复,例如 name、description、fields)可重复
--dry-run
预览请求但不执行

说明

  • --description 和 --clear-description 互斥。
  • --fields 和 --fields-file 互斥。
  • 至少需要提供一个要更新的字段。

示例

Terminal window
tier0 uns update --path Plant/Line1/Metric/Temperature --display-name 'Line 1 Temp'
Terminal window
tier0 uns update --path Plant/Line1 --description 'Production line 1' --update-mask description
Terminal window
tier0 uns update --path Plant/Line1/Metric/Temperature --fields '[{"name":"temp","type":"float","unit":"C"}]' --update-mask fields
tier0 uns delete删除 UNS 节点

用法

Terminal window
tier0 uns delete

参数

-p, --path
要删除的节点路径(可重复,必填)必填可重复
--hard
硬删除(不可恢复)
-y, --yes
确认高风险操作(必填)必填
--dry-run
预览请求但不执行

说明

  • 默认执行软删除,可以恢复。
  • --hard 不可恢复。
  • 高风险操作需要 --yes,除非使用 --dry-run。

示例

Terminal window
tier0 uns delete --path factory/line1/sensor/temp --yes
Terminal window
tier0 uns delete --path factory/line1/sensor/temp --path factory/line1/sensor/humi --yes
Terminal window
tier0 uns delete --path factory/line1/sensor/temp --hard --yes
tier0 uns restore从历史记录恢复 topic

用法

Terminal window
tier0 uns restore

参数

-p, --path
要恢复的 topic 路径(必填)必填
-y, --yes
确认高风险操作(必填)必填
--dry-run
预览请求但不执行

说明

  • 高风险操作需要 --yes,除非使用 --dry-run。

示例

Terminal window
tier0 uns restore --path Plant/Line1/Metric/Temperature --yes

Node-RED 流程

tier0 flow list列出 flows别名: ls

用法

Terminal window
tier0 flow list

参数

-k, --keyword
按名称关键字过滤
-t, --type
按类型过滤(SourceFlow/EventFlow)
--source
只显示 SourceFlow
--event
只显示 EventFlow

说明

  • --source 和 --event 互斥。
  • --type 不能与 --source 或 --event 同时使用。

示例

Terminal window
tier0 flow list
Terminal window
tier0 flow list --source --json
tier0 flow get获取 flow 详情

用法

Terminal window
tier0 flow get --id <id>
Terminal window
tier0 flow get <id>

参数

--id
Flow ID默认值: 0

说明

  • 必须通过 --id 或位置参数提供正数 Flow ID。

示例

Terminal window
tier0 flow get --id 1 --json
Terminal window
tier0 flow get 1 --json
tier0 flow create创建新 flow

用法

Terminal window
tier0 flow create

参数

-n, --name
Flow 名称(必填)必填
-t, --type
Flow 类型:SourceFlow | EventFlow(必填)必填
--source
设置类型为 SourceFlow
--event
设置类型为 EventFlow
--desc
描述
--template
初始模板 JSON 字符串
--template-file
从文件读取初始模板
--dry-run
预览请求但不执行

说明

  • 必须且只能使用 --type、--source 或 --event 之一选择 Flow 类型。
  • --template 和 --template-file 互斥。

示例

Terminal window
tier0 flow create --name "modbus-collector" --source --desc "Modbus TCP collector"
Terminal window
tier0 flow create --name "alert-handler" --event --desc "Temperature alarm processor"
tier0 flow update更新 flow 元数据

用法

Terminal window
tier0 flow update --id <id>
Terminal window
tier0 flow update <id>

参数

--id
Flow ID(必填)默认值: 0
-n, --name
新名称
--desc
新描述
--template
新模板 JSON 字符串
--template-file
从文件读取新模板
--favorite
标记为收藏
--unfavorite
取消收藏
--dry-run
预览请求但不执行

说明

  • 必须通过 --id 或位置参数提供正数 Flow ID。
  • --template 和 --template-file 互斥。
  • --favorite 和 --unfavorite 互斥。
  • 至少需要提供一个要更新的字段。

示例

Terminal window
tier0 flow update --id 1 --name "line1-collector"
Terminal window
tier0 flow update --id 1 --favorite
tier0 flow data获取 Node-RED canvas JSON

用法

Terminal window
tier0 flow data --id <id>
Terminal window
tier0 flow data <id>

参数

--id
Flow ID默认值: 0
-o, --out
保存输出到文件

说明

  • 必须通过 --id 或位置参数提供正数 Flow ID。

示例

Terminal window
tier0 flow data --id 1 --out flows.json
tier0 flow deploy部署 Node-RED canvas JSON

用法

Terminal window
tier0 flow deploy --id <id>
Terminal window
tier0 flow deploy <id>

参数

--id
Flow ID(必填)默认值: 0
--flows-json
Node-RED 画布 JSON 字符串
-f, --flows-file
从文件读取 Node-RED 画布 JSON(推荐)
-y, --yes
确认高风险操作(必填)必填
--dry-run
预览请求但不执行

说明

  • 必须通过 --id 或位置参数提供正数 Flow ID。
  • --flows-json 和 --flows-file 互斥。
  • 部署会替换该 Flow 中所有现有 Node-RED 节点。
  • 高风险操作需要 --yes,除非使用 --dry-run。

示例

Terminal window
tier0 flow deploy --id 1 -f flows.json --dry-run --json
Terminal window
tier0 flow deploy --id 1 -f flows.json --yes
tier0 flow delete删除 flow别名: del, rm

用法

Terminal window
tier0 flow delete --id <id>
Terminal window
tier0 flow delete <id>[,<id>...]

参数

--id
要删除的 Flow ID(可重复)可重复
-y, --yes
确认高风险操作(必填)必填
--dry-run
预览请求但不执行

说明

  • 位置参数可以包含逗号分隔的 Flow ID。
  • 删除会停止 Node-RED 容器,且无法撤销。
  • 高风险操作需要 --yes,除非使用 --dry-run。

示例

Terminal window
tier0 flow delete --id 1 --yes
tier0 flow nodes列出可用的 Node-RED 节点类型

用法

Terminal window
tier0 flow nodes [source|event]
Terminal window
tier0 flow nodes --type <SourceFlow|EventFlow>
Terminal window
tier0 flow nodes --source
Terminal window
tier0 flow nodes --event

参数

-t, --type
Flow 类型(SourceFlow/EventFlow)
--source
显示 SourceFlow 节点
--event
显示 EventFlow 节点

说明

  • 最多接受一个位置参数形式的 Flow 类型。
  • --source 和 --event 互斥。
  • 不要将位置参数/类型输入与 --source 或 --event 同时使用。

示例

Terminal window
tier0 flow nodes source --json
Terminal window
tier0 flow nodes --source --json
Terminal window
tier0 flow nodes --event --json

文件资源

tier0 assets upload上传文件到 Tier0 object storage

用法

Terminal window
tier0 assets upload <local-file>

参数

--business
业务场景默认值: attachment
--use-by
使用范围:user|workspace|platform默认值: workspace
--visibility
可见性:public|private默认值: private
--app-instance-id
AI 应用实例 ID
--session-id
AI 会话 ID
--multipart-size
分片大小(例如 10MB,最小 5MB)默认值: CLI-defined default
--concurrency
分片上传并发数(并行分片数量)默认值: 4
--resume
恢复中断的分片上传
--abort
中止中断的分片上传并清理其状态

说明

  • 必须提供且只能提供一个本地文件参数。
  • 超过 100MB 的文件会自动使用分片上传。
  • CLI 不强制限制最大文件大小;服务器会按套餐和配额限制处理。

示例

Terminal window
tier0 assets upload ./report.csv
Terminal window
tier0 assets upload ./report.csv --visibility public --business attachment
Terminal window
tier0 assets upload ./report.csv --use-by workspace --visibility private
Terminal window
tier0 assets upload ./large-backup.tar.gz
Terminal window
tier0 assets upload ./large-backup.tar.gz --resume
Terminal window
tier0 assets upload ./large-backup.tar.gz --abort
Terminal window
tier0 assets upload ./large-backup.tar.gz --multipart-size 20MB --concurrency 8
tier0 assets download从 Tier0 object storage 下载文件

用法

Terminal window
tier0 assets download

参数

--file-path
上传返回的文件路径必填
-o, --output
输出文件路径(默认 stdout)
--content-disposition
自定义 Content-Disposition

示例

Terminal window
tier0 assets download --file-path workspace/.../report.csv -o ./report.csv
Terminal window
tier0 assets download --file-path workspace/.../report.csv
tier0 assets url获取 Tier0 object storage 文件访问 URL

用法

Terminal window
tier0 assets url

参数

--file-path
上传返回的文件路径必填
--expired-sec
预签名 URL 过期秒数默认值: 3600
--content-disposition
自定义 Content-Disposition

示例

Terminal window
tier0 assets url --file-path workspace/.../report.csv
Terminal window
tier0 assets url --file-path workspace/.../report.csv --expired-sec 300
tier0 assets delete删除 Tier0 object storage 文件

用法

Terminal window
tier0 assets delete

参数

--file-path
上传返回的文件路径必填
-y, --yes
确认高风险操作(必填)必填
--dry-run
预览请求但不执行

说明

  • 删除无法撤销。
  • 高风险操作需要 --yes,除非使用 --dry-run。

示例

Terminal window
tier0 assets delete --file-path workspace/.../report.csv --dry-run --json
Terminal window
tier0 assets delete --file-path workspace/.../report.csv --yes
参考资料

内置 Builder Skills

Tier0 Builder 内置 AI Skills 的参考。

Tier0 Builder Skills 仓库的 feature/cloud-new-architecture-migration 分支目前包含 6 个 Skill,分别处理需求、应用构建、平台对齐、浏览器能力、响应式设计和预览故障。

用于创建、转换或修订工业企业应用的需求规格说明(SRS)。它梳理业务角色、流程、状态、校验和异常,限定首版范围,默认保存到 specs/spec.md。首次构建应用时,除非用户只要求需求文档或仍需澄清,它会继续交给 app-builder。

Terminal window
使用 $app-srs 为汽车零部件工厂设计质量异常管理系统。

根据需求或 specs/spec.md 构建可运行的首版应用,或为现有应用增加重要业务模块。首次构建时,必要情况下先调用 app-srs。普通字段、文案、样式和局部 UI 修复无需完整 Builder 流程。

它会检查功能入口与可执行路径、真实数据和状态变化、校验与角色权限,以及构建、预览和交互验证。列表页面适用时会采用目标脚手架的 MetaListPage,并连接真实服务和权限。

Terminal window
使用 $app-builder 根据 specs/spec.md 构建首版应用。

将导入的应用迁移到 Tier0 脚手架,或使现有应用与当前脚手架契约一致。适用于旧版 Tier0 应用、自有 SQL 数据库或浏览器存储的应用,以及需要完整更新或局部平台修复的脚手架应用。

它以云架构脚手架的精确提交为基准,对齐运行时、路由、Gateway 角色和平台契约,同时保留业务行为。完整云迁移会通过 @tier0/sdk-v2 将应用自有的持久记录迁至 Tier0 UNS collections;原数据库的历史记录如需保留,还要单独导入 UNS。完成构建和运行验证后才写入 package.json 中的脚手架版本标记。

Terminal window
使用 $align-platform-app 将此应用对齐最新 Tier0 脚手架,并保留业务代码。

指导二维码/条码扫描、拍照、定位、录音、文件读取和剪贴板访问。它按目标设备选择浏览器 API 和后备方案,检查安全上下文、权限及 iframe/WebView 限制;取消或失败时保留表单输入,并区分后备数据与实时采集数据。实现后验证成功、拒绝、重试和清理路径。

Terminal window
使用 $browser-platform-capabilities 为巡检表单添加拍照功能,并提供文件上传后备方案。

处理复杂断点、协同的固定与滚动区域,以及多视口审查和预览。局部溢出或控件裁切可直接修复。audit 审查并修复现有布局;build 从零构建响应式页面;preview 启动多断点实时预览。

Terminal window
使用 $responsive-craft audit 修复此仪表板的移动端布局。
Terminal window
使用 $responsive-craft preview 预览 375、768、1024 和 1440 px 断点。

诊断托管预览的安装、启动、就绪状态、角色、端口和 HMR 故障,不负责构建业务功能。适用于依赖或锁文件错误、Vite/TanStack Start 启动故障、5173 端口冲突、/api/health 或预览角色错误、artifact.toml 不匹配,以及 HMR 频繁整页重载。先读取相关错误,修复有证据支持的原因,仅在必要时重启,并验证原故障、健康检查和受影响路由。

Terminal window
使用 $preview-runtime-stability 诊断“Preview loading timed out”。
  • 需求创建或修订:app-srs,首次构建通常再交给 app-builder。
  • 首版应用或重要业务扩展:app-builder。
  • 迁移或脚手架对齐:align-platform-app。
  • 六种浏览器能力:browser-platform-capabilities。
  • 复杂响应式工作:responsive-craft;托管预览故障:preview-runtime-stability。
参考资料

用户管理

Tier0 通过成员资格、License 和自定义用户账号,由购买方管理平台使用资格与访问权限。

Tier0 用户权限管理和访问控制依据不同版本通过不同方式实现。

  • 云服务版通过 Workspace 成员邀请管理使用资格;
  • 企业版由管理员分配用户账号和角色,控制用户可访问的功能模块。
  • Workspace 创建者或现有成员通过电话或邮箱向新成员发起邀请。新成员收到邀请码或邀请链接后,注册账号并加入 Workspace。

  • 发起邀请时配置新成员的坐席类型(Operator 或 Builder),决定新成员可访问的功能范围。

    • Builder:可访问所有功能模块。
    • Operator:仅可访问应用中心。
  • 账号注册须经过双重验证。

操作 谁 描述
更改席位 创建者 / Builder
  • 创建者可更改所有成员的席位。
  • Builder 仅可更改 Operator 的席位。
删除 Workspace 创建者 删除 Workspace 后,所有数据立即清除且无法恢复。
转移 Workspace 创建者 —
移除成员 创建者 / Builder
  • 创建者可移除所有成员。
  • Builder 仅可移除 Operator。
删除账号 所有成员
  • 创建者必须先删除或转移 Workspace。
  • 成员账号会立刻退出所有 Workspace。
  • 账号数据立即清除且无法恢复。
参考资料

Tier0 云服务版网络与数据安全说明

Tier0 云服务版生产 SaaS 服务的网络边界、租户隔离、数据保护与安全运维措施。

适用范围: Tier0 云服务版生产 SaaS 服务,部署于 AWS 新加坡区域。
文档日期: 2026 年 10 月 22 日

Tier0 云服务版通过网络访问控制、租户隔离、身份权限管理、数据加密及备份恢复等措施,降低网络攻击和未经授权访问的风险。本说明介绍平台的安全防护措施,以及限制安全事件向其他租户、平台内部服务和客户网络扩散的控制边界。

Tier0 云服务版面向公网的 Web 与 API 访问采用 TLS 加密,并通过统一的边缘入口和应用网关接入平台。核心服务入口配置源站访问校验,对不符合校验要求的直接访问请求予以拒绝,降低绕过边缘入口访问源站的风险。

生产环境与开发、预发布环境在云账号、网络、集群和数据库等层面实施隔离,并分别管理访问凭据。生产管理访问通过经过身份认证的专用网络通道进行。

租户工作负载运行在独立的 Kubernetes 命名空间中,并通过专用节点池和调度约束,与平台服务及管理组件分离。该机制用于限制租户应用与平台组件之间的直接接触范围,降低单个应用发生安全事件时对其他服务的影响。

租户命名空间的入站和出站通信采用默认拒绝、显式放行的网络策略。策略由平台自动配置并同步,由集群网络组件执行。

入站通信仅向同租户工作负载及承担必要业务功能的平台服务开放。出站通信按规则开放集群域名解析、同租户服务、指定平台网关、消息服务及所分配的数据库端点。公网访问受网络策略约束;除明确放行的业务依赖外,策略限制对私有网络地址的访问,并阻断对云实例元数据地址的直接访问。

上述措施用于限制未经授权的跨租户连接,以及从租户工作负载向平台内部网络的横向移动。单个租户应用发生安全事件,不会因此自动获得访问其他租户或平台管理组件的权限。已获授权的业务连接仍受相应网络规则和身份权限约束。

租户应用数据在数据库层面实施逻辑隔离。分配独立数据库单元的场景,同时通过网络访问规则限制连接来源。

平台按服务职责配置访问权限,将工作负载的资源访问范围限定于所需功能。网络隔离与身份授权共同限制受影响工作负载能够访问的资源范围。

本节所述租户隔离措施适用于 Tier0 云服务版平台内部。客户通过连接器、网关或其他集成方式接入内部系统时,客户网络的访问边界还取决于实际接入方式、路由、防火墙规则及所授予的凭据权限。

客户接入时应仅开放业务必需的目标地址、端口和账户权限,并对接入组件与其他内部系统实施网络分区。平台内部隔离不能替代客户侧的网络访问控制;双方应结合具体接入方案确定并核验访问范围,以限制经由已授权连接向客户其他系统扩散的风险。

平台对数据传输、存储和访问实施相应保护:

  • 公网 Web 与 API 通信,以及对托管数据库和缓存的访问,采用 TLS 加密。
  • 托管数据库、缓存及对象存储启用静态加密。
  • 对象存储配置公共访问阻断,并通过加密要求、HTTPS 访问要求和资源权限限制数据访问。
  • 租户数据访问同时受数据库隔离和身份权限控制约束。

Tier0 云服务版对生产数据库及纳入备份范围的服务级数据库执行备份,备份数据存储于专用、访问受限的对象存储中,并按相应保留策略管理。

备份任务使用独立身份,权限限定于指定存储位置所需的读写操作,不授予备份对象删除权限。备份到期清理由存储生命周期规则执行,以减少备份任务凭据泄露后被用于删除恢复数据的风险。

备份完成后执行完整性校验,并通过隔离环境中的恢复验证检查备份可用性。应用配置纳入版本控制,构建产物保存在私有镜像仓库,为服务恢复和版本回退提供支持。

生产管理访问使用具名身份,并按最小权限原则分配授权。涉及敏感操作的控制台身份实施强制多因素认证。

日常巡检使用受限的只读身份,可查看工作负载状态、日志和事件,不能读取敏感凭据、修改资源或执行远程命令。生产变更通过单独授权的身份和流程执行。

基础设施配置、部署清单和运维脚本纳入版本控制。生产变更需明确目标、影响范围、验证步骤和回滚方案,并记录执行身份、配置差异及验证结果,以支持追溯和恢复。

平台集中采集生产环境的运行指标、日志和健康状态,并将异常告警发送至运维响应渠道。监控范围包括服务可用性、错误率、数据库健康、证书有效期、备份任务状态及集群运行状态。

发生安全事件时,处置工作以控制影响范围为优先,并保留相关日志、配置和事件时间线。在完成必要的隔离与排查后恢复服务,随后开展事件复盘并跟踪整改。事件处置期间的生产变更按既定流程授权和留痕。

有关安全评估、客户尽调或疑似漏洞,请联系 Tier0 客户经理或安全团队。涉及非公开的架构与控制细节,可在适当的保密安排下提供。首次联系时,请勿发送访问凭据、私钥或客户敏感数据。

参考资料

ISA-95 设备层级

使用 ISA-95 建模物理资产和控制系统时的参考层级。

ISA-95 设备层级描述了组织内物理资产和控制系统的结构方式。

它分为以下层级:

  • Enterprise:最高层级,代表整个组织。它包含整体业务流程和决策实体,通常由 ERP 系统支持。
  • Site:代表特定地理位置或工厂。每个 site 可以有自己的管理系统和本地生产控制。
  • Area:site 内的运营分区,通常是包装、装配或仓储等功能区域。
  • Process Cell:area 内的基本制造单元。它包含生产特定产品或执行特定功能所需的全部设备。
  • Unit:process cell 中的独立部分,负责混合、加热或装配等特定功能。
  • Equipment Module:unit 内执行特定任务的模块化设备。例如,在混合单元中,该模块可以是加热元件。
  • Control Module:最低层级,代表传感器、泵、执行器或 PID 控制回路等单个设备或控制器,负责直接控制物理过程。
参考资料

标准部署方案

Tier0 Enterprise 四虚拟机标准部署参考方案。

简化版不使用 Docker Swarm,只部署单台 enterprise 应用节点,总计 4 台虚拟机:

  • 1 台 enterprise 节点承载 tier0-enterprise + EMQX
  • 2 台数据库节点组成 PostgreSQL + TimescaleDB 主从集群
  • 1 台 Witness 节点参与数据库监督、仲裁和故障切换

简化版目标是降低部署复杂度。代价是应用层和 EMQX 均为单点,只有数据库层保留 DB VIP + Witness 高可用。

以下 IP 为规划占位,实施前必须替换为现场真实网段。

类型 名称 规划 IP 说明
应用节点 ent-enterprise-01 10.60.10.11 单台 enterprise,承载 tier0-enterprise + EMQX
逻辑入口 DB VIP 10.60.20.10 数据库统一入口,只指向当前主库
数据库节点 ent-db-01 10.60.20.11 PostgreSQL + TimescaleDB 主库候选
数据库节点 ent-db-02 10.60.20.12 PostgreSQL + TimescaleDB 备库候选
仲裁节点 ent-db-witness-01 10.60.20.13 repmgr witness / 仲裁监督节点

核心链路:

  • 业务访问路径:用户 / 现场系统 -> ent-enterprise-01 -> DB VIP -> 当前主库
  • tier0-enterprise 和 EMQX 均部署在 ent-enterprise-01
  • 数据库仍通过 DB VIP 访问,不直连 ent-db-01/02
  • Witness 只参与数据库仲裁、选主和健康检查,不进入业务访问链路
阶段 链路 说明
正常访问 ent-enterprise-01 -> DB VIP -> 当前主库 应用始终只连接 10.60.20.10:5432
正常复制 当前主库 -> 当前备库 PostgreSQL WAL 流复制
正常监督 DB-01/DB-02 -> Witness repmgrd 上报状态,Witness 参与仲裁
主库故障 备库 -> Witness 备库请求仲裁,避免脑裂
备库提升 备库 promote Witness 确认后,备库提升为新主库
VIP 漂移 DB VIP -> 新主库 10.60.20.10 绑定到新主库
应用恢复 ent-enterprise-01 -> DB VIP -> 新主库 应用连接池重连后恢复读写
节点 角色 vCPU 内存 存储 系统盘建议 数据盘建议 主要组件
ent-enterprise-01 单节点 enterprise 8 32G 100G 单块系统盘 / 100G 不单独拆分 tier0-enterprise、EMQX、Nginx/HAProxy 可选
ent-db-01 PostgreSQL/TSDB 主库候选 4 8G 500G / 80G /pgdata 360G、/pgwal 40G、/backup-staging 20G PostgreSQL、TimescaleDB、repmgr、keepalived
ent-db-02 PostgreSQL/TSDB 备库候选 4 8G 500G / 80G /pgdata 360G、/pgwal 40G、/backup-staging 20G PostgreSQL、TimescaleDB、repmgr、keepalived
ent-db-witness-01 Witness/仲裁监督 2 4G 40G / 40G 不单独规划 repmgr witness、监控 agent、审计日志
类别 数量 单台规格 小计 vCPU 小计内存 小计存储
enterprise 应用节点 1 8C / 32G / 100G 8C 32G 100G
PostgreSQL + TimescaleDB 节点 2 4C / 8G / 500G 8C 16G 1000G
Witness 节点 1 2C / 4G / 40G 2C 4G 40G
合计 4 - 18C 52G 1140G

换算:

  • 总虚拟机:4 台
  • 总 vCPU:18
  • 总内存:52G
  • 总存储:1.14T
目标 方式 端口 说明
所有虚拟机 ssh -i ~/.ssh/chen-rsa ops@<IP> 22/TCP 统一免密实施后使用;未实施前以现场账号为准
ent-enterprise-01 https://10.60.10.11 443/TCP 业务入口
DB VIP psql -h 10.60.20.10 -p 5432 5432/TCP 只允许 enterprise 节点和运维白名单访问
源 目标 端口 用途
用户 / 现场系统 ent-enterprise-01 80/TCP HTTP 入口或跳转 HTTPS,可选
用户 / 现场系统 ent-enterprise-01 443/TCP HTTPS 业务入口
设备 / 现场系统 ent-enterprise-01 1883/TCP EMQX MQTT 明文,可选
设备 / 现场系统 ent-enterprise-01 8883/TCP EMQX MQTT TLS,建议
设备 / 现场系统 ent-enterprise-01 8083/TCP MQTT WebSocket,可选
设备 / 现场系统 ent-enterprise-01 8084/TCP MQTT WebSocket TLS,可选
运维网段 ent-enterprise-01 18083/TCP EMQX Dashboard,仅允许运维白名单
ent-enterprise-01 DB VIP 5432/TCP PostgreSQL 业务访问
源 目标 端口 用途
ent-db-01 ent-db-02 5432/TCP PostgreSQL WAL 流复制
ent-db-02 ent-db-01 5432/TCP 故障恢复后反向复制
ent-db-01/02 ent-db-witness-01 5432/TCP repmgr metadata / witness 通信
ent-db-01 ent-db-02 VRRP DB VIP 漂移,需允许协议 112
  • 不部署 Docker Swarm
  • tier0-enterprise 和 EMQX 部署在同一台 ent-enterprise-01
  • ent-enterprise-01 是应用层单点,故障时需要人工恢复或从备份重建
  • 节点只有 100G 单系统盘,不适合承载长期业务数据
  • tier0-enterprise 业务数据必须进入 PostgreSQL/TimescaleDB
  • 如有上传、导入导出、报表等文件,可保存在本机并纳入备份;如果后续要扩展为标准版,应迁移到 NFS/NAS 或对象存储
  • EMQX 在简化版中为单节点有状态服务
  • 数据目录固定在 ent-enterprise-01 本地盘,例如 /data/emqx
  • 配置、证书、插件、规则引擎配置需要纳入备份
  • 不提供消息层高可用;如不能接受 EMQX 单点,应使用标准版三节点 EMQX 集群模式
  • PostgreSQL:16 或现场认证版本
  • TimescaleDB:选择与 PostgreSQL 主版本匹配的稳定版本
  • 主从复制:物理流复制
  • 故障切换:repmgrd + witness
  • 数据库入口:DB VIP
  • 连接池:可在 ent-enterprise-01 部署 PgBouncer,避免数据库连接数过高
  • Witness 只放 repmgr witness 元数据和监督逻辑
  • Witness 不承载业务 SQL
  • Witness 故障不影响当前主库继续服务,但会降低自动切换可信度
端口/协议 放行范围 用途
22/TCP 运维网段到 4 台 VM SSH
80/TCP 用户网段到 ent-enterprise-01 HTTP 跳转或内网明文入口
443/TCP 用户网段到 ent-enterprise-01 HTTPS 业务入口
1883/TCP 设备 / 现场系统到 ent-enterprise-01 EMQX MQTT 明文,可选
8883/TCP 设备 / 现场系统到 ent-enterprise-01 EMQX MQTT TLS,建议
8083/TCP 设备 / 现场系统到 ent-enterprise-01 EMQX WebSocket,可选
8084/TCP 设备 / 现场系统到 ent-enterprise-01 EMQX WebSocket TLS,可选
18083/TCP 运维网段到 ent-enterprise-01 EMQX Dashboard,仅白名单
5432/TCP enterprise 到 DB VIP;DB/Witness 内部互通 PostgreSQL / repmgr
112/VRRP DB 节点间 DB VIP 漂移
9100/TCP 监控系统到 4 台 VM node exporter,可选
故障场景 预期行为 业务影响
ent-enterprise-01 故障 应用和 EMQX 均中断,需要人工恢复或从备份重建 应用层整体中断
当前数据库主库故障 备库经 Witness 仲裁后提升,DB VIP 漂移 秒级到分钟级写入中断,应用需重连
数据库备库故障 主库继续服务,复制中断告警 无直接业务中断,但失去数据库热备
Witness 故障 当前主库继续服务,自动切换能力下降 无直接业务中断,需优先恢复
DB VIP 漂移失败 数据库实际已切主但入口不可达 业务中断,需手动绑定 VIP
检查项 通过标准
4 台 VM 主机名固定 hostnamectl 与规划一致
统一 SSH 可用 运维终端可免密访问 4 台 VM
时间同步 4 台 VM 时间偏差小于 1s
防火墙放行 第 9 节端口按范围放行
enterprise 服务正常 tier0-enterprise 健康检查通过
EMQX 状态确认 EMQX 节点、监听端口和持久化目录正常
enterprise 磁盘水位正常 / 使用率低于 70%,日志和缓存清理策略已配置
DB 主从正常 repmgr cluster show 主备和 witness 正常
DB VIP 正常 enterprise 节点连接 10.60.20.10:5432 成功
主库故障演练 备库可提升,DB VIP 可漂移
备份恢复演练 可从备份恢复到测试库
  1. 创建 4 台 VM,固定主机名、IP、时间同步和 SSH
  2. 初始化系统基线、防火墙、磁盘挂载和内核参数
  3. 在 ent-enterprise-01 部署 tier0-enterprise
  4. 在 ent-enterprise-01 部署单节点 EMQX
  5. 部署 PostgreSQL + TimescaleDB 主备
  6. 部署 repmgr witness、repmgrd 和 DB VIP 漂移脚本
  7. 执行连通性、EMQX 恢复、数据库故障切换、备份恢复和巡检验证
  8. 固化运行文档、账号凭据归档和日常巡检任务
  • 简化版应用层是单点,ent-enterprise-01 故障会导致业务整体不可用
  • 简化版 EMQX 是单点,不能提供消息层高可用
  • ent-enterprise-01 只有 100G 单系统盘,必须控制日志、缓存、附件和临时文件
  • 如后续需要应用层或 EMQX 高可用,应切换到标准版
  • 数据库 RPO/RTO 未确认,当前方案按主从自动切换设计,不能承诺零数据丢失
  • DB VIP 漂移脚本需要在现场验证,特别是虚拟化平台是否允许 VRRP
参考资料

tier0-enterprise 三节点部署方案V2

Enterprise Fleet Center 六机单活主备容灾方案。

文档状态:当前实现方案 适用范围:Enterprise Fleet Center 中心节点 部署形态:六台业务机器 + 一台独立部署器控制机 + 四个同网段 VIP 方案定位:单活主备容灾,不是跨机房、共识选主或零数据丢失的严格高可用集群

本方案用于在离线或私有化环境中部署一套逻辑上的 Tier0 Enterprise Fleet Center。六台机器 共同承担业务、中间件和代理职责,用户及 Enterprise 内部服务始终访问固定 VIP;单台机器 或单个代理故障后,由 Keepalived、HAProxy、repmgr、RustFS 和 Fleet Agent 分别完成对应 层级的接管。

方案目标如下:

  • Fleet Center 中心节点发生单机故障后,业务入口能够漂移到健康 Standby;

  • PostgreSQL、Redis、RustFS 均提供固定访问地址,后端节点切换不要求修改 Enterprise .env;

  • App、Flow、Marimo、License 等本地业务文件能够由 Active 增量同步到 Standby;

  • 一份 Cluster License 对应一个逻辑安装实例,切换 Enterprise 节点后不重复激活;

  • 通过独立部署器完成六台机器的初始化、角色编排、部署、监控和故障验证;

  • 明确数据保护边界,避免把 VIP 漂移、文件同步或双实例误认为完整的数据高可用。

本方案只用于 Fleet Center。Branch Enterprise 仍按普通单机方式安装,不参与六机主备。

tier0-enterprise 总体拓扑

核心请求链路为:

Terminal window
用户/现场系统
↓
业务 VIP :8088
↓
当前 Active Enterprise(D / E / F)
├─ PostgreSQL VIP :5432 → D/E HAProxy → A/B 当前可写 Primary
├─ Redis VIP :6379 → C 或 F 独立 Redis
└─ RustFS VIP :19000 → A/B HAProxy → C/D/E/F RustFS 集群

四个 VIP 是业务配置中的固定入口。Enterprise 切换或中间件后端角色变化后,客户端和 Enterprise 均不修改连接地址。

以下地址只用于展示规划格式,实施时必须替换为现场同一 IPv4 子网中的实际地址。四个 VIP 必须未被 DHCP、静态主机或其他 VRRP 实例占用。

类型 名称 示例 IP 说明
控制面 deployer-controller 10.60.10.20 独立部署器,不计入六台业务机器
业务节点 ent-ha-01 / A 10.60.10.11 PostgreSQL Primary 等职责
业务节点 ent-ha-02 / B 10.60.10.12 PostgreSQL Standby 等职责
业务节点 ent-ha-03 / C 10.60.10.13 Witness、Redis-1、RustFS-1
业务节点 ent-ha-04 / D 10.60.10.14 Enterprise 初始 Active 等职责
业务节点 ent-ha-05 / E 10.60.10.15 Enterprise Standby 等职责
业务节点 ent-ha-06 / F 10.60.10.16 Enterprise Standby 等职责
逻辑入口 Business VIP 10.60.10.101 Enterprise 统一入口,默认 8088
逻辑入口 PostgreSQL VIP 10.60.10.102 数据库统一入口,默认 5432
逻辑入口 Redis VIP 10.60.10.103 Redis 统一入口,默认 6379
逻辑入口 RustFS VIP 10.60.10.104 S3 统一入口,默认 19000

实施前还需要确认:业务网卡名称、IPv4 前缀长度、网关、DNS、NTP、主机名、SSH 用户、 磁盘挂载点和防火墙放行范围。VIP、节点 IP 和网卡不能靠脚本猜测后直接用于生产。

Tier0 Enterprise 六机主备容灾架构
机器 默认部署内容 关键职责
A PostgreSQL Primary、RustFS HAProxy、Keepalived 初始数据库主库;RustFS 代理候选一
B PostgreSQL Standby、RustFS HAProxy、Keepalived 数据库流复制备库;RustFS 代理候选二
C PostgreSQL Witness、Redis-1、RustFS-1 数据库仲裁/状态记录;Redis 与 RustFS 数据节点
D PG HAProxy、Keepalived、RustFS-2、Enterprise、Fleet Agent、rsync 初始业务 Active;PostgreSQL 代理候选一
E PG HAProxy、Keepalived、RustFS-3、Enterprise、Fleet Agent、rsync 业务 Standby;PostgreSQL 代理候选二
F Redis-2、RustFS-4、Enterprise、Fleet Agent、rsync 业务 Standby;第二 Redis 实例

该分配面向单机故障和六机资源均衡。部署器按环境内机器名称/IP 的自然顺序映射 A-F 并 默认勾选角色,提交前仍必须结合现场磁盘和故障域人工复核。

**扩展能力说明:**当前 Enterprise 业务层采用单活主备模式,同一时刻只有业务 VIP 所在节点承载业务请求。当前只支持通过提升单个业务节点的 CPU、内存和磁盘规格进行纵向扩容,不支持通过增加 Enterprise 节点实现多节点负载均衡,也不应按节点数量估算并发能力的线性提升。

六台机器按以下配置准备:A、B 两台 PostgreSQL 数据库节点各配置 1T,C、D、E、F 四台中间件/业务节点各配置 500G。

机器 节点类型 vCPU 内存 基础存储 系统盘和数据盘建议
A PostgreSQL Primary 节点 8C 16G 1T / 建议 80G;其余空间用于 PostgreSQL 数据、WAL 和备份暂存
B PostgreSQL Standby 节点 8C 16G 1T / 建议 80G;其余空间用于 PostgreSQL 数据、WAL 和备份暂存
C Witness / 中间件节点 4C 8G 500G 系统、Redis 和 RustFS 数据按固定挂载点分配
D Enterprise 初始 Active 业务节点 8C 32G 500G 系统、容器、Enterprise 本地同步目录和 RustFS 数据按固定挂载点分配
E Enterprise Standby 业务节点 8C 32G 500G 系统、容器、Enterprise 本地同步目录和 RustFS 数据按固定挂载点分配
F Enterprise Standby 业务节点 8C 32G 500G 系统、容器、Enterprise 本地同步目录和 RustFS 数据按固定挂载点分配

基础机器资源汇总如下:

类别 数量 单台规格 小计 vCPU 小计内存 小计基础存储
PostgreSQL 数据库节点 2 8C / 16G / 1T 16C 32G 2T
Witness / 中间件节点 1 4C / 8G / 500G 4C 8G 500G
Enterprise 业务节点 3 8C / 32G / 500G 24C 96G 1.5T
合计 6 - 44C 136G 4T

A、B 的 16G 内存用于 PostgreSQL/TimescaleDB/pgvector 的缓存和查询,是当前规模的生产基线;数据库量、时序查询或向量检索负载明显增加时再扩到 32G。C 同时承载 Witness、Redis 和 RustFS,因此配置 4C / 8G,不再按纯 Witness 的轻量规格准备。D、E、F 保持 8C / 32G 作为 Enterprise 生产基线,实际并发或 App 负载超出基线时再通过压测扩容。

C、D、E、F 组成 RustFS 四节点集群,四台机器均配置 500G。实施时仍需根据文件容量、增长率、保留周期和实际纠删码要求,为系统、Enterprise 本地文件与 RustFS 数据设置固定挂载点和容量预留,并在部署前验证容量、inode、吞吐和重启后自动挂载。

D、E、F 的 Enterprise 配置保持一致:

依赖 配置原则
PostgreSQL 连接 PostgreSQL VIP,不写 A/B 节点 IP
Redis 连接 Redis VIP,不写 C/F 节点 IP
文件存储 FILESTORE_DRIVER=s3,S3 Endpoint 指向 RustFS VIP
Fleet 身份 三台共享一个逻辑 installationId,各自使用独立 memberId
Fleet Agent 每套 Enterprise 对应本机一个进程级 Fleet Agent
License 通过业务 VIP 激活一次,Bundle 纳入 HA fileset 同步

installationId 和 memberId 由安装流程生成和持久化,普通实施人员不应手工编造或在 三台机器间复制 memberId。

VIP 候选节点 健康依据 接管结果
业务 VIP D、E、F Fleet Agent readiness、业务容器状态、同步 generation 仅 Owner 启动 Enterprise HA 业务组
PostgreSQL VIP D、E HAProxy/Keepalived 状态,HAProxy 只路由可写 Primary Enterprise 仍使用原 DB 地址
Redis VIP C、F Redis PING 和本机服务状态 切换到另一独立实例,缓存/会话可能丢失
RustFS VIP A、B HAProxy 和 RustFS 后端健康 代理入口漂移,S3 地址不变

6.1 Enterprise、Fleet Agent 与业务 VIP

Section titled “6.1 Enterprise、Fleet Agent 与业务 VIP”
  • D、E、F 安装同一版本的完整 Enterprise 离线 ZIP;

  • Fleet Agent 是宿主机进程级服务,不是业务容器;

  • Keepalived 管理业务 VIP,调用 Fleet Agent 的 readiness 接口判断本机是否可以持有 VIP;

  • 只有业务 VIP Owner 运行业务组,另外两台保持 Standby;

  • Owner 丢失 VIP 后必须停止业务组,恢复节点只能先以 Standby 加入;

  • EMQX 随业务组单活运行,不允许绕过 Agent 单独重启或在三台机器上组成另一套选主逻辑。

6.2 PostgreSQL 主备、Witness 与统一入口

Section titled “6.2 PostgreSQL 主备、Witness 与统一入口”
  • A 初始为 Primary,B 为 Streaming Standby,C 为 repmgr Witness;

  • Witness 记录集群状态并参与故障判断,不保存完整业务数据,也不承载业务读写;

  • 主库故障时,由 repmgr 流程将健康 Standby 提升为新 Primary;

  • D/E HAProxy 根据数据库实际角色,仅把 5432 流量发送到当前可写 Primary;

  • PostgreSQL VIP 在 D/E 两个代理间漂移,代理故障与数据库主备切换相互解耦;

  • 验收必须同时证明“唯一可写 Primary”和“Standby 恢复 streaming”。

Witness 位于只读备库之外,因此不受 Standby 不可写的限制;它参与的是集群观察与仲裁, 不是由 Fleet Agent 向备库写入一套额外的 lease/epoch。

  • C、F 各运行一个 Redis 单实例;

  • 两个 Redis 不组成 Sentinel、Cluster 或主从复制;

  • Redis VIP 只提供连接入口切换;当前实例故障后,VIP 漂移到另一健康实例;

  • Redis 中只允许保存可丢失或可重建的数据。切换后缓存为空、用户重新登录属于当前设计边界;

  • 如果未来 Redis 承载不可丢失状态,必须升级为复制/仲裁方案,不能继续沿用双独立实例假设。

  • C、D、E、F 组成 RustFS 四节点分布式对象存储;

  • A、B 上的 HAProxy 代理全部健康 RustFS 后端;

  • RustFS VIP 在 A/B 之间漂移,Enterprise 始终通过该 VIP 使用 S3;

  • 单个 RustFS 节点故障时由集群机制维持服务,单个代理故障时由 VIP 漂移恢复入口;

  • 禁止通过 rsync、热拷贝或直接编辑 RustFS 挂载目录来“同步”对象数据;

  • RustFS 节点数量、磁盘数和纠删码可用边界以实际部署版本的集群检查结果为准。

6.5 App、Flow、Marimo 与 License 文件同步

Section titled “6.5 App、Flow、Marimo 与 License 文件同步”

Fleet Agent 只同步不能直接放入 PostgreSQL/RustFS、但新 Active 又必须拥有的本地业务文件:

  • App 运行目录及 node_modules;

  • Flow、Marimo、Notebook 等本地运行文件;

  • License Bundle;

  • 当前实现明确登记的其他 HA fileset。

同步使用系统 rsync,通过部署器管理的业务节点专用 SSH 信任网,从 Active 增量发送到 两个 Standby。每次发布生成完整 generation/manifest,Standby 只有确认 generation 完整后 才具备接管资格。VIP 刚切换时,新 Active 不得用旧 generation 反向覆盖其他节点。

PostgreSQL 数据目录、Redis 数据目录和 RustFS 数据目录均不在该同步范围内。

来源 目标 用途
用户/现场系统 业务 VIP Web/API 业务访问
D/E/F Enterprise PostgreSQL VIP 业务数据库读写
D/E/F Enterprise Redis VIP 缓存和会话
D/E/F Enterprise RustFS VIP S3 对象读写
部署器控制机 A-F SSH、部署、状态采集和运维操作
D/E/F D/E/F rsync/SSH 文件增量同步
A/B/C A/B/C PostgreSQL 流复制、repmgr 和 Witness 通信
RustFS 成员/代理 C/D/E/F RustFS 集群和 S3 后端通信
同一 VIP 候选节点 对应候选节点 VRRP 通告与 VIP 漂移

端口应按“来源→目标”最小化放行,禁止直接把全部管理端口暴露到用户网段。

端口/协议 建议放行范围 用途
22/TCP 部署器→A-F;D/E/F 业务同步互访 SSH、部署、rsync
8088/TCP 用户网段→业务 VIP Enterprise 业务入口
5432/TCP D/E/F→PostgreSQL VIP;PG/代理内部互访 PostgreSQL、流复制和代理
6379/TCP D/E/F→Redis VIP;健康检查节点→C/F Redis 访问和健康检查
19000/TCP D/E/F→RustFS VIP Enterprise S3 固定入口
9000/TCP A/B→C/D/E/F;RustFS 成员互访 RustFS S3 后端/集群通信,按实际版本确认
9001/TCP 运维受控网段→RustFS 管理入口 RustFS 管理端,可选且不得暴露用户网
19731/TCP 本机/Keepalived/受控运维网段 Fleet Agent HTTP 健康与控制接口
18080/TCP 运维网段→部署器控制机 部署器 HTTPS 页面
112/VRRP 对应 VIP 候选节点互通 Keepalived VIP 漂移,注意它是 IP 协议号而非 TCP/UDP 端口
1883/8883 现场设备网段→业务入口,按产品配置选择 MQTT/MQTTS

HAProxy 管理/统计端口、PostgreSQL 角色探测端口及 RustFS 内部端口应以最终部署器生成配置为准,并仅在集群内部按实际需要放行。

故障场景 预期行为 数据影响/限制
当前 Enterprise Active 故障 业务 VIP 漂移;健康 Standby 校验 generation 后启动业务组 最近一次成功同步后的未同步文件可能丢失
Fleet Agent 故障 readiness 失败,旧业务组停止,业务 VIP 迁移 禁止手工绕过 Agent 启动容器
PostgreSQL Primary 故障 Standby 提升;HAProxy 自动路由新主;PG VIP 不变 切换窗口内连接短暂失败;需确认新备库恢复
一个 PG HAProxy 故障 PostgreSQL VIP 漂移到另一个代理 数据库角色不因此改变
当前 Redis 故障 Redis VIP 漂移到另一独立实例 缓存丢失、会话失效可发生
一个 RustFS 节点故障 其余集群节点继续服务 可容忍范围取决于实际纠删码和磁盘状态
一个 RustFS HAProxy 故障 RustFS VIP 漂移到另一代理 S3 地址不变,存量连接可能重连
部署器控制机故障 已运行数据面继续工作 暂时无法部署、集中监控和运维;控制机本身无自动主备
网络分区 当前方案不保证安全自动选主 可能出现双 VIP/双 Active,必须隔离故障侧并人工处理
任意两台同时故障 不作统一可用性承诺 结果取决于两台的角色组合,需逐场景验证

当前方案没有共识系统、租约、leaderEpoch 或 fencing,因此不宣称网络分区下的严格 HA。 它解决的是同一二层网络内的常见单机故障和人工恢复成本问题,产品口径应称为“主备容灾”。

VIP 漂移和 rsync 都不能替代备份。生产环境至少需要:

  • PostgreSQL:独立定时备份、保留策略和恢复演练;

  • RustFS:按实际集群版本设计对象数据保护、磁盘监控和恢复流程;

  • Redis:确认其中仅保存可丢失数据;如果不是,先升级架构再上线;

  • Enterprise 本地 fileset:监控最近成功 generation、同步延迟、失败次数和 Standby 完整性;

  • 部署器:备份数据卷、TLS/登录材料、SSH/Host Key 配置、完整交付包和校验文件;

  • 通用指标:CPU、内存、磁盘容量、inode、磁盘 I/O、网卡错误、容器/服务重启次数;

  • HA 指标:四个 VIP Owner、唯一 Enterprise Active、唯一 PostgreSQL Primary、Standby streaming;

  • 审计:记录部署、切换、重启、密码查看、License 操作和失败恢复。

日常操作和故障处理见 HA 日常运维手册(仓库 doc/ha/operations-guide.md)。

检查项 通过标准
机器数量和角色 六台业务机器 A-F 与计划一致,部署器未混入业务节点
SSH 和 sudo 部署器可使用受控账号免交互访问 A-F,Host Key 已核验
网络与时间 六台同网段,四 VIP 未占用,网卡/前缀正确,时间偏差满足要求
Docker/Compose 六台初始化成功;无旧容器、端口、网络和数据目录冲突
磁盘 PostgreSQL、RustFS、Enterprise fileset 使用计划挂载点,容量和 inode 正常
PostgreSQL 唯一 Primary、Standby streaming、Witness 在线、通过 PG VIP 可读写
Redis C/F 实例健康,通过 Redis VIP 可 PING,已接受切换后数据不复制的边界
RustFS 四节点均健康,通过 RustFS VIP 可完成对象写入、读取和删除
Enterprise D/E/F 版本一致,仅业务 VIP Owner 运行业务组
Fleet Agent 三台 Agent 在线,readiness、同步历史和 generation 状态可检查
License 业务 VIP 激活一次;切换后无需重新激活
App 同步 导入包含 node_modules 的 App,同步完成后切换仍可运行
防火墙 只放行本方案所需来源、目标和协议
备份 PostgreSQL、RustFS 和部署器备份方案已落地并至少完成一次恢复验证
  1. 准备独立部署器控制机、六台业务机器、四个 VIP、网卡和磁盘规划;

  2. 校验完整交付包和 Enterprise 离线 ZIP 的 SHA256;

  3. 启动部署器,录入 SSH 凭据和六台机器并完成连通性检查;

  4. 初始化六台目标机的 Docker/Compose 和离线镜像环境;

  5. 创建“标准部署”,确认 A-F 角色分配和四个 VIP;

  6. 依次部署 PostgreSQL、Redis、RustFS、HAProxy 和 Keepalived;

  7. 建立 D/E/F 专用 rsync 账号和 SSH 信任网;

  8. 部署 D/E/F Enterprise 与 Fleet Agent,确认只有 D 初始 Active;

  9. 通过业务 VIP 完成一次 License 激活并等待 License 同步成功;

  10. 导入测试 App,验证 App、node_modules、Flow/Marimo 和 License fileset 同步;

  11. 分别执行 Enterprise、PostgreSQL、Redis、RustFS 单节点故障演练;

  12. 恢复节点并确认唯一 VIP Owner、唯一 Active、唯一 Primary 和完整同步状态;

  13. 完成备份恢复演练、运维交接和现场参数归档。

具体页面操作见 HA 部署安装流程(仓库 doc/ha/deployment-guide.md),AI 自动化验证用例见 HA 环境测试指南(仓库 doc/fleet/ha-test-guide.md)。

  • 用户仅通过业务 VIP 登录和使用 Enterprise;

  • Enterprise 仅通过 PostgreSQL、Redis、RustFS VIP 访问中间件;

  • D/E/F 任意时刻只有一个 Active,失去业务 VIP 的节点不运行业务组;

  • PostgreSQL 任意时刻只有一个可写 Primary,Witness 不承载业务读写;

  • Redis 和 RustFS 后端切换后,Enterprise 无需修改 .env;

  • License 只激活一次,业务节点切换后不进入激活页;

  • 已完成 generation 的 App、Flow、Marimo 和 License 在新 Active 可用;

  • 故障恢复节点以 Standby 加入,不用旧数据覆盖新 Active。

  • Enterprise Active 单机故障后,业务 VIP 自动漂移并恢复访问;

  • PostgreSQL Primary 故障后,Standby 成为唯一新主,PG VIP 仍可读写;

  • 当前 PG HAProxy 故障后,PG VIP 漂移,Enterprise 数据库连接恢复;

  • 当前 Redis 实例故障后,Redis VIP 漂移,业务能够在允许的数据丢失边界内恢复;

  • 一个 RustFS 节点或一个 RustFS HAProxy 故障后,通过 RustFS VIP 的对象读写恢复;

  • 每次演练后均恢复稳定基线,不遗留双 VIP、双 Active 或双 Primary。

  • 四个 VIP 是否确实位于六台机器可共同持有的同一二层网络;

  • 网络设备是否允许 VRRP/GARP,安全策略是否会阻断 VIP 漂移;

  • 现场是否完全断网;当前部署器仍有 Harbor 可达性检查,需提前验证路由或代理;

  • PostgreSQL、RustFS 和 Enterprise fileset 的容量、增长率、RPO/RTO 目标;

  • Redis 中是否存在不能丢失的数据;若存在,当前双独立实例方案不满足要求;

  • App/Flow/Marimo 的最大文件量、单次变更量和可接受同步延迟;

  • 是否存在跨网段、跨机房、网络分区或任意双机故障的强制可用性要求;

  • 生产证书、域名、密码、License、SSH Key 和审计保管责任人;

  • 部署器控制机的恢复方式、备份周期和替代运维通道。

上述任一项改变,都可能影响 VIP、角色分配、存储和故障边界,必须先更新方案再实施。

当前方案以六台机器、四个固定 VIP 和单活 Enterprise 为核心,把业务入口、数据库入口、 缓存入口和对象存储入口分别解耦。它能够覆盖同网段内常见的单机故障,并显著减少切换后 修改连接配置、重新激活 License 和手工复制 App 文件的工作量。

同时必须接受三个边界:Redis 不复制数据、业务 fileset 为异步同步、网络分区没有共识仲裁。 因此本方案适合定义为 Fleet Center 六机单活主备容灾方案,不应对外承诺零中断、零数据 丢失或跨机房严格高可用。

参考资料

SLA 与高可用边界

标准 Tier0 Enterprise 部署的 SLA 建议、高可用边界、验收门槛、演练和加固项。

本文档适用于六虚拟机全离线部署:三台应用 / Swarm 节点、两台 PostgreSQL 高可用节点和一台 witness 节点。

层级 当前设计 高可用边界
应用运行时 Enterprise New compose 在固定的 tier0_app_active_node 上运行。 backend、redis、EMQX、SourceFlow、EventFlow、Marimo 和 OPC UA Server 尚未自动多副本化。
HTTP 入口 三台应用节点运行 keepalived APP VIP + HAProxy。 VIP 可漂移。HAProxy 转发到活动节点的 8088/TCP,并检查 /healthz。
MQTT / OPC UA EMQX 使用 1883/8883/8083/8084;OPC UA 使用 4840。 这些端口直接连接活动节点,不包含在 TCP VIP 代理中,因此不承诺协议入口高可用。
数据库 PostgreSQL / TimescaleDB 流复制 + repmgr + witness + DB VIP。 primary 故障时 standby 可自动提升。异步复制不能承诺严格零 RPO。
备份与恢复 backup-db.sh / restore-db.sh。 提供可恢复性,但不等同于在线高可用。
服务对象 推荐表述 约束
平台 HTTP 入口 从月可用性 99.5% 开始。 VIP 故障切换不等同于活动应用节点自动迁移。
数据库访问 运维目标:RTO <= 2 minutes。 RPO 取决于复制延迟。同架构历史故障切换测试约为 59-64 秒。
MQTT / OPC UA 当前设计不承诺 HA SLA。 必须先增加 HAProxy TCP 代理、独立 VIP 或服务集群。
备份与恢复 每日备份;重大变更前必须备份。 恢复时间取决于数据量和现场 I/O。

在声明 99.9% 或更高可用性之前,需要完成应用自动迁移或多副本部署、协议入口高可用、监控告警和恢复演练。不要把规划能力描述为已交付能力。

每次部署或升级至少需要满足以下条件:

  • verify-materials.sh 通过,交付包 SHA256 校验通过。
  • 三台 Swarm 节点均为 Ready。
  • APP VIP /healthz 和 /readyz 返回 200,首页和 /uns 可访问。
  • 活动节点上的七个 compose 服务正在运行。
  • DB VIP:5432 可访问,primary、standby 和 witness 拓扑正常。
  • 默认账号可以实际登录。不要只根据端口、容器或 HTTP 200 响应判断 IAM 初始化成功。
  • HTTP、EMQX 端口、WebSocket/WSS 和 OPC UA TCP 冒烟检查通过。

每天运行以下命令:

Terminal window
./bin/verify.sh --site config/site.conf
./bin/smoke-business-emqx.sh --site config/site.conf

至少配置以下告警:

  • APP VIP /healthz 或 /readyz 失败。
  • DB VIP 不可达、无 primary、split-brain 风险、复制中断或复制延迟超过阈值。
  • keepalived、HAProxy、PostgreSQL 或 repmgrd 状态异常。
  • backend、redis、EMQX 等关键容器退出或频繁重启。
  • 数据盘使用率超过 80% / 90%。
  • 最新备份失败或未生成。
演练 频率 验证标准
APP VIP 故障切换 交付前和每季度。 停止当前 VIP 节点上的 keepalived 后,/healthz 和 /readyz 恢复。
DB primary 故障 交付前和每半年。 standby 被提升,DB VIP 恢复,旧 primary 被重建为 standby。
数据库恢复 每月抽样,并在重大变更前执行。 备份可恢复。恢复后 verify、冒烟检查和登录验证通过。
物料验证 每次打包构建。 源物料、包 SHA 和解包验证通过。
  1. 先确认影响范围:HTTP、MQTT、OPC UA、数据库以及单节点影响。
  2. 优先恢复 VIP、HAProxy、活动应用和数据库 primary。
  3. 保留日志、数据目录和备份。不要直接清理或覆盖事故现场。
  4. 对于数据库事件,先确定当前 primary,再决定故障切换、重新加入或恢复。
  5. 恢复后运行 verify、冒烟检查和实际登录验证。
  • 将应用改为多副本,或建立可验证的活动节点自动迁移流程。
  • 将 EMQX 集群化,或通过 HAProxy TCP / TLS 和专用 VIP 路由。
  • 通过 HAProxy TCP、专用 VIP 或服务集群为 OPC UA 提供高可用入口。
  • 使用 PostgreSQL 同步复制,或明确可接受的复制延迟和 RPO。
  • 自动化备份计划、异地复制和定期恢复演练。
  • 将容器、主机、数据库、日志和黑盒探针接入统一告警。

相关流程:运维 Runbook 和 标准端口清单。

参考资料

标准端口清单

标准六虚拟机离线 Tier0 Enterprise 部署的防火墙端口清单。

下表基于 Enterprise New 六虚拟机离线部署。客户防火墙应只允许来自最小必要源网段的流量,不要将这些端口直接暴露到公网。

来源 目标 端口 协议 用途
控制主机 六台目标 VM 22 TCP SSH / Ansible
三台应用节点互通 三台应用节点 2377 TCP Docker Swarm 管理平面
三台应用节点互通 三台应用节点 7946 TCP/UDP Swarm 节点发现
三台应用节点互通 三台应用节点 4789 UDP Swarm overlay 网络
三台应用节点 活动应用节点 8088 TCP HAProxy 转发到 Enterprise New 后端;仅限应用网段
业务网段 APP VIP 80 TCP 平台 HTTP 入口、/healthz、/readyz
业务网段 APP VIP / 活动应用节点 1883 TCP MQTT
业务网段 APP VIP / 活动应用节点 8883 TCP MQTT TLS
业务网段 APP VIP / 活动应用节点 8083 TCP MQTT WebSocket
业务网段 APP VIP / 活动应用节点 8084 TCP MQTT WebSocket TLS
业务网段 APP VIP / 活动应用节点 4840 TCP OPC UA Server
受控应用网段 活动应用节点 8089 TCP 应用中心
动态应用访问网段 活动应用节点 30000-30199 TCP App Gateway / 动态应用主机端口
应用节点、DB 节点和 Witness DB VIP / DB 节点 5432 TCP PostgreSQL / TimescaleDB
DB1、DB2 和 Witness DB1、DB2 和 Witness 5432 TCP Streaming replication / repmgr
应用节点 NFS server 2049 TCP/UDP NFS_ENABLED=true 时使用

当前 compose 部署不会对外暴露 Redis、SourceFlow、EventFlow、Marimo 或 EMQX Dashboard。这些服务只由 Docker runtime 网络内的后端调用。

参考资料

运维 Runbook

标准 Tier0 Enterprise 部署的日常巡检、故障切换、备份、恢复、清理和故障排查流程。

本文档基于 Enterprise New 离线应用。

  1. 在部署包根目录运行以下命令:
    Terminal window
    ./bin/verify.sh --site config/site.conf
    ./bin/smoke-business-emqx.sh --site config/site.conf
  2. 确认以下项目:
    • 3 台 Swarm 节点均为 Ready。
    • APP VIP /healthz 和 /readyz 返回 200。
    • DB VIP:5432 可访问。
    • PostgreSQL primary、standby 和 witness 拓扑正常。
    • backend、redis、emqx、sourceflow、eventflow、marimo 和 opcua-server 都运行在活动应用节点上。
  1. 在活动应用节点上运行以下命令:

    Terminal window
    cd /opt/tier0-enterprise/tier0-deploy
    bash bin/compose.sh ps
    bash bin/compose.sh logs --tail=200 backend
    curl -fsS http://127.0.0.1:8088/healthz
    curl -fsS http://127.0.0.1:8088/readyz
  2. 健康检查解读:

    • healthz 失败:先检查 backend 进程、镜像和容器日志。
    • readyz 失败:同时检查 DB VIP、Redis 和数据库迁移日志。
    • 首页可访问但无法登录:确认 .env 中的 ADMIN_INITIAL_PASSWORD,然后检查 backend IAM migration 日志和用户表。不要只根据 HTTP 端口判断部署成功。
Terminal window
nc -vz <APP_VIP> 1883
nc -vz <APP_VIP> 8883
nc -vz <APP_VIP> 8083
nc -vz <APP_VIP> 8084
nc -vz <APP_VIP> 4840

在数据库节点上运行:

Terminal window
systemctl status tier0-postgresql
systemctl status tier0-repmgrd
sudo -iu postgres psql -Atqc 'select pg_is_in_recovery();'
sudo -iu postgres /usr/local/bin/repmgr -f /etc/repmgr.conf cluster show
  • pg_is_in_recovery=false 表示 primary。
  • pg_is_in_recovery=true 表示 standby。
  • DB VIP 只能位于当前 primary 上。
  • 如果 standby 复制中断,或 witness 报告上游错误,先保护现场。不要直接重新运行完整部署。
  1. 测试前,记录当前持有 VIP 的节点并验证:

    Terminal window
    curl -fsS http://<APP_VIP>/healthz
    curl -fsS http://<APP_VIP>/readyz
  2. 停止当前 VIP 节点上的 keepalived 后,确认 VIP 被其他应用节点接管,然后重新测试两个 URL。HAProxy backend 指向活动应用节点的 8088/TCP,因此三台应用节点都必须能访问活动节点的 8088 端口。

  3. 恢复 keepalived 后,再次运行 verify.sh 和 smoke checks。演练期间不要停止活动应用容器。

故障演练前,创建备份并确认复制健康:

Terminal window
./bin/backup-db.sh --site config/site.conf

停止当前 primary 上的 tier0-postgresql 后,观察 repmgr 提升 standby,并确认 DB VIP 接管。目标 RTO 为 2 分钟内。同架构历史测试约为 59-64 秒。

  • 备份:

    Terminal window
    ./bin/backup-db.sh --site config/site.conf
  • 恢复:

    Terminal window
    ./bin/restore-db.sh --site config/site.conf --restore-file /backup/tier0-db/postgres-YYYYmmddTHHMMSS.dump
Terminal window
./full-cleanup.sh --env install.env --yes
./install.sh --auto --yes
Terminal window
cd /opt/tier0-enterprise/tier0-deploy
bash bin/compose.sh logs --tail=300 backend
bash bin/compose.sh ps
Terminal window
cd /opt/tier0-enterprise/tier0-deploy
bash bin/compose.sh logs --tail=200 emqx
Terminal window
systemctl status tier0-repmgrd
tail -100 /var/log/repmgr/repmgr.log
sudo -iu postgres psql -Atqc 'show shared_preload_libraries;'
Terminal window
./bin/verify-materials.sh
参考资料

OpenAPI 参考附录

Tier0 OpenAPI v1 · 操作: 36 · 架构: 85

操作

API 字段名、示例及源描述沿用随附的英文 OpenAPI 规范。

UNS

读取、写入和管理统一命名空间数据。

POST/uns/attachments

Upload a UNS attachment

Uploads a multipart attachment for a UNS node. Supply a file and at least one of unsId or topic; a valid unsId takes precedence.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/attachments' \
  --header 'x-api-key: <api-key>'

multipart/form-data

字段类型必填描述
unsIdinteger (int64)否Numeric owner node ID. Supply unsId or topic; a valid unsId takes precedence.
topicstring否Full owner node path, used when a valid unsId is not supplied.
fileNamestring否Original file name.
sha256string否SHA-256 checksum of the file contents.
filestring (binary)是Binary file contents. The multipart field name must be file.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "unsId": 0,
    "fileName": "string",
    "filePath": "string",
    "fileUrl": "string",
    "contentType": "string"
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否UnsAttachmentUploadResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/attachments/list

List UNS attachments

Lists attachments for a UNS node or topic. Temporary file URLs can expire and must then be requested again.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/attachments/list' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"unsId":0,"topic":"string","page":0,"size":0,"includeFileUrl":false}'

application/json

字段类型必填描述
unsIdinteger (int64)否Numeric UNS node ID.
topicstring否Full UNS topic path.
pageinteger (int64)否Page number, starting at 1.
sizeinteger (int64)否Number of attachments per page.
includeFileUrlboolean (boolean)否Whether to return temporary file URLs. Defaults to true.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "unsId": 0,
    "list": [
      "value"
    ],
    "total": 0,
    "page": 0,
    "size": 0
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否UnsAttachmentListResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/browse

Browse the UNS tree

Returns a UNS subtree. Use an empty path for the workspace root.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/browse' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"path":"string","max_depth":0,"include_metadata":false,"include_leaf_value":false}'

application/json

字段类型必填描述
pathstring否Root UNS path. Empty means the workspace root.
max_depthinteger (int64)否Maximum tree depth. Omit or use 0 for the server default.
include_metadataboolean (boolean)否Whether returned nodes should include metadata.
include_leaf_valueboolean (boolean)否Whether returned leaf nodes should include their latest payload.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "tree": [
      "value"
    ]
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否BrowseResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/create

Create UNS nodes

Creates UNS nodes and nested subtrees. Check each item result and use the returned topic in subsequent calls.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/create' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"namespace":[{"name":"value","type":"value","children":"value","topicType":"value","fields":"value"}]}'

application/json

字段类型必填描述
namespacearray<object>是UNS nodes to create. Nest children to create a subtree.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false,
    "results": [
      "value"
    ]
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否CreateResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/delete

Delete UNS nodes

Deletes the listed nodes sequentially. By default this is a soft delete; the batch is not rolled back when a later item fails.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/delete' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"topics":["string"],"hard_delete":false}'

application/json

字段类型必填描述
topicsarray<string>是UNS topic or path node paths to delete.
hard_deleteboolean (boolean)否Permanently delete instead of moving nodes to the recycle state.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否OpenapiEmptyResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/history

Query UNS history

Queries historical topic values over an inclusive RFC 3339 time range. Results can be aggregated or sampled.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/history' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"topics":["string"],"start_time":"string","end_time":"string","aggregation":{"interval":"string","function":"string","field":"string","fields":["value"]},"page":0}'

application/json

字段类型必填描述
topicsarray<string>是UNS topic paths whose history should be queried.
start_timestring是Inclusive query start in RFC 3339 format.
end_timestring是Inclusive query end in RFC 3339 format.
aggregationobject否HistoryAggregation. 请参阅架构章节中的引用架构。
pageinteger (int64)否Page number, starting from 1.
sizeinteger (int64)否Page size; values above the server maximum are capped.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false,
    "results": [
      "value"
    ],
    "page": 0,
    "size": 0,
    "total": 0
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否HistoryResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/read

Read UNS values

Returns value, quality, and timeStamp (VQT) for each requested topic. A failed topic does not discard successful items in the same batch.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/read' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"topics":["string"],"include_metadata":false,"include_leaf_value":false}'

application/json

字段类型必填描述
topicsarray<string>是UNS topic paths to read.
include_metadataboolean (boolean)否Whether each result should include UNS node metadata.
include_leaf_valueboolean (boolean)否Whether leaf nodes should include their latest payload.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false,
    "results": [
      "value"
    ]
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否ReadResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/restore

Restore a deleted UNS node

Restores a soft-deleted UNS node. Permanently deleted nodes cannot be restored.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/restore' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"path":"string"}'

application/json

字段类型必填描述
pathstring是Full UNS path of the node to restore. Use its path before deletion, not a node ID or HTTP URL.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否OpenapiEmptyResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/search

Search UNS nodes

Searches UNS node names, aliases, and paths, with optional type and path filters.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/search' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"keyword":"string","topicType":"string","path_prefix":"string","include_metadata":false,"include_leaf_value":false}'

application/json

字段类型必填描述
keywordstring否Keyword matched against UNS node names, aliases, and paths.
topicTypestring否Topic data category filter: STATE, ACTION, or METRIC.
path_prefixstring否Only return nodes under this UNS path prefix.
include_metadataboolean (boolean)否Whether returned nodes should include metadata.
include_leaf_valueboolean (boolean)否Whether returned leaf nodes should include their latest payload.
pageinteger (int64)否Page number, starting from 1.
sizeinteger (int64)否Page size.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "objects": [
      "value"
    ],
    "page": 0,
    "size": 0,
    "total": 0
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否SearchResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/unsBindFlow

Bind a flow to a UNS node

Binds a flow ID to a UNS node ID.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/unsBindFlow' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"unsId":0,"flowId":0}'

application/json

字段类型必填描述
unsIdinteger (int64)是UNS node ID to bind.
flowIdinteger (int64)是Flow ID to bind.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false,
    "unsId": 0,
    "flowId": 0
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否UnsBindFlowResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/update

Update a UNS node

Updates an existing UNS node. Empty strings, an empty fields array, and an empty extendProperties object retain existing values.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/update' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"path":"string","name":"string","description":"string","displayName":"string","extendProperties":{}}'

application/json

字段类型必填描述
pathstring是Existing UNS topic or path node to update.
namestring否New node name.
descriptionstring否Updated node description.
displayNamestring否Updated display name.
extendPropertiesobject否Updated custom metadata key-value pairs.
fieldsarray<object>否Updated payload schema fields.
aliasstring否Updated topic alias.
enableHistoryboolean (boolean)否Supply true or false to change history storage. Omit to keep the existing setting.
updateMaskarray<string>否Compatibility field ignored by the current Enterprise implementation. It cannot be used to clear fields.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否OpenapiEmptyResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/uns/write

Write UNS values

Writes values to existing TOPIC nodes; wildcards are not supported. `value` must match the node payload schema. **Batch results:** check each `data.results` item, not only HTTP 200. **Retry:** confirm the outcome before retrying a write.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/uns/write' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"writes":[{"topic":"value","value":"value","timeStamp":"value"}],"qos":0,"retain":false}'

application/json

字段类型必填描述
writesarray<object>是Write operations to apply.
qosinteger (int64)否MQTT QoS: 0, 1, or 2.
retainboolean (boolean)否Whether the MQTT message should be retained.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "success": false,
    "results": [
      "value"
    ]
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否WriteResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200Inspect the success flag of each `data.results` item. HTTP 200 alone does not confirm that every write succeeded.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

文件资源

上传、下载和管理存储文件。

POST/assets/files

Create a direct-upload form

Issues an object-store upload form; it does not transfer file contents. Submit every returned post field unchanged with the file.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/assets/files' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"fileName":"string","contentType":"string","size":0,"business":"string","useBy":"string"}'

application/json

字段类型必填描述
fileNamestring是Original file name.
contentTypestring否MIME content type.
sizeinteger (int64)是File size in bytes. Business validation requires a value greater than 0 and at most 1 GiB.
businessstring否Business domain or feature associated with the file.
useBystring否Optional usage category: user, workspace, or platform.
visibilitystring否File visibility, such as private or public.
appInstanceIdstring否Associated application instance ID.
sessionIdstring否Caller session ID.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "fileId": 0,
    "filePath": "string",
    "fileUrl": "string",
    "uploadUrl": "string",
    "expiresAt": 0
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AssetFileUploadResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/assets/files/delete

Delete a file

Deletes a file identified by its server-issued storage path.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/assets/files/delete' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"filePath":"string"}'

application/json

字段类型必填描述
filePathstring是Server-issued storage path returned by an upload API.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "deleted": false
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AssetFileDeleteResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

GET/assets/files/download

Download a private file

Returns file bytes directly. Do not forward x-api-key or other credentials when a client follows a redirect to a cross-origin storage URL.

请求参数
名称位置类型必填描述
filePathquerystring是Server-issued storage path returned by an upload API.
responseContentDispositionquerystring否Optional Content-Disposition value for the download response.
响应
302400401403404409413500
响应状态含义
状态含义媒体类型
302Redirect to the final download URL.—
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/assets/files/multipart/abort

Abort a multipart upload

Cancels a multipart upload session.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/assets/files/multipart/abort' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"fileKey":"string","uploadId":"string"}'

application/json

字段类型必填描述
fileKeystring是Object-store key used for the multipart upload.
uploadIdstring是Object-store multipart upload session ID.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "aborted": 1
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AssetFileMultipartAbortResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/assets/files/multipart/complete

Complete a multipart upload

Completes a multipart upload after every uploaded part number and ETag have been supplied.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/assets/files/multipart/complete' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"fileKey":"string","uploadId":"string","parts":[{"partNumber":"value","etag":"value"}]}'

application/json

字段类型必填描述
fileKeystring是Object-store key used for the multipart upload.
uploadIdstring是Object-store multipart upload session ID.
partsarray<object>是Uploaded part numbers and their ETags.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "filePath": "string",
    "fileUrl": "string",
    "sizeBytes": 0,
    "expiresAt": 0
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AssetFileMultipartCompleteResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/assets/files/multipart/init

Initialize a multipart upload

Creates a multipart upload session and returns its ID, part size, and part count.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/assets/files/multipart/init' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"fileName":"string","contentType":"string","size":0,"partSize":0,"business":"string"}'

application/json

字段类型必填描述
fileNamestring是Original file name.
contentTypestring否File MIME type, for example application/octet-stream.
sizeinteger (int64)是Total file size in bytes, greater than 0 and at most 1 GiB.
partSizeinteger (int64)否Preferred part size in bytes. The server may normalize it.
businessstring否Business domain or feature associated with the file.
useBystring否Optional usage category: user, workspace, or platform.
visibilitystring否File visibility: private or public.
appInstanceIdstring否Associated application instance ID.
sessionIdstring否Caller session ID.
bizIdstring否Associated business identifier.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "fileKey": "string",
    "filePath": "string",
    "uploadId": "string",
    "partSize": 0,
    "partCount": 0
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AssetFileMultipartInitResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/assets/files/multipart/part-urls

Create multipart upload URLs

Returns presigned PUT URLs for the requested one-based part numbers.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/assets/files/multipart/part-urls' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"fileKey":"string","uploadId":"string","partNumbers":[0]}'

application/json

字段类型必填描述
fileKeystring是Object-store key used for the multipart upload.
uploadIdstring是Object-store multipart upload session ID.
partNumbersarray<integer (int32)>是One-based part numbers to sign.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "partUrls": [
      "value"
    ]
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AssetFileMultipartPartUrlsResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

GET/assets/files/public

Download a public file

Downloads bytes for a file explicitly marked public. An unguessable path is not authorization; do not mark sensitive files public.

请求参数
名称位置类型必填描述
filePathquerystring是Server-issued storage path returned by an upload API.
responseContentDispositionquerystring否Optional Content-Disposition value for the download response.
响应
200400404409413500
响应状态含义
状态含义媒体类型
200Returns file bytes directly. Content-Type depends on the file type; no JSON envelope is used.—
400Correct the request parameters or Content-Type before retrying.application/json
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

GET/assets/files/url

Create a temporary file URL

Creates a temporary URL for a file.

请求参数
名称位置类型必填描述
filePathquerystring是Server-issued storage path returned by an upload API.
expiredSecqueryinteger (int64)否Requested temporary URL lifetime in seconds.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "fileUrl": "string",
    "expiresAt": 0
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AssetFileUrlResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/assets/upload

Create a legacy asset upload URL

Legacy compatibility endpoint. The current Enterprise implementation returns an empty uploadUrl; use /assets/files for new integrations.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/assets/upload' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"fileName":"string","sizeBytes":0,"contentType":"string","size":0,"sha256":"string"}'

application/json

字段类型必填描述
fileNamestring是Original file name.
sizeBytesinteger (int64)是File size in bytes.
contentTypestring否File MIME type, for example application/octet-stream.
sizeinteger (int64)否File size in bytes.
sha256string否Optional SHA-256 checksum of the file content.
storageKeystring否Optional object-store key. Omit it to let the server generate one.
isPublicboolean (boolean)否Whether the file should be accessible through the public download endpoint.
businessstring否Business domain or feature that owns the uploaded file.
useBystring否Usage scenario or owner category for the uploaded file.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "msg": "string",
  "data": {
    "uploadUrl": "string",
    "filePath": "string",
    "fileUrl": "string"
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
msgstring否Response message
dataobject否AssetUploadResp. 请参阅架构章节中的引用架构。
响应状态含义
状态含义媒体类型
200Legacy upload response. The current Enterprise implementation returns an empty uploadUrl; use /assets/files for new integrations.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

身份认证

验证当前 OpenAPI 身份与权限。

POST/auth/whoami

Inspect the current API key identity

Returns the current API-key identity and its effective permissions. Call this before integration work to verify access.

响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "userID": 0,
    "userName": "string",
    "email": "string",
    "workspaceID": 0,
    "workspaceName": "string"
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否AuthWhoamiResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

Flow

管理 Source Flow 与 Event Flow 定义。

POST/flow/create

Create a flow

Creates a SourceFlow or EventFlow and returns its numeric resource ID.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/create' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"flowName":"string","flowType":"string","description":"string","template":"string"}'

application/json

字段类型必填描述
flowNamestring是Flow name, up to 63 Unicode characters.
flowTypestring是Flow category: SourceFlow or EventFlow.
descriptionstring否Flow description.
templatestring否Optional flow template JSON.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "id": 0,
    "brokerID": "string"
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowCreateResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/flow/delete

Delete flows

Deletes the listed flows sequentially; earlier deletions are not rolled back when a later item fails.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/delete' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"ids":[0]}'

application/json

字段类型必填描述
idsarray<integer (int64)>是Flow IDs to delete.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "success": false
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowEmptyResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/flow/deploy

Deploy a flow

Deploys a complete Node-RED canvas JSON string to a flow.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/deploy' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"id":0,"flowsJson":"string"}'

application/json

字段类型必填描述
idinteger (int64)是Flow ID to deploy.
flowsJsonstring是Node-RED canvas JSON to deploy.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "flowId": "string"
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowDeployResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/flow/flowdata

Get flow canvas data

Returns the Node-RED canvas revision and node objects for a flow.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/flowdata' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"id":0}'

application/json

字段类型必填描述
idinteger (int64)是Flow ID.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "rev": "string",
    "flows": [
      "value"
    ]
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowDataResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/flow/get

Get a flow

Returns flow metadata for a numeric flow ID.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/get' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"id":0}'

application/json

字段类型必填描述
idinteger (int64)是Flow ID.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "id": 0,
    "flowId": "string",
    "flowName": "string",
    "flowType": "string",
    "flowStatus": "string"
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowInfo. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/flow/list

List flows

Lists flows, optionally filtered by a keyword or flow category.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/list' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"keyword":"string","flowType":"string"}'

application/json

字段类型必填描述
keywordstring否Keyword matched against flow names and descriptions.
flowTypestring否Flow category filter: SourceFlow or EventFlow.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 200,
  "msg": "success",
  "data": {
    "list": [
      {
        "id": 101,
        "flowId": "flow-101",
        "flowName": "Line 1 collector",
        "flowType": "source",
        "flowStatus": "draft",
        "template": "[]",
        "description": "Collects line telemetry",
        "isFavorite": 2,
        "currentVersionId": 0,
        "currentVersionName": "",
        "currentVersionType": "",
        "createdTime": 1788134400000,
        "updatedTime": 1788134400000
      }
    ]
  }
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowListResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/flow/nodes

List available flow node types

Returns the Node-RED node sets available for a flow category.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/nodes' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"flowType":"string"}'

application/json

字段类型必填描述
flowTypestring是Flow category whose Node-RED node catalog should be returned.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "nodes": [
      "value"
    ]
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowNodesResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/flow/update

Update a flow

Updates flow metadata and settings for a numeric flow ID.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/flow/update' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"id":0,"flowName":"string","description":"string","template":"string","isFavorite":0}'

application/json

字段类型必填描述
idinteger (int64)是Flow ID to update.
flowNamestring否Updated flow name.
descriptionstring否Updated flow description.
templatestring否Updated flow template JSON.
isFavoriteinteger (int64)否Favorite state: 1 for favorite, 2 for not favorite.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "success": false
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否FlowEmptyResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

平台与项目

读取平台信息并管理项目。

POST/info

Get service information

Returns the service name, version, reported capabilities, and configured MQTT broker.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/info' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{}'

application/json

OpenAPI 未声明此请求体的对象字段。

响应
200400401403404409413500
响应状态含义
状态含义媒体类型
200A successful response.—
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/launchpad/{projectName}/getMembers

List project members

Lists Launchpad project members. URL-encode projectName when it contains special characters.

请求参数
名称位置类型必填描述
projectNamepathstring是Project name in the Launchpad URL. URL-encode special characters.
请求体
curl --request POST 'https://<tier0-host>/openapi/v1/launchpad/{projectName}/getMembers' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"roleKey":"string","roles":["string"],"updatedAtStart":"string","updatedAtEnd":"string","page":0}'

application/json

字段类型必填描述
roleKeystring否Role key filter.
rolesarray<string>否Role filters or the returned role list, depending on the model.
updatedAtStartstring否Inclusive update-time lower bound in RFC 3339 format.
updatedAtEndstring否Inclusive update-time upper bound in RFC 3339 format.
pageinteger (int64)否Page number, starting at 1.
sizeinteger (int64)否Number of members per page.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "list": [
      "value"
    ],
    "total": 0,
    "page": 0,
    "size": 0
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否LaunchpadMembersResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/platform/getMembers

List platform members

Lists platform members with optional keyword, role, status, and update-time filters.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/platform/getMembers' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"keyword":"string","roleKey":"string","roles":["string"],"statuses":["string"],"updatedAtStart":"string"}'

application/json

字段类型必填描述
keywordstring否Search keyword.
roleKeystring否Role key filter.
rolesarray<string>否Role filters or the returned role list, depending on the model.
statusesarray<string>否Member status filters: active or disabled.
updatedAtStartstring否Inclusive update-time lower bound in RFC 3339 format.
updatedAtEndstring否Inclusive update-time upper bound in RFC 3339 format.
pageinteger (int64)否Page number, starting at 1.
sizeinteger (int64)否Number of members per page.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "list": [
      "value"
    ],
    "total": 0,
    "page": 0,
    "size": 0
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否PlatformMembersResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

MQTT 身份认证

创建和删除 MQTT 凭据。

POST/mqtt-auth/create

Create an MQTT credential

Creates a normal MQTT credential. The returned password is available only once and must be stored securely immediately.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/mqtt-auth/create' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"name":"string","description":"string","clientIDRandomSuffixEnabled":false}'

application/json

字段类型必填描述
namestring是MQTT credential name.
descriptionstring否Description of the MQTT credential.
clientIDRandomSuffixEnabledboolean否Whether to append a random suffix to the MQTT client ID.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "id": 0,
    "name": "string",
    "clientID": "string",
    "username": "string",
    "password": "string"
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否MqttAuthCreateResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

POST/mqtt-auth/delete

Delete an MQTT credential

Idempotently deletes a normal MQTT credential. System credentials are not deleted.

请求体
curl --request POST 'https://<tier0-host>/openapi/v1/mqtt-auth/delete' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{"id":0}'

application/json

字段类型必填描述
idinteger (int64)是Resource ID.
响应
200400401403404409413500
成功响应示例

200 · application/json

{
  "code": 0,
  "data": {
    "success": false
  },
  "msg": "string"
}
成功响应字段

200 · application/json

字段类型必填描述
codeinteger否Response code
dataobject否MqttAuthDeleteResp. 请参阅架构章节中的引用架构。
msgstring否Response message
响应状态含义
状态含义媒体类型
200A successful response.application/json
400Correct the request parameters or Content-Type before retrying.application/json
401Authentication middleware returns plain-text unauthorized. Check API key validity, scope, and owner roles.text/plain
403Authentication middleware returns plain-text forbidden. Check API key validity, scope, and owner roles.text/plain
404Resource not found. Verify paths, IDs, and current resource state.—
409Resource state conflict. Verify paths, IDs, and current resource state.—
413Request too large. Reduce the request before retrying.—
500Service error. Investigate the service and confirm the outcome before retrying.—

架构

API 字段名、示例及源描述沿用随附的英文 OpenAPI 规范。

AssetFileDeleteReq

字段类型必填描述
filePathstring是Server-issued storage path returned by an upload API.

AssetFileDeleteResp

字段类型必填描述
deletedboolean是Whether the file was deleted.

AssetFileMultipartAbortReq

字段类型必填描述
fileKeystring是Object-store key used for the multipart upload.
uploadIdstring是Object-store multipart upload session ID.

AssetFileMultipartAbortResp

字段类型必填描述
abortedinteger (int32)是Abort result: 1 = aborted (including idempotent replay success), 2 = not aborted.

AssetFileMultipartCompleteReq

字段类型必填描述
fileKeystring是Object-store key used for the multipart upload.
uploadIdstring是Object-store multipart upload session ID.
partsarray<object>是Uploaded part numbers and their ETags.

AssetFileMultipartCompleteResp

字段类型必填描述
filePathstring是Server-issued storage path returned by an upload API.
fileUrlstring否File access URL.
sizeBytesinteger (int64)是File size in bytes.
expiresAtinteger (int64)否Expiration time, in Unix milliseconds.

AssetFileMultipartInitReq

字段类型必填描述
fileNamestring是Original file name.
contentTypestring否File MIME type, for example application/octet-stream.
sizeinteger (int64)是Total file size in bytes, greater than 0 and at most 1 GiB.
partSizeinteger (int64)否Preferred part size in bytes. The server may normalize it.
businessstring否Business domain or feature associated with the file.
useBystring否Optional usage category: user, workspace, or platform.
visibilitystring否File visibility: private or public.
appInstanceIdstring否Associated application instance ID.
sessionIdstring否Caller session ID.
bizIdstring否Associated business identifier.

AssetFileMultipartInitResp

字段类型必填描述
fileKeystring是Object-store key used for the multipart upload.
filePathstring是Server-issued storage path returned by an upload API.
uploadIdstring是Object-store multipart upload session ID.
partSizeinteger (int64)是Part size in bytes; the server may normalize it.
partCountinteger (int64)是Total number of upload parts.
expiresAtinteger (int64)是Expiration time, in Unix milliseconds.

AssetFileMultipartPart

字段类型必填描述
partNumberinteger (int32)是Part number, starting at 1.
etagstring是ETag returned after uploading this part.

AssetFileMultipartPartUrl

字段类型必填描述
partNumberinteger (int32)是Part number, starting at 1.
urlstring是Presigned PUT URL for this part.
expiresAtinteger (int64)是Expiration time, in Unix milliseconds.

AssetFileMultipartPartUrlsReq

字段类型必填描述
fileKeystring是Object-store key used for the multipart upload.
uploadIdstring是Object-store multipart upload session ID.
partNumbersarray<integer (int32)>是One-based part numbers to sign.

AssetFileMultipartPartUrlsResp

字段类型必填描述
partUrlsarray<object>是Presigned URLs for the requested parts.

AssetFileUploadReq

字段类型必填描述
fileNamestring是Original file name.
contentTypestring否MIME content type.
sizeinteger (int64)是File size in bytes. Business validation requires a value greater than 0 and at most 1 GiB.
businessstring否Business domain or feature associated with the file.
useBystring否Optional usage category: user, workspace, or platform.
visibilitystring否File visibility, such as private or public.
appInstanceIdstring否Associated application instance ID.
sessionIdstring否Caller session ID.

AssetFileUploadResp

字段类型必填描述
fileIdinteger (int64)否File ID.
filePathstring是Server-issued storage path returned by an upload API.
fileUrlstring否File access URL.
uploadUrlstring是Upload URL; the legacy Enterprise endpoint currently returns an empty string.
expiresAtinteger (int64)否Expiration time, in Unix milliseconds.

AssetFileUrlResp

字段类型必填描述
fileUrlstring是File access URL.
expiresAtinteger (int64)否Expiration time, in Unix milliseconds.

AssetUploadReq

AssetUploadReq

字段类型必填描述
fileNamestring是Original file name.
sizeBytesinteger (int64)是File size in bytes.
contentTypestring否File MIME type, for example application/octet-stream.
sizeinteger (int64)否File size in bytes.
sha256string否Optional SHA-256 checksum of the file content.
storageKeystring否Optional object-store key. Omit it to let the server generate one.
isPublicboolean (boolean)否Whether the file should be accessible through the public download endpoint.
businessstring否Business domain or feature that owns the uploaded file.
useBystring否Usage scenario or owner category for the uploaded file.

AssetUploadResp

AssetUploadResp

字段类型必填描述
uploadUrlstring是Upload URL; the legacy Enterprise endpoint currently returns an empty string.
filePathstring是Server-issued storage path returned by an upload API.
fileUrlstring否File access URL.

AuthWhoamiResp

字段类型必填描述
userIDinteger (int64)是Numeric ID of the API key owner.
userNamestring是User name.
emailstring是Email address.
workspaceIDinteger (int64)是Platform workspace ID.
workspaceNamestring是Workspace name; may be empty in Enterprise.
apiKeyNamestring是Name of the current API key.
keyPrefixstring是API key prefix.
permissionsarray<string>是Effective permissions of the current identity.
rolesarray<string>是Role filters or the returned role list, depending on the model.
keyTypestring是API key ownership type, for example personal.

BrowseReq

BrowseReq

字段类型必填描述
pathstring否Root UNS path. Empty means the workspace root.
max_depthinteger (int64)否Maximum tree depth. Omit or use 0 for the server default.
include_metadataboolean (boolean)否Whether returned nodes should include metadata.
include_leaf_valueboolean (boolean)否Whether returned leaf nodes should include their latest payload.

BrowseResp

BrowseResp

字段类型必填描述
treearray<object>是UNS node tree.

CreateResp

CreateResp

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
resultsarray<object>是Per-item results. Check success and error for each item.

FlowCreateReq

字段类型必填描述
flowNamestring是Flow name, up to 63 Unicode characters.
flowTypestring是Flow category: SourceFlow or EventFlow.
descriptionstring否Flow description.
templatestring否Optional flow template JSON.

FlowCreateResp

字段类型必填描述
idinteger (int64)是Resource ID.
brokerIDstring是ID of the MQTT broker configuration node injected when the flow is created.

FlowDataResp

字段类型必填描述
revstring是Node-RED canvas revision; may be an empty string.
flowsarray<object>是Array of Node-RED canvas node objects.

FlowDeleteReq

字段类型必填描述
idsarray<integer (int64)>是Flow IDs to delete.

FlowDeployReq

字段类型必填描述
idinteger (int64)是Flow ID to deploy.
flowsJsonstring是Node-RED canvas JSON to deploy.

FlowDeployResp

字段类型必填描述
flowIdstring是Flow identifier.

FlowEmptyResp

字段类型必填描述
successboolean是Whether the operation succeeded.

FlowGetReq

字段类型必填描述
idinteger (int64)是Flow ID.

FlowInfo

字段类型必填描述
idinteger (int64)是Resource ID.
flowIdstring是Flow identifier.
flowNamestring是Flow name.
flowTypestring是Response flow type: source or event.
flowStatusstring是Current flow status, for example draft.
templatestring是Flow template JSON, encoded as a string.
descriptionstring是Description.
isFavoriteinteger (int64)是Favorite state: 1 for favorite, 2 for not favorite.
currentVersionIdinteger (int64)是Current version ID; 0 if unset.
currentVersionNamestring是Current version name; empty if unset.
currentVersionTypestring是Current version type; empty if unset.
createdTimeinteger (int64)是Creation time, in Unix milliseconds.
updatedTimeinteger (int64)是Last update time, in Unix milliseconds.

FlowListReq

字段类型必填描述
keywordstring否Keyword matched against flow names and descriptions.
flowTypestring否Flow category filter: SourceFlow or EventFlow.

FlowListResp

字段类型必填描述
listarray<object>是Result list.

FlowNodesReq

字段类型必填描述
flowTypestring是Flow category whose Node-RED node catalog should be returned.

FlowNodesResp

字段类型必填描述
nodesarray<object>是Available Node-RED node sets.

FlowUpdateReq

字段类型必填描述
idinteger (int64)是Flow ID to update.
flowNamestring否Updated flow name.
descriptionstring否Updated flow description.
templatestring否Updated flow template JSON.
isFavoriteinteger (int64)否Favorite state: 1 for favorite, 2 for not favorite.

HistoryAggregation

HistoryAggregation

字段类型必填描述
intervalstring是Positive aggregation window, such as 1m, 5m, 1h, or 1d.
functionstring否Aggregation function: avg, min, max, sum, count, first, or last.
fieldstring否First-level payload field to aggregate.
fieldsarray<object>否Per-field aggregation settings.

HistoryAggregationField

HistoryAggregationField

字段类型必填描述
namestring是Payload field to aggregate.
functionstring否Function for this field; defaults to the outer aggregation function.

HistoryQueryMeta

HistoryQueryMeta

字段类型必填描述
aggregatedboolean (boolean)是Whether the result was aggregated.
sampledboolean (boolean)是Whether the result was sampled.
rawTotalinteger (int64)是Total number of raw records.
returnedTotalinteger (int64)是Number of records returned in this response.
requestedIntervalMsinteger (int64)否Requested aggregation interval in milliseconds.
actualIntervalMsinteger (int64)否Actual aggregation interval in milliseconds.
strategystring否Processing strategy used for the query.

HistoryReq

HistoryReq

字段类型必填描述
topicsarray<string>是UNS topic paths whose history should be queried.
start_timestring是Inclusive query start in RFC 3339 format.
end_timestring是Inclusive query end in RFC 3339 format.
aggregationobject否HistoryAggregation. 请参阅架构章节中的引用架构。
pageinteger (int64)否Page number, starting from 1.
sizeinteger (int64)否Page size; values above the server maximum are capped.

HistoryResp

HistoryResp

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
resultsarray<object>是Per-item results. Check success and error for each item.
pageinteger (int64)是Page number, starting at 1.
sizeinteger (int64)是File size in bytes.
totalinteger (int64)是Total number of matching records.

InfoReq

{
  "type": "object",
  "properties": {}
}

LaunchpadGetMembersReq

字段类型必填描述
roleKeystring否Role key filter.
rolesarray<string>否Role filters or the returned role list, depending on the model.
updatedAtStartstring否Inclusive update-time lower bound in RFC 3339 format.
updatedAtEndstring否Inclusive update-time upper bound in RFC 3339 format.
pageinteger (int64)否Page number, starting at 1.
sizeinteger (int64)否Number of members per page.

LaunchpadMemberResp

字段类型必填描述
memberIdstring是Member identifier.
userIdstring是User ID.
userNamestring否User name.
emailstring否Email address.
rolesarray<object>是Role filters or the returned role list, depending on the model.
updatedAtstring否Last update time.

LaunchpadMemberRoleAppResp

字段类型必填描述
appIdstring是Application ID, represented as a string.
appNamestring是Application name.

LaunchpadMemberRoleResp

字段类型必填描述
roleIdstring是Role ID, represented as a string.
roleKeystring是Role key filter.
roleNamestring否Role display name.
descriptionstring否Description.
memberCountinteger (int64)是Number of members assigned to the role.
appsarray<object>否Applications associated with the role.

LaunchpadMembersResp

字段类型必填描述
listarray<object>是Result list.
totalinteger (int64)是Total number of matching records.
pageinteger (int64)是Page number, starting at 1.
sizeinteger (int64)是File size in bytes.

MqttAuthCreateReq

字段类型必填描述
namestring是MQTT credential name.
descriptionstring否Description of the MQTT credential.
clientIDRandomSuffixEnabledboolean否Whether to append a random suffix to the MQTT client ID.

MqttAuthCreateResp

字段类型必填描述
idinteger (int64)是Resource ID.
namestring是Name.
clientIDstring是MQTT client ID.
usernamestring是MQTT user name.
passwordstring是Plaintext password. Save it now; it cannot be retrieved again.
clientIDRandomSuffixEnabledboolean是Whether to append a random suffix to the MQTT client ID.

MqttAuthDeleteReq

字段类型必填描述
idinteger (int64)是Resource ID.

MqttAuthDeleteResp

字段类型必填描述
successboolean是Whether the operation succeeded.

NamespaceNode

NamespaceNode

字段类型必填描述
namestring是Node name, up to 63 Unicode characters. In a nested request, this is the name under its parent.
typestring否Node type: PATH or TOPIC.
childrenarray<object>否Child nodes to create under this node.
topicTypestring否Topic data category: STATE, ACTION, or METRIC.
fieldsarray<object>否Payload schema fields for TOPIC nodes.
descriptionstring否Node description, up to 512 Unicode characters.
displayNamestring否Display name shown in clients.
extendPropertiesobject否Custom metadata key-value pairs.
aliasstring否Optional topic alias.
enableHistoryboolean (boolean)否Whether history storage is enabled for this topic.

NodeCreateReq

NodeCreateReq

字段类型必填描述
namespacearray<object>是UNS nodes to create. Nest children to create a subtree.

NodeDeleteReq

NodeDeleteReq

字段类型必填描述
topicsarray<string>是UNS topic or path node paths to delete.
hard_deleteboolean (boolean)否Permanently delete instead of moving nodes to the recycle state.

NodeRedNodeSet

字段类型必填描述
idstring是Resource ID.
namestring是Name.
typesarray<string>是Node-RED node types provided by the node set.
enabledboolean是Whether the node set is enabled.
modulestring是Node-RED module name.
versionstring是Service or node module version.

NodeRestoreReq

NodeRestoreReq

字段类型必填描述
pathstring是Full UNS path of the node to restore. Use its path before deletion, not a node ID or HTTP URL.

NodeUpdateReq

NodeUpdateReq

字段类型必填描述
pathstring是Existing UNS topic or path node to update.
namestring否New node name.
descriptionstring否Updated node description.
displayNamestring否Updated display name.
extendPropertiesobject否Updated custom metadata key-value pairs.
fieldsarray<object>否Updated payload schema fields.
aliasstring否Updated topic alias.
enableHistoryboolean (boolean)否Supply true or false to change history storage. Omit to keep the existing setting.
updateMaskarray<string>否Compatibility field ignored by the current Enterprise implementation. It cannot be used to clear fields.

OpenapiCreateResult

OpenapiCreateResult

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
topicstring是Full UNS topic path.
errorobject否OpenapiItemError. 请参阅架构章节中的引用架构。

OpenapiEmptyResp

OpenapiEmptyResp

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.

OpenapiHistoryItem

OpenapiHistoryItem

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
topicstring是Full UNS topic path.
resultobject否OpenapiHistoryResult. 请参阅架构章节中的引用架构。
errorobject否OpenapiItemError. 请参阅架构章节中的引用架构。

OpenapiHistoryResult

OpenapiHistoryResult

字段类型必填描述
valuesarray<object>是Historical VQT records.
metaobject否HistoryQueryMeta. 请参阅架构章节中的引用架构。

OpenapiHistoryValue

OpenapiHistoryValue

字段类型必填描述
valueobject否Payload value.
qualitystring是Data quality: Good, GoodNoData, Uncertain, or Bad.
timeStampinteger (int64)是Unix timestamp in milliseconds. Writes use server time when omitted.

OpenapiItemError

OpenapiItemError

字段类型必填描述
codeinteger (int64)是Status code; in an item error, identifies the failure.
messagestring是Item-level error message.

OpenapiNodeInfo

OpenapiNodeInfo

字段类型必填描述
idinteger (int64)是Resource ID.
pathstring是Full UNS node path.
namestring是Name.
typestring是Node type: PATH or TOPIC.
topicTypestring是Topic category: STATE, ACTION, or METRIC.
descriptionstring否Description.
displayNamestring否Display name.
extendPropertiesobject否Custom node metadata as key-value pairs.
fieldsarray<object>否Payload field definitions.
childrenarray<object>否Child nodes under this node.
aliasstring否Node alias.
enableHistoryboolean (boolean)否Whether history storage is enabled.
bindFlowIDinteger (int64)否Bound Source Flow ID. 0 means no Source Flow is bound.
bindEventFlowIDinteger (int64)否Bound Event Flow ID. 0 means no Event Flow is bound.
payloadobject否OpenapiVQT. 请参阅架构章节中的引用架构。

OpenapiReadItem

OpenapiReadItem

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
topicstring是Full UNS topic path.
resultobject否OpenapiVQT. 请参阅架构章节中的引用架构。
errorobject否OpenapiItemError. 请参阅架构章节中的引用架构。
metadataobject否OpenapiNodeInfo. 请参阅架构章节中的引用架构。

OpenapiVQT

OpenapiVQT

字段类型必填描述
valueobject否Payload value.
qualitystring是Data quality: Good, GoodNoData, Uncertain, or Bad.
timeStampinteger (int64)是Unix timestamp in milliseconds. Writes use server time when omitted.

OpenapiWriteResult

OpenapiWriteResult

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
topicstring是Full UNS topic path.
errorobject否OpenapiItemError. 请参阅架构章节中的引用架构。

PlatformGetMembersReq

字段类型必填描述
keywordstring否Search keyword.
roleKeystring否Role key filter.
rolesarray<string>否Role filters or the returned role list, depending on the model.
statusesarray<string>否Member status filters: active or disabled.
updatedAtStartstring否Inclusive update-time lower bound in RFC 3339 format.
updatedAtEndstring否Inclusive update-time upper bound in RFC 3339 format.
pageinteger (int64)否Page number, starting at 1.
sizeinteger (int64)否Number of members per page.

PlatformMemberResp

字段类型必填描述
userIdstring是User ID.
userNamestring否User name.
nickNamestring否User nickname.
emailstring否Email address.
statusstring是Platform member status: active or disabled.
rolesarray<object>是Role filters or the returned role list, depending on the model.
updatedAtstring是Last update time.

PlatformMemberRoleResp

字段类型必填描述
roleIdstring是Role ID, represented as a string.
roleKeystring是Role key filter.
roleNamestring否Role display name.
descriptionstring否Description.

PlatformMembersResp

字段类型必填描述
listarray<object>是Result list.
totalinteger (int64)是Total number of matching records.
pageinteger (int64)是Page number, starting at 1.
sizeinteger (int64)是File size in bytes.

ReadReq

ReadReq

字段类型必填描述
topicsarray<string>是UNS topic paths to read.
include_metadataboolean (boolean)否Whether each result should include UNS node metadata.
include_leaf_valueboolean (boolean)否Whether leaf nodes should include their latest payload.

ReadResp

ReadResp

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
resultsarray<object>是Per-item results. Check success and error for each item.

SchemaField

SchemaField

字段类型必填描述
namestring是Payload field name.
typestring是Payload field type: INTEGER, LONG, DOUBLE, FLOAT, STRING, BOOLEAN, or DATETIME.
unitstring否Optional engineering unit.

SearchReq

SearchReq

字段类型必填描述
keywordstring否Keyword matched against UNS node names, aliases, and paths.
topicTypestring否Topic data category filter: STATE, ACTION, or METRIC.
path_prefixstring否Only return nodes under this UNS path prefix.
include_metadataboolean (boolean)否Whether returned nodes should include metadata.
include_leaf_valueboolean (boolean)否Whether returned leaf nodes should include their latest payload.
pageinteger (int64)否Page number, starting from 1.
sizeinteger (int64)否Page size.

SearchResp

SearchResp

字段类型必填描述
objectsarray<object>是Matching UNS nodes.
pageinteger (int64)是Page number, starting at 1.
sizeinteger (int64)是File size in bytes.
totalinteger (int64)是Total number of matching records.

UnsAttachmentInfo

UnsAttachmentInfo

字段类型必填描述
unsIdinteger (int64)是Numeric UNS node ID.
fileNamestring否Original file name.
filePathstring是Server-issued storage path returned by an upload API.
fileUrlstring否File access URL.
contentTypestring否File MIME type, for example application/octet-stream.
sizeinteger (int64)否File size in bytes.
sha256string否SHA-256 checksum of the file contents.
createdAtinteger (int64)否Creation time, in Unix milliseconds.
fileUrlExpiresAtinteger (int64)否File URL expiration time, in Unix milliseconds.

UnsAttachmentListReq

UnsAttachmentListReq

字段类型必填描述
unsIdinteger (int64)否Numeric UNS node ID.
topicstring否Full UNS topic path.
pageinteger (int64)否Page number, starting at 1.
sizeinteger (int64)否Number of attachments per page.
includeFileUrlboolean (boolean)否Whether to return temporary file URLs. Defaults to true.

UnsAttachmentListResp

UnsAttachmentListResp

字段类型必填描述
unsIdinteger (int64)是Numeric UNS node ID.
listarray<object>是Result list.
totalinteger (int64)是Total number of matching records.
pageinteger (int64)是Page number, starting at 1.
sizeinteger (int64)是File size in bytes.

UnsAttachmentUploadReq

UnsAttachmentUploadReq

字段类型必填描述
unsIdinteger (int64)否Numeric owner node ID. Supply unsId or topic; a valid unsId takes precedence.
topicstring否Full owner node path, used when a valid unsId is not supplied.
fileNamestring否Original file name.
sha256string否SHA-256 checksum of the file contents.
filestring (binary)是Binary file contents. The multipart field name must be file.

UnsAttachmentUploadResp

UnsAttachmentUploadResp

字段类型必填描述
unsIdinteger (int64)是Numeric UNS node ID.
fileNamestring否Original file name.
filePathstring是Server-issued storage path returned by an upload API.
fileUrlstring否File access URL.
contentTypestring否File MIME type, for example application/octet-stream.
sizeinteger (int64)否File size in bytes.
sha256string否SHA-256 checksum of the file contents.
createdAtinteger (int64)否Creation time, in Unix milliseconds.
fileUrlExpiresAtinteger (int64)否File URL expiration time, in Unix milliseconds.

UnsBindFlowReq

UnsBindFlowReq

字段类型必填描述
unsIdinteger (int64)是UNS node ID to bind.
flowIdinteger (int64)是Flow ID to bind.

UnsBindFlowResp

UnsBindFlowResp

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
unsIdinteger (int64)是Numeric UNS node ID.
flowIdinteger (int64)是Flow identifier.

WriteItem

WriteItem

字段类型必填描述
topicstring是UNS topic path to write.
valueobject否Payload value to write.
timeStampinteger (int64)否Optional Unix timestamp in milliseconds. Omit it to use server time.

WriteReq

WriteReq

字段类型必填描述
writesarray<object>是Write operations to apply.
qosinteger (int64)否MQTT QoS: 0, 1, or 2.
retainboolean (boolean)否Whether the MQTT message should be retained.

WriteResp

WriteResp

字段类型必填描述
successboolean (boolean)是Whether the operation succeeded.
resultsarray<object>是Per-item results. Check success and error for each item.