You need to enable JavaScript to run this app.
导航
设备数据采集 - 元数据格式
最近更新时间:2024.11.08 14:46:58首次发布时间:2024.11.08 14:46:58

本文介绍了设备属性数据的原始格式。

背景信息

物联网设备成功接入边缘节点后,边缘节点将根据物模型及点表配置自动采集设备属性数据。采集的数据以元数据格式存储在边缘节点。
边缘节点在上报设备属性数据时,默认采用元数据格式上报,除非您在北向通道配置中指定将数据转换成特定格式,以适应目标接收系统的要求。

元数据示例

以下是一段使用元数据格式存储的设备属性数据。

{
    "__meta": {
        "correlationid": "8d6dda64-8cff-4496-89af-c6b2a6345970",
        "deviceName": "test-device",
        "id": "152a3399-dae1-4f46-8d14-fdd0869c5fbc",
        "origin": 1724123143515627500,
        "profileName": "forward-demo:device-virtual:default",
        "random_double": {
            "deviceName": "test-device",
            "id": "fd5135e5-dadf-4082-99e9-6847dfac3369",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Float64"
        },
        "random_float": {
            "deviceName": "test-device",
            "id": "a163d71f-f032-4978-9dc0-73f0dcea678b",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Float32"
        },
        "random_int": {
            "deviceName": "test-device",
            "id": "50c1807e-07e5-4e61-8372-defa4284c62b",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Int32"
        },
        "random_string": {
            "deviceName": "test-device",
            "id": "d2ee88d5-4dc0-462a-a921-39d12edc9c82",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "String"
        },
        "random_struct": {
            "deviceName": "test-device",
            "id": "6b86e804-f3dd-4c6f-8623-b9f647e6104b",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Object"
        },
        "read_write:mode": {
            "deviceName": "test-device",
            "id": "b4132ccc-b1fb-4f41-9ceb-31a6cd7ffca1",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Int32"
        },
        "read_write:rw_double": {
            "deviceName": "test-device",
            "id": "b8f9a1bf-12da-4e49-a805-4e984abc41e9",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Float64"
        },
        "read_write:rw_float": {
            "deviceName": "test-device",
            "id": "504b9891-e6f2-4cb5-9ba4-0e6d6272ab7f",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Float32"
        },
        "read_write:rw_int": {
            "deviceName": "test-device",
            "id": "ec1de058-6099-47d2-a5be-c3e91c5ad4e5",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Int32"
        },
        "read_write:switch": {
            "deviceName": "test-device",
            "id": "88bf2ab2-7169-4e07-af33-5c7ff082d4c6",
            "origin": 1724123143515627500,
            "profileName": "forward-demo:device-virtual:default",
            "valueType": "Bool"
        },
        "sourceName": "group-10000ms",
        "tags": null
    },
    "random_double": -1.151398,
    "random_float": 47.59701919555664,
    "random_int": 290,
    "random_string": "wtr4z5jwrmkrzjvtfhqs579llnwftsg9",
    "random_struct": {
        "humidity": 28,
        "temperature": 2377.1267
    },
    "read_write:mode": 2,
    "read_write:rw_double": 1736.208,
    "read_write:rw_float": 1462.4630126953125,
    "read_write:rw_int": 1417,
    "read_write:switch": true
}

在该示例中,

  • __meta 结构体是设备元数据,包含设备的基本信息以及设备数据结构的定义。设备数据结构与相应设备模板中的物模型定义是相互匹配的。与该示例匹配的物模型如下图所示:
    Image
    Image
  • __meta 结构体外的其他参数,表示设备属性数据。如 "random_double": -1.151398 表示默认模块下的 random_double 功能(属性)的数据值为 -1.151398"read_write:switch": true 表示 read_write 模块下的 switch 功能(属性)的数据值为 true

元数据格式说明

下表介绍了元数据中包含的设备基本信息字段。

字段

说明

deviceName

设备实例的标识符。

origin

数据采集时刻的时间戳,单位:纳秒。

profileName

边缘侧设备模板名称。格式为:<设备模板名称>:<驱动模板标识符>:<点表名称>

valueType

数据类型。