获取最新活跃的三个设备遥测数据
开发中
本地
本地
GET
http://127.0.0.1:9999/api/v1/device/telemetry/latest
请求参数
Header 参数
x-token
string
可选
默认值:
{{x-token}}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request GET 'http://127.0.0.1:9999/api/v1/device/telemetry/latest' \
--header 'x-token: {{x-token}}'
返回响应
🟢200成功
application/json
Body
code
integer
必需
message
string
必需
data
array [object {5}]
必需
device_id
string
必需
device_name
string
必需
is_online
integer
必需
last_push_time
string
必需
telemetry_data
array [object {4}]
必需
示例
{
"code": 200,
"message": "操作成功",
"data": [
{
"device_id": "af13ac2c-3a9e-5ab9-cd31-0cf01f984b3c",
"device_name": "sensor1",
"is_online": 1,
"last_push_time": "2025-04-20T10:21:43.752+08:00",
"telemetry_data": [
{
"key": "deviceStatus",
"label": null,
"unit": null,
"value": "maintenance"
},
{
"key": "isOnline",
"label": null,
"unit": null,
"value": true
},
{
"key": "switchStatus",
"label": null,
"unit": null,
"value": 0
},
{
"key": "temperature",
"label": "调试温度",
"unit": "度",
"value": 80.53
},
{
"key": "humidity",
"label": "湿度",
"unit": "度",
"value": 67.51
}
]
},
{
"device_id": "cab39a7a-c5e6-1893-0af7-1e71ebf44b11",
"device_name": "照明灯",
"is_online": 0,
"last_push_time": "2025-04-18T15:26:41.421+08:00",
"telemetry_data": [
{
"key": "running_time",
"label": null,
"unit": null,
"value": 0
},
{
"key": "lamp_bright",
"label": null,
"unit": null,
"value": 0
},
{
"key": "reactive_energy",
"label": null,
"unit": null,
"value": 0
},
{
"key": "current",
"label": null,
"unit": null,
"value": 0
},
{
"key": "apparent_energy",
"label": null,
"unit": null,
"value": 0
},
{
"key": "light",
"label": null,
"unit": null,
"value": 0
},
{
"key": "total_lamp",
"label": null,
"unit": null,
"value": 5
},
{
"key": "voltage",
"label": null,
"unit": null,
"value": 0
},
{
"key": "active_power",
"label": null,
"unit": null,
"value": 0
},
{
"key": "reactive_power",
"label": null,
"unit": null,
"value": 0
},
{
"key": "time",
"label": null,
"unit": null,
"value": 1744961200000
},
{
"key": "active_energy",
"label": null,
"unit": null,
"value": 0
},
{
"key": "frequency",
"label": null,
"unit": null,
"value": 0
},
{
"key": "lamp_onoff",
"label": null,
"unit": null,
"value": 0
},
{
"key": "body_sens_state",
"label": null,
"unit": null,
"value": 0
},
{
"key": "lamp_no",
"label": null,
"unit": null,
"value": 0
},
{
"key": "power_factor",
"label": null,
"unit": null,
"value": -1
}
]
},
{
"device_id": "a7b65dde-ef16-cab6-6e33-2209cfe1d537",
"device_name": "直连设备0408yhh",
"is_online": 0,
"last_push_time": "2025-04-18T13:35:08.443+08:00",
"telemetry_data": [
{
"key": "test_data1",
"label": null,
"unit": null,
"value": 25.5
},
{
"key": "test_data2",
"label": null,
"unit": null,
"value": 60
},
{
"key": "longdata2",
"label": null,
"unit": null,
"value": "{\"cable_force\":778.9,\"horizontal_displacement\":5.16,\"stress\":141.1,\"vertical_displacement\":8.96,\"vibration_frequency\":10.03}"
},
{
"key": "longdata",
"label": null,
"unit": null,
"value": "[{\"lastExecTime\":1742785440,\"nextExecTime\":1742982371,\"outlet\":1,\"pressure\":0,\"valveOpen\":0},{\"lastExecTime\":1742261689,\"nextExecTime\":1742985371,\"outlet\":2,\"pressure\":0,\"valveOpen\":0}]"
},
{
"key": "temp2",
"label": "温度2",
"unit": "摄氏度",
"value": 20
},
{
"key": "temperature",
"label": null,
"unit": null,
"value": 20
},
{
"key": "switch",
"label": "开关状态",
"unit": "",
"value": true
},
{
"key": "status",
"label": "状态2",
"unit": "",
"value": 100
},
{
"key": "test",
"label": null,
"unit": null,
"value": 20
},
{
"key": "temp4",
"label": "温度4",
"unit": "",
"value": 55
},
{
"key": "temp3",
"label": "温度3-mod",
"unit": "",
"value": 60
},
{
"key": "code",
"label": null,
"unit": null,
"value": "112"
},
{
"key": "switch1",
"label": "开关字段",
"unit": "",
"value": 0
}
]
}
]
}
修改于 2025-04-21 04:39:56