FireLeave_tool/JSON.md
2026-01-30 17:15:01 +08:00

198 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# FireLeave_tool JSON格式配置对比
## 1. 配置结构对比
### 1.1 修改前(仅动火离人检测)
#### 1.1.1 Nginx上传格式
```json
{
"alarm_time": 1678901234,
"description": "无人工作区且温度超阈值报警",
"device_UUID": "设备唯一标识",
"host_uuid": "主机唯一标识",
"person_count": 0,
"temperature": 38.5
}
```
#### 1.1.2 WebSocket事件上报
```json
{
"method": "metric_data",
"params": {
"route_key": "/dhlr/device/{deviceUUID}/event",
"metric": {
"type": "event",
"args": {
"description": "无人工作区且温度超阈值报警",
"device_uuid": "设备唯一标识",
"host_uuid": "主机唯一标识",
"video_url": "视频URL",
"alarm_time": 1678901234,
"address": "设备地址"
}
}
}
}
```
#### 1.1.3 WebSocket数据快照
```json
{
"method": "metric_data",
"params": {
"route_key": "/dhlr/device/{deviceUUID}/data",
"metric": {
"type": "data",
"args": {
"person_count": 0,
"temperature": 38.5,
"camera_rtsp": "摄像头RTSP地址",
"task_id": "任务ID",
"camera_ip": "摄像头IP",
"confidence": 80,
"alarm_time": 1678901234,
"address": "设备地址"
}
}
}
}
```
### 1.2 修改后(动火离人检测 + 火焰检测)
#### 1.2.1 Nginx上传格式 - 动火离人报警
```json
{
"alarm_time": 1678901234,
"description": "无人工作区且温度超阈值报警",
"device_UUID": "设备唯一标识",
"host_uuid": "主机唯一标识",
"person_count": 0,
"temperature": 38.5,
"level": "fire_leave"
}
```
#### 1.2.2 Nginx上传格式 - 火焰检测报警
```json
{
"alarm_time": 1678901234,
"description": "检测到异常火苗",
"device_UUID": "设备唯一标识",
"host_uuid": "主机唯一标识",
"person_count": 0,
"level": "fire_check"
}
```
#### 1.2.3 WebSocket事件上报 - 动火离人报警
```json
{
"method": "metric_data",
"params": {
"route_key": "/dhlr/device/{deviceUUID}/event",
"metric": {
"type": "event",
"args": {
"level": "fire_leave",
"description": "无人工作区且温度超阈值报警",
"device_uuid": "设备唯一标识",
"host_uuid": "主机唯一标识",
"video_url": "视频URL",
"alarm_time": 1678901234,
"address": "设备地址"
}
}
}
}
```
#### 1.2.4 WebSocket事件上报 - 火焰检测报警
```json
{
"method": "metric_data",
"params": {
"route_key": "/dhlr/device/{deviceUUID}/event",
"metric": {
"type": "event",
"args": {
"level": "fire_check",
"description": "检测到异常火苗",
"device_uuid": "设备唯一标识",
"host_uuid": "主机唯一标识",
"video_url": "视频URL",
"alarm_time": 1678901234,
"address": "设备地址"
}
}
}
}
```
#### 1.2.5 WebSocket数据快照 - 火焰检测
```json
{
"method": "metric_data",
"params": {
"route_key": "/dhlr/device/{deviceUUID}/data",
"metric": {
"type": "data",
"args": {
"fire_detected": true,
"camera_rtsp": "摄像头RTSP地址",
"task_id": "任务ID",
"camera_ip": "摄像头IP",
"alarm_time": 1678901234,
"address": "设备地址"
}
}
}
}
```
## 2. 核心变更说明
### 2.1 新增字段
| 字段名 | 类型 | 说明 | 适用场景 |
|-------|------|------|----------|
| `level` | string | 报警类型标识 | 所有报警类型 |
| `fire_detected` | boolean | 是否检测到火焰 | 火焰检测数据快照 |
### 2.2 字段值调整
| 字段名 | 新值(动火离人) | 新值(火焰检测) | 说明 |
|-------|-----------------|-----------------|------|
| `level` | "fire_leave" | "fire_check" | 区分不同报警类型 |
| `description` | "无人工作区且温度超阈值报警" | "检测到异常火苗" | 不同报警类型的描述 |
| `temperature` | 包含此字段 | 不包含此字段 | 火焰检测不需要温度数据 |
## 3. 报警类型说明
### 3.1 fire_leave动火离人报警
**触发条件**
- 无人工作区person_count = 0
- 温度超过阈值temperature > 阈值)
**核心字段**
- `person_count`: 0
- `temperature`: 触发报警的温度值
- `level`: "fire_leave"
### 3.2 fire_check火焰检测报警
**触发条件**
- 检测到异常火苗fire_detected = true
**核心字段**
- `fire_detected`: true
- `level`: "fire_check"
- 不包含 `temperature` 字段(与温度无关)