# hex 透传

# 1 透传格式

数据上行:fogcloud/{pk}/{dn}/thing/up/through
数据下行:fogcloud/{pk}/{dn}/thing/down/through

解析脚本 json 数据字段说明

method 字段

说明

property.post

设备上报属性

property.set

云端设置属性

event.{id}.post

设备上报事件

service.{id}

云端调用设备服务

# 1.1 数据上行

设备上行数据示例:

hex: fe232309a4

透传解析脚本示例:

传入参数:000000000100320100000000
输出结果:
{
    "id": 1,
    "method": "property.post",
    "version": "1.0",
    "timestamp": 1631585734,
    "params": {
        "property1": 1,
        "property2": "on"
    }
}

# 1.2 数据下行

下行 json 数据示例:

{
    "id": 1,
    "version": "1.0",
    "timestamp": 1631585734,
    "method": "property.post",
    "params": {
        "property1": 1,
        "property2": 2
    }
}

# 2 子设备数据透传,网关 json 格式

(子设备是透传格式,网关是 json 格式)

数据上行:$fogcloud/{pk}/{dn}/thing/up/sub/through

数据下行:$fogcloud/{pk}/{dn}/thing/down/sub/through

设备上行数据格式:

{
  "id": 1,
  "version": "1.0",
  "params": [
    {
      "product_key": "22345600",
      "device_name": "00000020",
      "raw_data": "19020103a3a1"
    },
    { 
      "product_key": "22345600",
      "device_name": "00000021",
      "raw_data": "19020103a3a1"
    }
  ]
}

云端下行数据格式:

{
  "id": 1,
  "version": "1.0",
  "params": [
    {
      "product_key": "22345600",
      "device_name": "00000020",
      "raw_data": "19020103a3a1"
    },
    { 
      "product_key": "22345600",
      "device_name": "00000021",
      "raw_data": "19020103a3a1"
    }
  ]
}
更新时间: 2023/1/30 下午5:27:13