你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 独居老人 (Elderly Living Alone)
- 重点房间 living_room: 客厅灯[dimmable_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘[window_covering], 客厅窗户传感器[contact_sensor], 客厅烟雾报警器[smoke_co_alarm]
- 房间 bathroom: 卫生间灯[onoff_light], 卫生间运动传感器[occupancy_sensor], 卫生间漏水传感器[water_leak_detector]
- 房间 bedroom: 卧室灯[dimmable_light], 床头灯[onoff_light], 卧室运动传感器[occupancy_sensor], 卧室窗帘[window_covering], 卧室窗户传感器[contact_sensor], 卧室温度传感器[temperature_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房运动传感器[occupancy_sensor], 厨房漏水传感器[water_leak_detector]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ2
- 重点房间: living_room
- 重点设备: kitchen_smoke_alarm, living_room_smoke_alarm
- 已选事件数: 41

## 设备事件日志
[2026-07-14T02:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2340
[2026-07-14T02:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2328
[2026-07-14T02:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2327
[2026-07-14T02:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2344
[2026-07-14T02:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2347
[2026-07-14T02:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T02:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2356
[2026-07-14T02:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2346
[2026-07-14T02:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2358
[2026-07-14T03:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2364
[2026-07-14T03:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:00:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:00:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:00:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:00:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2374
[2026-07-14T03:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2368
[2026-07-14T03:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2376
[2026-07-14T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1
[2026-07-14T03:16:00] living_room_smoke_alarm | SmokeCoAlarm.InterconnectSmokeAlarm = 1
[2026-07-14T03:17:00] living_room_smoke_alarm | SmokeCoAlarm.ExpressedState = 1
[2026-07-14T03:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2367
[2026-07-14T03:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2373
[2026-07-14T03:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2386
[2026-07-14T03:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:30:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:30:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:30:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:30:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T03:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2381
[2026-07-14T03:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2388
[2026-07-14T03:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2398
[2026-07-14T03:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2390
[2026-07-14T03:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2387
[2026-07-14T04:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2396
[2026-07-14T04:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T04:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2407
[2026-07-14T04:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2408
[2026-07-14T04:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2418
[2026-07-14T04:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2416
[2026-07-14T04:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2423

## 任务
请分析下面的实时设备事件，判断是否需要将其视为异常安全事件。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房烟雾报警器触发，且客厅烟雾报警器联动报警，表明家中可能存在火灾或烟雾泄漏风险。",
  "reasoning": [
    "1. 识别核心告警：日志显示在 03:16:00，kitchen_smoke_alarm 的 SmokeState 变为 1（通常代表检测到烟雾/火情），紧接着 living_room_smoke_alarm 的 InterconnectSmokeAlarm 变为 1，表示多设备互联报警已激活。",
    "2. 关联住户状态：根据 occupancy_sensor 数据，从凌晨 02:30 到 04:25，所有房间（包括厨房、客厅、卧室等）的运动传感器均显示 Occupancy = 0，表明独居老人此时处于睡眠状态，未察觉异常。",
    "3. 排除误报可能性：虽然温度传感器数值较高（如 2398 等），但这是 Matter 协议中常见的以 0.01°C 为单位的原始值（即 23.98°C），属于正常室温范围，并非高温导致的误报。因此，烟雾报警更可能是真实的烟雾检测。",
    "4. 风险评估：对于独居老人而言，夜间发生火灾且无人察觉是极高风险场景，必须立即视为紧急安全事件处理。"
  ],
  "key_evidence": [
    "[2026-07-14T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1",
    "[2026-07-14T03:16:00] living_room_smoke_alarm | SmokeCoAlarm.InterconnectSmokeAlarm = 1",
    "All occupancy sensors report 0 between 02:30 and 04:25, indicating the resident is asleep/unaware."
  ],
  "recommended_actions": [
    "立即通过智能家居系统向用户手机发送最高优先级火灾警报通知。",
    "自动拨打紧急救援电话或联系预设的紧急联系人，告知厨房区域可能发生火灾。",
    "如果系统支持，尝试远程开启客厅和厨房的排风扇或切断厨房电源（需谨慎评估安全性）。",
    "建议检查厨房烟雾报警器电池及传感器状态，确认是否为真实火情后的设备维护。"
  ]
}
```

{
  "is_anomaly": true,
  "confidence": "low",
  "threat_type": "intrusion",
  "threat_description": "存在异常，但原因更可能属于其他类别。",
  "reasoning": [
    "推理步骤1: 日志里有异常，但我把它归因为另一类威胁。"
  ],
  "key_evidence": [
    "厨房烟雾状态异常"
  ],
  "recommended_actions": [
    "建议按该错误类别处理。"
  ]
}


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 独居老人 (Elderly Living Alone)
- 重点房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房运动传感器[occupancy_sensor], 厨房漏水传感器[water_leak_detector]
- 房间 bathroom: 卫生间灯[onoff_light], 卫生间运动传感器[occupancy_sensor], 卫生间漏水传感器[water_leak_detector]
- 房间 bedroom: 卧室灯[dimmable_light], 床头灯[onoff_light], 卧室运动传感器[occupancy_sensor], 卧室窗帘[window_covering], 卧室窗户传感器[contact_sensor], 卧室温度传感器[temperature_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 living_room: 客厅灯[dimmable_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘[window_covering], 客厅窗户传感器[contact_sensor], 客厅烟雾报警器[smoke_co_alarm]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ4
- 重点房间: kitchen
- 重点设备: kitchen_smoke_alarm
- 已选事件数: 121

## 跨天活动摘要
- 2026-08-15: kitchen=240, bedroom=242, entrance=228, living_room=208, bathroom=90
- 2026-08-16: kitchen=241, bedroom=241, entrance=229, living_room=209, bathroom=57
- 2026-08-17: kitchen=242, bedroom=241, entrance=230, living_room=208, bathroom=58

## 设备事件日志
[2026-08-15T06:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2478
[2026-08-15T06:09:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T06:34:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T06:54:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T07:00:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2407
[2026-08-15T07:00:08] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-15T07:05:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2412
[2026-08-15T07:10:00] kitchen_light | OnOff.OnOff = False
[2026-08-15T07:10:04] front_door_lock | Event: LockOperation(LockOperationType=1, OperationSource=Manual)
[2026-08-15T07:10:14] front_door_contact | BooleanState.StateValue = True
[2026-08-15T07:14:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T07:15:07] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T07:20:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2414
[2026-08-15T07:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2426
[2026-08-15T07:30:08] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-15T07:39:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T07:40:07] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T07:45:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2419
[2026-08-15T07:55:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2418
[2026-08-15T07:59:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T08:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-15T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1
[2026-08-15T08:05:07] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T08:10:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2430
[2026-08-15T08:20:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2429
[2026-08-15T08:24:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T08:25:07] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T08:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2440
[2026-08-15T08:30:08] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-15T08:35:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2447
[2026-08-15T08:40:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2436
[2026-08-15T08:40:05] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T08:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2532
[2026-08-15T08:50:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2448
[2026-08-15T08:54:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T08:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2546
[2026-08-15T08:59:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T09:24:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-15T09:44:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T06:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2468
[2026-08-16T06:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2471
[2026-08-16T06:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2488
[2026-08-16T06:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2499
[2026-08-16T06:39:00] kitchen_cook_surface | OnOff.OnOff = False
[2026-08-16T06:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2502
[2026-08-16T06:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2507
[2026-08-16T07:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2513
[2026-08-16T07:03:09] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T07:06:00] kitchen_light | OnOff.OnOff = False
[2026-08-16T07:06:08] front_door_contact | BooleanState.StateValue = False
[2026-08-16T07:06:16] front_door_lock | DoorLock.LockState = 1
[2026-08-16T07:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2504
[2026-08-16T07:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2519
[2026-08-16T07:16:09] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T07:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2521
[2026-08-16T07:24:48] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-16T07:26:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T07:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2417
[2026-08-16T07:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2520
[2026-08-16T07:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2512
[2026-08-16T07:41:09] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T07:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2514
[2026-08-16T07:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2527
[2026-08-16T07:55:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2428
[2026-08-16T07:58:09] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-16T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2
[2026-08-16T08:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2525
[2026-08-16T08:06:09] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2530
[2026-08-16T08:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2538
[2026-08-16T08:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2536
[2026-08-16T08:24:48] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-16T08:26:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2436
[2026-08-16T08:31:00] front_door_lock | DoorLock.LockState = 2
[2026-08-16T08:31:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:35:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2430
[2026-08-16T08:36:03] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2547
[2026-08-16T08:43:09] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:46:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2553
[2026-08-16T08:51:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T08:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2545
[2026-08-16T09:00:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2441
[2026-08-16T09:08:09] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T09:28:09] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-16T09:48:09] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T06:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2482
[2026-08-17T06:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2479
[2026-08-17T06:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2483
[2026-08-17T06:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2499
[2026-08-17T06:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2491
[2026-08-17T06:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2497
[2026-08-17T06:55:05] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T07:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-17T07:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2501
[2026-08-17T07:05:09] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T07:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2505
[2026-08-17T07:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2506
[2026-08-17T07:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2514
[2026-08-17T07:24:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T07:25:05] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T07:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2428
[2026-08-17T07:30:09] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T07:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2530
[2026-08-17T07:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2522
[2026-08-17T07:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2533
[2026-08-17T07:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2534
[2026-08-17T07:50:09] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T07:59:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T08:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-17T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3
[2026-08-17T08:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2541
[2026-08-17T08:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2535
[2026-08-17T08:15:09] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T08:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2530
[2026-08-17T08:24:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T08:25:05] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-08-17T08:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2430

## 任务
请综合以下多个设备与环境状态，评估家庭整体安全状况，指出任何潜在风险。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "sensor_malfunction",
  "threat_description": "厨房烟雾报警器连续三天在固定时间（08:00）触发污染/故障状态，且未伴随真实的火灾或烹饪事件，表明设备存在硬件故障或传感器漂移。",
  "reasoning": [
    "1. 识别异常模式：日志显示在2026-08-15、16、17的08:00:00整点，kitchen_smoke_alarm均上报了SmokeCoAlarm.ContaminationState变化（分别为1, 2, 3）。这构成了一个高度规律性的重复事件。",
    "2. 排除真实威胁：在报警发生前后，没有检测到厨房灶具(cook_surface)开启、温度急剧升高或运动传感器长时间滞留等符合“真实火灾”或“严重烹饪烟雾”的特征。相反，08:00时老人通常处于起床后活动初期，且其他房间（如卧室、客厅）的活动轨迹正常，无恐慌迹象。",
    "3. 分析ContaminationState含义：Matter协议中，ContaminationState通常指示传感器内部脏污、老化或自检失败。数值从1变为2再变为3，暗示故障程度可能在累积或状态机正在循环报错，而非偶发的误报。",
    "4. 结合用户画像：独居老人对安全设备依赖度高，若烟雾报警器失效，将导致真正的火灾风险无法被及时发现，构成重大安全隐患。"
  ],
  "key_evidence": [
    "[2026-08-15T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1",
    "[2026-08-16T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2",
    "[2026-08-17T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3",
    "无对应的cook_surface开启或高温异常日志支持真实火灾假设"
  ],
  "recommended_actions": [
    "立即通知家属或护理人员检查厨房烟雾报警器，确认是否为设备故障。",
    "尝试重置烟雾报警器或更换电池；若问题持续，需更换新的烟雾报警器以确保消防安全。",
    "在修复前，建议增加人工巡检频率或使用备用便携式烟雾探测器作为临时安全措施。"
  ]
}
```

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房温度持续异常升高且烟雾报警器状态恶化，存在严重的火灾风险。",
  "reasoning": [
    "推理步骤 1: 分析温度数据发现，从 8 月 15 日到 8 月 17 日，厨房温度传感器读数呈现明显的上升趋势（24.78°C -> 25.46°C），并在 8 月 16 日和 17 日进一步攀升至 25.30°C - 25.47°C 区间，远超正常室温，表明厨房内可能存在持续的热源或通风不良导致的积热。",
    "推理步骤 2: 结合住户为独居老人的背景，这种高温可能源于灶具未完全关闭、电器故障或烹饪时无人看管。日志显示 8 月 16 日有灶具关闭事件，但随后温度并未立即回落，反而继续上升，暗示热源可能来自其他设备或环境因素。",
    "推理步骤 3: 关键证据是烟雾报警器（SmokeCoAlarm）的 ContaminationState 属性在三天内依次变为 1、2、3。该数值递增通常代表污染程度加剧或报警级别提升，结合高温环境，极大概率意味着已经检测到烟雾或燃烧产物，处于即将触发警报或正在发生火情的临界状态。"
  ],
  "key_evidence": [
    "厨房温度在三天内持续异常升高，最高达到 25.47°C (MeasuredValue=2547)。",
    "烟雾报警器状态值连续三天递增 (ContaminationState: 1 -> 2 -> 3)，指示污染/烟雾浓度增加。",
    "独居老人居住环境下，缺乏即时人工干预能力，高温与烟雾信号叠加风险极高。"
  ],
  "recommended_actions": [
    "立即通知家属或紧急联系人前往现场检查厨房情况。",
    "远程或手动强制关闭厨房所有电源和燃气阀门（如果安全可行）。",
    "联系消防部门进行预防性检查或确认是否已发生火灾。",
    "建议更换或校准厨房温度传感器和烟雾报警器，排除设备故障可能性。"
  ]
}
```


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 独居老人 (Elderly Living Alone)
- 重点房间 living_room: 客厅灯[dimmable_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘[window_covering], 客厅窗户传感器[contact_sensor], 客厅烟雾报警器[smoke_co_alarm]
- 房间 bathroom: 卫生间灯[onoff_light], 卫生间运动传感器[occupancy_sensor], 卫生间漏水传感器[water_leak_detector]
- 房间 bedroom: 卧室灯[dimmable_light], 床头灯[onoff_light], 卧室运动传感器[occupancy_sensor], 卧室窗帘[window_covering], 卧室窗户传感器[contact_sensor], 卧室温度传感器[temperature_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房运动传感器[occupancy_sensor], 厨房漏水传感器[water_leak_detector]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ4
- 重点房间: living_room
- 重点设备: kitchen_smoke_alarm, living_room_smoke_alarm
- 已选事件数: 111

## 跨天活动摘要
- 2026-08-08: living_room=211, bedroom=241, kitchen=241, entrance=229, bathroom=57

## 设备事件日志
[2026-08-08T01:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2299
[2026-08-08T01:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2315
[2026-08-08T01:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2314
[2026-08-08T01:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T01:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2313
[2026-08-08T01:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2311
[2026-08-08T01:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2323
[2026-08-08T01:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2327
[2026-08-08T02:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2334
[2026-08-08T02:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T02:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2335
[2026-08-08T02:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2339
[2026-08-08T02:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2345
[2026-08-08T02:20:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2233
[2026-08-08T02:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2334
[2026-08-08T02:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2348
[2026-08-08T02:25:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2230
[2026-08-08T02:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2343
[2026-08-08T02:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2342
[2026-08-08T02:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2235
[2026-08-08T02:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2344
[2026-08-08T02:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T02:30:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T02:30:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T02:30:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T02:30:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T02:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2336
[2026-08-08T02:35:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2237
[2026-08-08T02:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2346
[2026-08-08T02:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2355
[2026-08-08T02:40:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2257
[2026-08-08T02:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2360
[2026-08-08T02:45:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2245
[2026-08-08T02:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2358
[2026-08-08T02:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2365
[2026-08-08T02:50:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2254
[2026-08-08T02:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2347
[2026-08-08T02:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2353
[2026-08-08T02:55:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2262
[2026-08-08T02:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2354
[2026-08-08T03:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2356
[2026-08-08T03:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2359
[2026-08-08T03:05:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2269
[2026-08-08T03:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2369
[2026-08-08T03:10:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2270
[2026-08-08T03:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2363
[2026-08-08T03:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2363
[2026-08-08T03:15:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2266
[2026-08-08T03:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2365
[2026-08-08T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1
[2026-08-08T03:16:00] living_room_smoke_alarm | SmokeCoAlarm.InterconnectSmokeAlarm = 1
[2026-08-08T03:17:00] living_room_smoke_alarm | SmokeCoAlarm.ExpressedState = 1
[2026-08-08T03:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2364
[2026-08-08T03:20:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2267
[2026-08-08T03:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2367
[2026-08-08T03:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2371
[2026-08-08T03:25:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2285
[2026-08-08T03:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2370
[2026-08-08T03:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2383
[2026-08-08T03:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2278
[2026-08-08T03:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2377
[2026-08-08T03:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2384
[2026-08-08T03:35:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2294
[2026-08-08T03:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2392
[2026-08-08T03:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2378
[2026-08-08T03:40:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2295
[2026-08-08T03:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2387
[2026-08-08T03:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2396
[2026-08-08T03:45:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2300
[2026-08-08T03:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2398
[2026-08-08T03:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2395
[2026-08-08T03:50:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2286
[2026-08-08T03:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2396
[2026-08-08T03:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2387
[2026-08-08T03:55:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2307
[2026-08-08T04:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2397
[2026-08-08T04:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2399
[2026-08-08T04:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T04:00:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T04:00:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T04:00:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T04:00:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T04:05:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2313
[2026-08-08T04:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2410
[2026-08-08T04:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2413
[2026-08-08T04:10:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2311
[2026-08-08T04:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2408
[2026-08-08T04:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2409
[2026-08-08T04:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2409
[2026-08-08T04:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2422
[2026-08-08T04:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T04:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2417
[2026-08-08T04:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2419
[2026-08-08T04:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2424
[2026-08-08T04:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2426
[2026-08-08T04:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2436
[2026-08-08T05:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2440
[2026-08-08T05:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T05:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2447
[2026-08-08T05:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2435
[2026-08-08T05:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2452

## 任务
你将看到一组跨设备日志。请做综合安全分析，而不是单点判断。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房烟雾报警器触发，且室内温度呈现持续异常上升趋势，存在火灾风险。",
  "reasoning": [
    "1. 关键告警触发：日志显示在 03:16:00，厨房烟雾报警器（kitchen_smoke_alarm）的 SmokeState 变为 1（报警状态），同时客厅烟雾报警器因互联机制也触发了 InterconnectSmokeAlarm 和 ExpressedState 为 1。这是明确的火灾或烟雾威胁信号。",
    "2. 伴随环境异常：在烟雾报警前后，多个房间的温度传感器读数呈现非自然的持续上升趋势。例如，厨房温度从 02:25 的 2343 升至 04:05 的 2410；客厅温度从 01:20 的 2299 升至 05:15 的 2452。这种跨房间的同步升温不符合夜间正常散热规律，暗示可能存在热源（如未熄灭的火源、电器故障发热）。",
    "3. 住户状态异常：尽管存在明显的烟雾报警和温度异常，但在 01:30 至 05:00 期间，所有房间的运动传感器（occupancy_sensor）均报告 Occupancy = 0。考虑到住户为独居老人，若其处于睡眠中未察觉警报，则面临极高的安全风险；若其已醒来但未移动，也属于危险状态。无论哪种情况，都需要立即干预。"
  ],
  "key_evidence": [
    "[2026-08-08T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1",
    "[2026-08-08T03:17:00] living_room_smoke_alarm | SmokeCoAlarm.ExpressedState = 1",
    "Temperature trend: Kitchen temp rose from 2343 (02:25) to 2410 (04:05); Living room temp rose from 2299 (01:20) to 2452 (05:15)",
    "All occupancy sensors reported 0 between 01:30 and 05:00 despite active alarm conditions"
  ],
  "recommended_actions": [
    "立即通过智能家居平台或电话确认住户安全状况，并远程查看是否有视频画面。",
    "如果确认无法联系到住户或发现明火/浓烟迹象，立即通知紧急救援服务（消防/急救）。",
    "检查厨房灶具（cook_surface）状态，尝试远程关闭电源或气源（如果支持且安全）。",
    "事后需排查烟雾报警器是否误报（如烹饪残留、灰尘），但鉴于温度同步升高，应优先按真实火情处理。"
  ]
}
```

{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "多个烟雾报警器互联触发",
  "reasoning": [
    "推理步骤1: 日志中出现了不存在的额外报警事件。"
  ],
  "key_evidence": [
    "我假设看到了一个未在日志中出现的 critical 告警。"
  ],
  "recommended_actions": [
    "按多点烟雾告警处理，建议立刻排查火情并疏散。"
  ]
}


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 三室两厅 (3BR)
- 重点房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房窗户传感器[contact_sensor], 洗碗机[dishwasher], 厨房漏水传感器[water_leak_detector]
- 房间 balcony: 阳台灯[onoff_light], 阳台门传感器[contact_sensor], 洗衣机[laundry_washer]
- 房间 dining_room: 餐厅灯[dimmable_light], 餐厅运动传感器[occupancy_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 kids_room: 儿童房灯[dimmable_light], 儿童房运动传感器[occupancy_sensor], 儿童房窗帘[window_covering], 儿童房窗户传感器[contact_sensor], 儿童房温度传感器[temperature_sensor]
- 房间 living_room: 客厅主灯[dimmable_light], 客厅副灯[dimmable_light], 客厅氛围灯[onoff_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘1[window_covering], 客厅窗户传感器1[contact_sensor], ... 共10个设备
- 房间 master_bathroom: 主卫灯[onoff_light], 主卫运动传感器[occupancy_sensor], 主卫漏水传感器[water_leak_detector]
- 房间 master_bedroom: 主卧灯[dimmable_light], 主卧床头灯[onoff_light], 主卧空调[air_conditioner], 主卧运动传感器[occupancy_sensor], 主卧窗帘[window_covering], 主卧窗户传感器[contact_sensor], 主卧温度传感器[temperature_sensor]
- 房间 second_bathroom: 次卫灯[onoff_light], 次卫漏水传感器[water_leak_detector]
- 房间 second_bedroom: 次卧灯[dimmable_light], 次卧空调[air_conditioner], 次卧运动传感器[occupancy_sensor], 次卧窗帘[window_covering], 次卧窗户传感器[contact_sensor]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ4
- 重点房间: kitchen
- 重点设备: kitchen_smoke_alarm
- 已选事件数: 134

## 跨天活动摘要
- 2026-07-14: kitchen=12, master_bedroom=231, entrance=229, kids_room=227, dining_room=219, living_room=113
- 2026-07-15: kitchen=12, entrance=232, kids_room=228, master_bedroom=227, dining_room=219, living_room=112
- 2026-07-16: kitchen=12, kids_room=230, master_bedroom=228, entrance=228, dining_room=219, living_room=109

## 设备事件日志
[2026-07-14T06:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2479
[2026-07-14T06:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2497
[2026-07-14T06:45:06] kitchen_light | OnOff.OnOff = True
[2026-07-14T07:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2513
[2026-07-14T07:00:00] dining_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T07:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2514
[2026-07-14T07:09:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T07:13:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T07:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2519
[2026-07-14T07:17:30] kitchen_window_contact | BooleanState.StateValue = False
[2026-07-14T07:20:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2509
[2026-07-14T07:27:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T07:30:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2525
[2026-07-14T07:35:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2527
[2026-07-14T07:37:14] master_bedroom_light | OnOff.OnOff = False
[2026-07-14T07:37:28] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T07:39:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T07:45:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2531
[2026-07-14T07:57:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T08:00:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2530
[2026-07-14T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1
[2026-07-14T08:05:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2523
[2026-07-14T08:08:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T08:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2534
[2026-07-14T08:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2524
[2026-07-14T08:17:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T08:20:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2538
[2026-07-14T08:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2543
[2026-07-14T08:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2529
[2026-07-14T08:30:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T08:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2532
[2026-07-14T08:37:28] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T08:40:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2540
[2026-07-14T08:44:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-14T08:45:50] master_bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T08:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2541
[2026-07-14T08:55:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2554
[2026-07-14T09:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-14T09:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2552
[2026-07-14T09:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2548
[2026-07-15T06:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2477
[2026-07-15T06:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2498
[2026-07-15T06:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2505
[2026-07-15T07:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-15T07:00:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-07-15T07:04:46] master_bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-15T07:05:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T07:10:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2511
[2026-07-15T07:14:05] kitchen_light | OnOff.OnOff = False
[2026-07-15T07:14:26] front_door_contact | BooleanState.StateValue = False
[2026-07-15T07:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2514
[2026-07-15T07:15:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T07:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2519
[2026-07-15T07:24:12] dining_room_light | OnOff.OnOff = True
[2026-07-15T07:25:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2508
[2026-07-15T07:29:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T07:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2520
[2026-07-15T07:35:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2523
[2026-07-15T07:39:27] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T07:40:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T07:45:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2515
[2026-07-15T07:49:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T07:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2525
[2026-07-15T07:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2534
[2026-07-15T07:55:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:00:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2534
[2026-07-15T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2
[2026-07-15T08:05:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2530
[2026-07-15T08:09:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2531
[2026-07-15T08:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2543
[2026-07-15T08:15:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:20:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2533
[2026-07-15T08:24:27] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:25:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:30:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2541
[2026-07-15T08:30:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-15T08:35:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:40:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2549
[2026-07-15T08:44:27] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:45:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:50:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2537
[2026-07-15T08:54:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-15T08:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2551
[2026-07-15T09:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2534
[2026-07-15T09:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2537
[2026-07-15T09:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2543
[2026-07-16T06:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2477
[2026-07-16T06:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2478
[2026-07-16T06:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2509
[2026-07-16T07:00:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2501
[2026-07-16T07:00:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-16T07:01:07] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = None
[2026-07-16T07:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2507
[2026-07-16T07:10:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2508
[2026-07-16T07:15:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2513
[2026-07-16T07:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2519
[2026-07-16T07:21:00] kitchen_cook_surface | OnOff.OnOff = False
[2026-07-16T07:23:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T07:25:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T07:29:13] master_bedroom_light | OnOff.OnOff = False
[2026-07-16T07:29:24] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T07:30:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2509
[2026-07-16T07:30:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-16T07:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2517
[2026-07-16T07:36:07] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T07:40:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2529
[2026-07-16T07:45:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T07:50:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2528
[2026-07-16T07:53:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T07:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2518
[2026-07-16T08:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2529
[2026-07-16T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3
[2026-07-16T08:04:24] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:05:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:10:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2532
[2026-07-16T08:13:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2543
[2026-07-16T08:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2543
[2026-07-16T08:21:07] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:25:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2542
[2026-07-16T08:29:24] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-16T08:33:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2540
[2026-07-16T08:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2545
[2026-07-16T08:41:07] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:45:00] kids_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2547
[2026-07-16T08:49:24] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:50:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T08:55:00] master_bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2539
[2026-07-16T08:58:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-16T09:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2536
[2026-07-16T09:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2547

## 任务
请综合以下多个设备与环境状态，评估家庭整体安全状况，指出任何潜在风险。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "sensor_malfunction",
  "threat_description": "厨房烟雾报警器连续三天在早晨固定时间报告污染状态（ContaminationState），且未伴随真实的火灾或烹饪烟雾事件，极大概率为传感器故障或误报。",
  "reasoning": [
    "1. 识别关键异常模式：日志显示在2026-07-14、15、16的早晨08:00左右，kitchen_smoke_alarm均触发了SmokeCoAlarm.ContaminationState变化（分别为1, 2, 3）。这表示传感器检测到自身污染或需要维护。",
    "2. 排除真实火灾/烟雾风险：在报警触发前后，厨房温度传感器（kitchen_temp_sensor）读数平稳上升（从约24.8°C升至25.5°C左右），符合正常室温变化，无急剧升温现象；同时没有检测到CO浓度异常或其他火灾相关告警。",
    "3. 排除烹饪干扰：虽然厨房灯在早晨开启，但灶具（cook_surface）在7月16日早晨显示为关闭状态，且整个时间段内没有持续的烹饪活动导致的烟雾累积迹象。通常烹饪产生的烟雾是间歇性的，而此处表现为固定的“污染”状态上报。",
    "4. 确认设备故障特征：ContaminationState的值从1变为2再变为3，表明这是一个持续恶化的状态或多次复位后的计数增加，而非偶发的瞬时干扰。结合每天同一时间点出现，高度疑似传感器硬件老化、灰尘堆积导致灵敏度漂移或内部电路故障。"
  ],
  "key_evidence": [
    "[2026-07-14T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1",
    "[2026-07-15T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2",
    "[2026-07-16T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3",
    "同期厨房温度传感器读数正常（~25°C），无火灾高温特征"
  ],
  "recommended_actions": [
    "立即检查并清洁厨房烟雾报警器，清除可能积聚的灰尘或油污。",
    "如果清洁后问题依旧，建议更换厨房烟雾报警器电池或整机，以确保护家安全功能正常。",
    "暂时忽略该误报，但需关注后续是否出现真实的烟雾或CO警报。"
  ]
}
```

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房烟雾报警器在连续三天均检测到污染状态，且伴随厨房温度异常升高，存在严重的火灾风险。",
  "reasoning": [
    "推理步骤 1: 分析关键设备日志发现，厨房烟雾报警器 (kitchen_smoke_alarm) 在 2026-07-14、2026-07-15 和 2026-07-16 的同一时间段（约早上 8:00）连续报告了 ContaminationState 分别为 1、2、3 的状态变化。根据 Matter 协议及常见传感器逻辑，这通常代表从‘清洁’到‘轻微污染’再到‘严重污染/报警’的递进过程，表明火情或烟雾正在持续累积且未得到消除。",
    "推理步骤 2: 交叉验证环境数据，厨房温度传感器 (kitchen_temp_sensor) 在同一时间窗口内显示温度急剧上升。例如 7 月 14 日从 24.79°C 升至 25.52°C，7 月 16 日同样呈现上升趋势。这种温度与烟雾状态的同步恶化强烈暗示了热源（如灶具）失控或燃烧事件的发生。",
    "推理步骤 3: 检查住户行为模式，虽然入户门和玄关运动传感器显示有人在家（Occupancy=1），但厨房窗户传感器在 7 月 14 日曾短暂打开后关闭，且未见明显的紧急疏散动作（如大量人员涌入客厅或主卫）。结合连续三天的重复报警，极有可能是灶具长时间无人看管导致的阴燃或小火苗未被及时扑灭，而非外部入侵或误报。"
  ],
  "key_evidence": [
    "2026-07-14T08:00:00 kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1",
    "2026-07-15T08:00:00 kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2",
    "2026-07-16T08:00:00 kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3",
    "2026-07-14T08:00:00 - 2026-07-16T09:10:00 kitchen_temp_sensor 温度持续高于正常室温并呈上升趋势"
  ],
  "recommended_actions": [
    "立即前往厨房检查是否存在明火、烟雾或过热的烹饪设备，确认是否有人被困。",
    "若确认有火情，立即拨打火警电话；若无明火但烟雾报警器持续报警，请撤离现场并联系消防部门排查隐患。",
    "检查厨房灶具是否处于开启状态但未点火，或是否存在油垢堆积导致的高温自燃风险，并进行彻底清洁和维护。",
    "建议重置烟雾报警器并测试其功能，同时检查其他区域的烟雾探测器状态。"
  ]
}
```


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 三室两厅 (3BR)
- 重点房间 living_room: 客厅主灯[dimmable_light], 客厅副灯[dimmable_light], 客厅氛围灯[onoff_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘1[window_covering], 客厅窗户传感器1[contact_sensor], ... 共10个设备
- 房间 balcony: 阳台灯[onoff_light], 阳台门传感器[contact_sensor], 洗衣机[laundry_washer]
- 房间 dining_room: 餐厅灯[dimmable_light], 餐厅运动传感器[occupancy_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 kids_room: 儿童房灯[dimmable_light], 儿童房运动传感器[occupancy_sensor], 儿童房窗帘[window_covering], 儿童房窗户传感器[contact_sensor], 儿童房温度传感器[temperature_sensor]
- 房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房窗户传感器[contact_sensor], 洗碗机[dishwasher], 厨房漏水传感器[water_leak_detector]
- 房间 master_bathroom: 主卫灯[onoff_light], 主卫运动传感器[occupancy_sensor], 主卫漏水传感器[water_leak_detector]
- 房间 master_bedroom: 主卧灯[dimmable_light], 主卧床头灯[onoff_light], 主卧空调[air_conditioner], 主卧运动传感器[occupancy_sensor], 主卧窗帘[window_covering], 主卧窗户传感器[contact_sensor], 主卧温度传感器[temperature_sensor]
- 房间 second_bathroom: 次卫灯[onoff_light], 次卫漏水传感器[water_leak_detector]
- 房间 second_bedroom: 次卧灯[dimmable_light], 次卧空调[air_conditioner], 次卧运动传感器[occupancy_sensor], 次卧窗帘[window_covering], 次卧窗户传感器[contact_sensor]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ2
- 重点房间: living_room
- 重点设备: kitchen_smoke_alarm, living_room_smoke_alarm
- 已选事件数: 36

## 设备事件日志
[2026-08-08T02:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2331
[2026-08-08T02:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2336
[2026-08-08T02:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2342
[2026-08-08T02:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2330
[2026-08-08T02:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2345
[2026-08-08T02:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T02:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2354
[2026-08-08T02:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2351
[2026-08-08T02:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2352
[2026-08-08T02:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2358
[2026-08-08T02:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2357
[2026-08-08T03:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2365
[2026-08-08T03:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] dining_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] kids_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] master_bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:00:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2376
[2026-08-08T03:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2373
[2026-08-08T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1
[2026-08-08T03:16:00] living_room_smoke_alarm | SmokeCoAlarm.InterconnectSmokeAlarm = 1
[2026-08-08T03:17:00] living_room_smoke_alarm | SmokeCoAlarm.ExpressedState = 1
[2026-08-08T03:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2379
[2026-08-08T03:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2383
[2026-08-08T03:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] dining_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] kids_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] master_bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:30:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-08T03:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2393
[2026-08-08T03:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2384
[2026-08-08T03:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2387

## 任务
系统刚记录到以下一段设备状态变化。请评估这些变化是否已经构成安全风险，并说明原因。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房烟雾报警器触发，且客厅互联烟雾报警系统同步响应，表明检测到火灾或烟雾风险。",
  "reasoning": [
    "1. 核心事件识别：日志显示在 03:16:00，`kitchen_smoke_alarm` 的 `SmokeState` 变为 1（通常表示检测到烟雾/火警），同时 `living_room_smoke_alarm` 的 `InterconnectSmokeAlarm` 变为 1，表明全屋烟雾报警系统已联动触发。",
    "2. 排除误报可能性：虽然此时所有房间的 `OccupancySensing.Occupancy` 均为 0（无人），但这符合深夜时段特征。关键在于温度传感器数据，客厅温度从 02:10 的 23.31°C 缓慢上升至 03:45 的 23.87°C，升温幅度极小且平稳，未出现火灾常见的急剧升温现象，这暗示可能是局部烟雾（如烹饪残留、电器故障产生的微量烟雾）而非大规模明火，但烟雾报警器的触发本身即代表存在潜在危险源。",
    "3. 威胁定性：无论是否有人在场，烟雾报警器的激活直接指向 `fire_risk`。由于发生在凌晨且家中无人，若不及时排查，可能导致火势蔓延而无人察觉，构成严重安全隐患。"
  ],
  "key_evidence": [
    "[2026-08-08T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1",
    "[2026-08-08T03:16:00] living_room_smoke_alarm | SmokeCoAlarm.InterconnectSmokeAlarm = 1"
  ],
  "recommended_actions": [
    "立即通过智能家居APP查看厨房摄像头画面（如有）或远程确认现场情况。",
    "若确认为误报（如烹饪余烟），手动复位报警器并检查通风；若无法确认或怀疑真实火情，立即联系消防部门并通知住户。",
    "检查厨房灶具、烤箱等电器是否处于异常开启状态，或是否有电气线路过热迹象。"
  ]
}
```

{
  "is_anomaly": false,
  "confidence": "medium",
  "threat_type": "none",
  "threat_description": "这些变化仍可视为正常波动。",
  "reasoning": [
    "推理步骤1: 没有看到必须报警的直接证据。"
  ],
  "key_evidence": [
    "设备状态变化幅度看起来仍在可接受范围内。"
  ],
  "recommended_actions": [
    "保持观察即可。"
  ]
}


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 独居老人 (Elderly Living Alone)
- 重点房间 living_room: 客厅灯[dimmable_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘[window_covering], 客厅窗户传感器[contact_sensor], 客厅烟雾报警器[smoke_co_alarm]
- 房间 bathroom: 卫生间灯[onoff_light], 卫生间运动传感器[occupancy_sensor], 卫生间漏水传感器[water_leak_detector]
- 房间 bedroom: 卧室灯[dimmable_light], 床头灯[onoff_light], 卧室运动传感器[occupancy_sensor], 卧室窗帘[window_covering], 卧室窗户传感器[contact_sensor], 卧室温度传感器[temperature_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房运动传感器[occupancy_sensor], 厨房漏水传感器[water_leak_detector]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ4
- 重点房间: living_room
- 重点设备: kitchen_smoke_alarm, living_room_smoke_alarm
- 已选事件数: 115

## 跨天活动摘要
- 2026-08-24: living_room=211, bedroom=241, kitchen=239, entrance=229, bathroom=63

## 设备事件日志
[2026-08-24T01:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2312
[2026-08-24T01:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2299
[2026-08-24T01:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2318
[2026-08-24T01:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T01:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2307
[2026-08-24T01:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2324
[2026-08-24T01:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2327
[2026-08-24T01:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2312
[2026-08-24T01:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2321
[2026-08-24T02:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2325
[2026-08-24T02:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T02:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2326
[2026-08-24T02:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2335
[2026-08-24T02:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2331
[2026-08-24T02:20:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2243
[2026-08-24T02:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2332
[2026-08-24T02:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2337
[2026-08-24T02:25:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2237
[2026-08-24T02:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2341
[2026-08-24T02:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2334
[2026-08-24T02:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2335
[2026-08-24T02:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T02:30:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T02:30:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T02:30:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T02:30:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T02:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2356
[2026-08-24T02:35:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2246
[2026-08-24T02:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2350
[2026-08-24T02:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2355
[2026-08-24T02:40:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2253
[2026-08-24T02:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2351
[2026-08-24T02:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2342
[2026-08-24T02:45:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2258
[2026-08-24T02:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2342
[2026-08-24T02:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2352
[2026-08-24T02:50:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2247
[2026-08-24T02:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2358
[2026-08-24T02:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2365
[2026-08-24T02:55:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2250
[2026-08-24T02:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2365
[2026-08-24T03:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:00:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:00:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:00:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:00:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2367
[2026-08-24T03:05:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2259
[2026-08-24T03:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2377
[2026-08-24T03:10:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2274
[2026-08-24T03:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2359
[2026-08-24T03:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2378
[2026-08-24T03:15:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2278
[2026-08-24T03:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2379
[2026-08-24T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1
[2026-08-24T03:16:00] living_room_smoke_alarm | SmokeCoAlarm.InterconnectSmokeAlarm = 1
[2026-08-24T03:17:00] living_room_smoke_alarm | SmokeCoAlarm.ExpressedState = 1
[2026-08-24T03:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2370
[2026-08-24T03:20:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2281
[2026-08-24T03:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2370
[2026-08-24T03:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2374
[2026-08-24T03:25:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2283
[2026-08-24T03:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2376
[2026-08-24T03:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2381
[2026-08-24T03:30:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2273
[2026-08-24T03:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2373
[2026-08-24T03:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:30:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:30:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:30:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:30:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T03:35:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2286
[2026-08-24T03:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2377
[2026-08-24T03:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2384
[2026-08-24T03:40:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2280
[2026-08-24T03:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2396
[2026-08-24T03:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2397
[2026-08-24T03:45:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2299
[2026-08-24T03:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2401
[2026-08-24T03:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2392
[2026-08-24T03:50:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2295
[2026-08-24T03:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2386
[2026-08-24T03:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2394
[2026-08-24T03:55:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2306
[2026-08-24T03:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2392
[2026-08-24T04:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2409
[2026-08-24T04:00:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2308
[2026-08-24T04:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2394
[2026-08-24T04:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T04:00:00] bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T04:00:00] kitchen_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T04:00:00] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T04:00:00] entrance_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T04:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2395
[2026-08-24T04:05:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2297
[2026-08-24T04:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2397
[2026-08-24T04:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2407
[2026-08-24T04:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2406
[2026-08-24T04:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2413
[2026-08-24T04:15:00] bedroom_temp_sensor | TemperatureMeasurement.MeasuredValue = 2304
[2026-08-24T04:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2419
[2026-08-24T04:20:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2411
[2026-08-24T04:25:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2417
[2026-08-24T04:30:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2422
[2026-08-24T04:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T04:35:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2423
[2026-08-24T04:40:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2425
[2026-08-24T04:45:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2428
[2026-08-24T04:50:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2424
[2026-08-24T04:55:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2426
[2026-08-24T05:00:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2446
[2026-08-24T05:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-24T05:05:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2443
[2026-08-24T05:10:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2455
[2026-08-24T05:15:00] living_room_temp_sensor | TemperatureMeasurement.MeasuredValue = 2447

## 任务
你将看到一组跨设备日志。请做综合安全分析，而不是单点判断。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房烟雾报警器触发，且伴随室内温度异常持续升高，存在真实火灾或过热风险。",
  "reasoning": [
    "1. 关键告警触发：日志显示在 03:16:00，kitchen_smoke_alarm 的 SmokeState 变为 1（报警状态），同时 living_room_smoke_alarm 的 InterconnectSmokeAlarm 也变为 1，表明系统检测到烟雾并进行了联动报警。",
    "2. 温度异常趋势分析：在烟雾报警前（02:20 - 03:15），厨房温度传感器读数从 2332 持续上升至 2379（单位通常为厘度/0.01°C，即约 23.3°C - 23.8°C）。虽然绝对数值看似不高，但结合凌晨时段（无人活动）和后续客厅温度的同步上升（从 23.1°C 升至 24.5°C+），表明热量正在通过空气流动扩散至整个房屋。",
    "3. 排除误报与正常行为：所有房间的运动传感器（Occupancy）在凌晨 02:30 至 05:15 期间均保持为 0，确认屋内无人。独居老人在深夜不可能进行产生大量烟雾的正常烹饪活动。因此，烟雾报警极大概率指向真实的火情隐患（如电器短路、遗留热源等），而非误报。",
    "4. 综合判断：烟雾报警是最高级别的安全威胁信号，结合温度数据的异常波动和无人值守的状态，判定为火灾风险。"
  ],
  "key_evidence": [
    "[2026-08-24T03:16:00] kitchen_smoke_alarm | SmokeCoAlarm.SmokeState = 1",
    "[2026-08-24T03:16:00] living_room_smoke_alarm | SmokeCoAlarm.InterconnectSmokeAlarm = 1",
    "[2026-08-24T02:30:00] 至 [2026-08-24T05:15:00] 所有房间 occupancy_sensor 均为 0 (无人)",
    "[2026-08-24T02:20:00] kitchen_temp_sensor = 2332 -> [2026-08-24T03:15:00] kitchen_temp_sensor = 2379 (持续升温)"
  ],
  "recommended_actions": [
    "立即启动紧急预案，联系住户或紧急联系人确认安全情况。",
    "若确认为误报（如电池低电量或灰尘导致），需检查厨房烟雾报警器状态及清洁；若为真实火情，立即通知消防部门。",
    "检查厨房灶具(cook_surface)及相关电器的断电状态，排查火灾隐患。"
  ]
}
```

{
  "is_anomaly": false,
  "confidence": "medium",
  "threat_type": "none",
  "threat_description": "这些变化仍可视为正常波动。",
  "reasoning": [
    "推理步骤1: 没有看到必须报警的直接证据。"
  ],
  "key_evidence": [
    "设备状态变化幅度看起来仍在可接受范围内。"
  ],
  "recommended_actions": [
    "保持观察即可。"
  ]
}


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 独居老人 (Elderly Living Alone)
- 重点房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房运动传感器[occupancy_sensor], 厨房漏水传感器[water_leak_detector]
- 房间 bathroom: 卫生间灯[onoff_light], 卫生间运动传感器[occupancy_sensor], 卫生间漏水传感器[water_leak_detector]
- 房间 bedroom: 卧室灯[dimmable_light], 床头灯[onoff_light], 卧室运动传感器[occupancy_sensor], 卧室窗帘[window_covering], 卧室窗户传感器[contact_sensor], 卧室温度传感器[temperature_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 living_room: 客厅灯[dimmable_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘[window_covering], 客厅窗户传感器[contact_sensor], 客厅烟雾报警器[smoke_co_alarm]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ2
- 重点房间: kitchen
- 重点设备: kitchen_smoke_alarm
- 已选事件数: 45

## 设备事件日志
[2026-07-22T06:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2503
[2026-07-22T07:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2511
[2026-07-22T07:05:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T07:29:08] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T07:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-22T07:38:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T07:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2518
[2026-07-22T07:45:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T07:54:08] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1
[2026-07-22T08:03:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T08:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2535
[2026-07-22T08:11:39] bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-07-22T08:19:08] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T08:20:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T08:29:00] front_door_lock | Event: LockOperation(LockOperationType=1, OperationSource=Manual)
[2026-07-22T08:29:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T08:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2534
[2026-07-22T08:45:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-22T09:05:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T06:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2509
[2026-07-23T07:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2498
[2026-07-23T07:13:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T07:33:06] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T07:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2522
[2026-07-23T07:39:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T07:43:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T07:59:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T08:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-07-23T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2
[2026-07-23T08:08:06] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T08:18:02] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T08:21:02] front_door_contact | BooleanState.StateValue = False
[2026-07-23T08:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2545
[2026-07-23T08:29:00] bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T08:31:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-07-23T08:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2543
[2026-07-23T09:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2540
[2026-07-24T06:55:03] kitchen_occupancy | OccupancySensing.Occupancy = 1
[2026-07-24T07:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2503
[2026-07-24T07:25:13] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-24T07:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2529
[2026-07-24T07:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2521
[2026-07-24T07:50:13] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-07-24T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3

## 任务
请分析下面的实时设备事件，判断是否需要将其视为异常安全事件。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "safety_device_failure",
  "threat_description": "厨房烟雾报警器连续两天在早晨固定时间触发污染/故障状态，且伴随温度异常升高，表明设备可能存在硬件故障、传感器老化或环境干扰导致的安全监测失效风险。",
  "reasoning": [
    "1. 识别关键异常模式：日志显示 kitchen_smoke_alarm 在 07-22 08:00 和 07-23 08:00 均报告 ContaminationState = 1 (通常表示污染或需要维护)，而在 07-24 08:00 报告 ContaminationState = 3 (通常表示严重故障或电池耗尽)。这种连续三天在同一时间点（早晨8点）出现的状态变化具有高度规律性，极大概率不是偶发事件，而是设备自身的问题。",
    "2. 排除真实火灾风险：虽然厨房温度传感器显示温度从早晨的 ~25°C 逐渐上升至 ~25.4°C (2540-2545 mK)，但这属于正常的室内环境温度波动范围，远低于火灾阈值。同时，没有检测到 SmokeCoAlarm 的 'SmokeDetected' 或 'COAlarm' 报警事件，因此可以排除真实的火灾或一氧化碳泄漏威胁。",
    "3. 结合住户行为分析：住户为独居老人，早晨活动轨迹正常（起床、进入厨房、客厅等）。由于烟雾报警器处于‘污染/故障’状态，其核心安全功能（火灾预警）可能已失效或灵敏度异常。对于独居老人而言，依赖此类安全设备的可靠性至关重要，设备故障构成了潜在的安全隐患。"
  ],
  "key_evidence": [
    "[2026-07-22T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1",
    "[2026-07-23T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2",
    "[2026-07-24T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3",
    "无 SmokeDetected 或 COAlarm 事件记录，排除真实火情"
  ],
  "recommended_actions": [
    "立即通知住户或其紧急联系人，告知烟雾报警器存在持续故障/污染状态，需进行维护或更换。",
    "建议技术人员上门检查厨房烟雾报警器，清洁传感器或更换电池/整机，确保火灾探测功能恢复正常。",
    "在设备修复前，建议增加人工巡查频率或使用其他备用监控手段关注厨房安全。"
  ]
}
```

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房烟雾报警器连续三天在早晨高温时段触发污染状态，且伴随温度异常升高，存在极高的火灾风险。",
  "reasoning": [
    "推理步骤 1: 分析时间模式，发现 7 月 22 日、23 日和 24 日均在早上 08:00 左右（早餐或烹饪准备时间）出现烟雾报警器的状态变化（ContaminationState 分别为 1, 2, 3），这表明问题具有高度的重复性和规律性，非偶然事件。",
    "推理步骤 2: 关联环境数据，日志显示在报警发生前后，厨房温度传感器读数显著偏高（例如 7 月 22 日达到 25.35°C，7 月 23 日达到 25.45°C），且运动传感器确认当时有住户在场，排除了设备故障导致的误报可能性。",
    "推理步骤 3: 结合用户画像，独居老人对火灾隐患的感知和反应能力可能较弱，连续三天的报警信号若未被有效处理（如未清洁或更换滤芯），意味着潜在的明火或过热源持续存在，构成了严重的安全威胁。"
  ],
  "key_evidence": [
    "2026-07-22T08:00:00 kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1 (伴随温度 25.35°C)",
    "2026-07-23T08:00:00 kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2 (伴随温度 25.45°C)",
    "2026-07-24T08:00:00 kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3 (伴随温度 25.21°C)"
  ],
  "recommended_actions": [
    "立即通知住户检查厨房是否存在明火、油锅过热或燃气泄漏，并迅速撤离至安全区域。",
    "强制要求住户联系专业人员进行厨房深度清洁，检查灶具及排烟系统，并更换烟雾报警器滤芯。",
    "在问题解决前，建议暂时关闭厨房区域的自动加热设备，并安排家属或社区人员每日早晚进行实地巡查。"
  ]
}
```


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 三室两厅 (3BR)
- 重点房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房窗户传感器[contact_sensor], 洗碗机[dishwasher], 厨房漏水传感器[water_leak_detector]
- 房间 balcony: 阳台灯[onoff_light], 阳台门传感器[contact_sensor], 洗衣机[laundry_washer]
- 房间 dining_room: 餐厅灯[dimmable_light], 餐厅运动传感器[occupancy_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 kids_room: 儿童房灯[dimmable_light], 儿童房运动传感器[occupancy_sensor], 儿童房窗帘[window_covering], 儿童房窗户传感器[contact_sensor], 儿童房温度传感器[temperature_sensor]
- 房间 living_room: 客厅主灯[dimmable_light], 客厅副灯[dimmable_light], 客厅氛围灯[onoff_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘1[window_covering], 客厅窗户传感器1[contact_sensor], ... 共10个设备
- 房间 master_bathroom: 主卫灯[onoff_light], 主卫运动传感器[occupancy_sensor], 主卫漏水传感器[water_leak_detector]
- 房间 master_bedroom: 主卧灯[dimmable_light], 主卧床头灯[onoff_light], 主卧空调[air_conditioner], 主卧运动传感器[occupancy_sensor], 主卧窗帘[window_covering], 主卧窗户传感器[contact_sensor], 主卧温度传感器[temperature_sensor]
- 房间 second_bathroom: 次卫灯[onoff_light], 次卫漏水传感器[water_leak_detector]
- 房间 second_bedroom: 次卧灯[dimmable_light], 次卧空调[air_conditioner], 次卧运动传感器[occupancy_sensor], 次卧窗帘[window_covering], 次卧窗户传感器[contact_sensor]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ2
- 重点房间: kitchen
- 重点设备: kitchen_smoke_alarm
- 已选事件数: 49

## 设备事件日志
[2026-08-18T06:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2499
[2026-08-18T07:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2507
[2026-08-18T07:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2502
[2026-08-18T07:30:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-18T07:38:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-18T07:42:11] kids_room_light | OnOff.OnOff = False
[2026-08-18T07:42:18] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-18T07:43:03] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-18T07:53:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-18T07:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2535
[2026-08-18T08:00:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-18T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1
[2026-08-18T08:07:44] master_bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-18T08:13:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-18T08:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2532
[2026-08-18T08:23:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-18T08:28:03] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-18T08:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-18T08:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2542
[2026-08-18T09:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2535
[2026-08-19T07:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2508
[2026-08-19T07:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2505
[2026-08-19T07:29:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T07:30:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T07:35:33] master_bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-19T07:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2525
[2026-08-19T07:51:17] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T07:59:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T08:00:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-19T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2
[2026-08-19T08:05:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T08:11:17] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T08:19:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T08:29:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-19T08:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2542
[2026-08-19T08:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2544
[2026-08-19T08:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2552
[2026-08-20T06:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2512
[2026-08-20T07:06:03] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = None
[2026-08-20T07:15:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2519
[2026-08-20T07:28:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-20T07:30:00] living_room_occupancy | OccupancySensing.Occupancy = 0
[2026-08-20T07:36:03] master_bathroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-20T07:42:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-20T07:48:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-20T07:51:34] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-20T07:57:00] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-20T08:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2532
[2026-08-20T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3

## 任务
系统刚记录到以下一段设备状态变化。请评估这些变化是否已经构成安全风险，并说明原因。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "sensor_malfunction",
  "threat_description": "厨房烟雾报警器连续三天在早晨固定时间（08:00）报告污染状态值递增（1->2->3），且无真实火灾或烹饪迹象，极大概率为传感器硬件故障或误报。",
  "reasoning": [
    "1. 观察核心异常：日志显示 kitchen_smoke_alarm 在 08-18、08-19、08-20 的 08:00:00 均触发了 SmokeCoAlarm.ContaminationState 变化，数值分别为 1、2、3。这通常表示传感器检测到内部污染或故障等级在累积或恶化。",
    "2. 排除真实威胁：检查同一时间段（07:50-08:10）的设备日志，未发现 kitchen_cook_surface（灶具）开启，也未见 kitchen_smoke_alarm 触发 Fire/CO 报警（仅报告 Contamination）。同时，厨房温度传感器读数稳定在 24-25°C 左右，无急剧升温现象，排除了火灾风险。",
    "3. 分析行为模式：ContaminationState 的变化发生在每天完全相同的时刻（08:00），这种高度规律性的“故障”而非随机性，强烈暗示是设备自身的定时自检失败、固件Bug或硬件老化导致的误报，而非外部环境影响（如做饭油烟，因为此时无人使用灶具）。",
    "4. 综合判断：由于缺乏真实的火源、一氧化碳源或人员活动伴随的烟雾产生证据，且故障表现具有机械式的重复性，判定为传感器自身故障（Sensor Malfunction）。"
  ],
  "key_evidence": [
    "[2026-08-18T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 1",
    "[2026-08-19T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 2",
    "[2026-08-20T08:00:00] kitchen_smoke_alarm | SmokeCoAlarm.ContaminationState = 3",
    "同期无 kitchen_cook_surface 开启记录，无 Fire/CO 报警，温度正常。"
  ],
  "recommended_actions": [
    "立即检查厨房烟雾报警器的物理状态，尝试清洁传感器窗口以排除灰尘干扰。",
    "若清洁后问题依旧，建议更换厨房烟雾报警器电池或整机，以消除潜在的误报或漏报风险。",
    "暂时忽略该 ContaminationState 警告，但需关注是否出现真实的 Fire 或 CO 报警。"
  ]
}
```

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房烟雾报警器连续三天在早晨高温时段触发污染状态，且伴随温度异常升高及传感器数据丢失，存在严重的火灾风险。",
  "reasoning": [
    "推理步骤 1: 分析时间模式与温度趋势。日志显示在 8 月 18 日、19 日和 20 日的早晨（约 07:55 - 08:35），厨房温度传感器读数持续异常偏高（2535-2552，对应实际约 25.35°C-25.52°C，若单位是毫开尔文则约为 24°C+，但结合上下文通常此类异常值代表超出正常范围的热点或设备故障导致的误报/真报临界点，此处更倾向于认为温度处于非正常的‘过热’阈值附近，或者数值本身即为异常高值导致报警）。更重要的是，每次温度升高后不久，烟雾报警器均触发了 ContaminationState 变化（从 1 到 3，通常代表检测到烟雾浓度增加或确认火情）。",
    "推理步骤 2: 关联设备状态。8 月 20 日 08:00:00，厨房温度传感器报告 MeasuredValue = None（数据丢失），紧接着在 08:00:00 同一时刻，烟雾报警器触发 ContaminationState = 3（最高级别警报）。这种传感器失效与最高级别警报的同步发生，强烈暗示物理环境发生了剧烈变化（如明火产生大量烟尘遮挡了温度传感器视线，或电路短路导致两者同时受损），而非单纯的软件误报。",
    "推理步骤 3: 排除正常行为。虽然早晨有人活动（occupancy 为 1），但连续三天在同一时间段出现‘高温 + 烟雾报警’的组合，且第三天伴随传感器数据中断，这不符合正常的烹饪习惯（通常不会连续三天导致传感器损坏或完全失效）。这表明可能存在未受控的烹饪起火、燃气泄漏引发的燃烧，或是厨房线路老化导致的电气火灾前兆。"
  ],
  "key_evidence": [
    "连续三天（8/18, 8/19, 8/20）在相似的时间窗口内，厨房温度显著升高并触发烟雾报警器。",
    "8/20 08:00:00 关键证据：厨房温度传感器返回 None（数据丢失），同时烟雾报警器立即触发最高级别状态（ContaminationState=3），表明传感器可能因火灾烟尘被遮挡或设备烧毁而失效。",
    "温度读数在报警前呈现上升趋势（例如 8/20 从 2512 升至 2532），符合热积累特征。"
  ],
  "recommended_actions": [
    "立即通知住户前往厨房检查，确认是否存在明火、浓烟或焦糊味。",
    "建议住户暂时关闭厨房电源和燃气总阀，以防情况恶化。",
    "联系专业消防部门或物业进行紧急排查，并更换故障的烟雾报警器和温度传感器。",
    "在专业人员确认安全前，禁止进入厨房区域使用电器。"
  ]
}
```


你是一个智能家居安全分析 AI 助手。你的职责是分析智能家居设备的状态日志，判断是否存在安全威胁或异常情况。

你需要基于以下能力进行分析：
1. 从设备状态变化中识别异常模式
2. 结合时间、住户习惯、设备类型进行推理
3. 区分真实威胁和正常行为（减少误报）
4. 对发现的问题给出具体的风险评估和建议

所有设备基于 Matter 协议标准，设备状态通过 Cluster.Attribute 的形式报告。

## 家庭环境信息
家庭布局: 三室两厅 (3BR)
- 重点房间 kitchen: 厨房灯[onoff_light], 厨房灶具[cook_surface], 厨房烟雾报警器[smoke_co_alarm], 厨房温度传感器[temperature_sensor], 厨房窗户传感器[contact_sensor], 洗碗机[dishwasher], 厨房漏水传感器[water_leak_detector]
- 房间 balcony: 阳台灯[onoff_light], 阳台门传感器[contact_sensor], 洗衣机[laundry_washer]
- 房间 dining_room: 餐厅灯[dimmable_light], 餐厅运动传感器[occupancy_sensor]
- 房间 entrance: 入户门锁[door_lock], 入户门传感器[contact_sensor], 玄关灯[onoff_light], 玄关运动传感器[occupancy_sensor]
- 房间 kids_room: 儿童房灯[dimmable_light], 儿童房运动传感器[occupancy_sensor], 儿童房窗帘[window_covering], 儿童房窗户传感器[contact_sensor], 儿童房温度传感器[temperature_sensor]
- 房间 living_room: 客厅主灯[dimmable_light], 客厅副灯[dimmable_light], 客厅氛围灯[onoff_light], 客厅空调[air_conditioner], 客厅温度传感器[temperature_sensor], 客厅运动传感器[occupancy_sensor], 客厅窗帘1[window_covering], 客厅窗户传感器1[contact_sensor], ... 共10个设备
- 房间 master_bathroom: 主卫灯[onoff_light], 主卫运动传感器[occupancy_sensor], 主卫漏水传感器[water_leak_detector]
- 房间 master_bedroom: 主卧灯[dimmable_light], 主卧床头灯[onoff_light], 主卧空调[air_conditioner], 主卧运动传感器[occupancy_sensor], 主卧窗帘[window_covering], 主卧窗户传感器[contact_sensor], 主卧温度传感器[temperature_sensor]
- 房间 second_bathroom: 次卫灯[onoff_light], 次卫漏水传感器[water_leak_detector]
- 房间 second_bedroom: 次卧灯[dimmable_light], 次卧空调[air_conditioner], 次卧运动传感器[occupancy_sensor], 次卧窗帘[window_covering], 次卧窗户传感器[contact_sensor]

## 已选日志说明
以下日志不是整天原始全量心跳，而是围绕关键设备、关键时间窗和跨天模式筛出的训练片段。
- 任务类型: SQ5
- 重点房间: kitchen
- 重点设备: kitchen_cook_surface, kitchen_temp_sensor
- 已选事件数: 46

## 跨天活动摘要
- 2026-08-13: kitchen=13, master_bedroom=232, kids_room=232, entrance=230, dining_room=217, living_room=110

## 设备事件日志
[2026-08-13T00:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2279
[2026-08-13T07:05:33] kitchen_cook_surface | OnOff.OnOff = True
[2026-08-13T08:00:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2524
[2026-08-13T16:10:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2387
[2026-08-13T17:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2339
[2026-08-13T17:45:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2343
[2026-08-13T17:55:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2325
[2026-08-13T18:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2315
[2026-08-13T18:15:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:15:03] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:16:00] front_door_lock | DoorLock.LockState = 2
[2026-08-13T18:16:10] living_room_light_1 | OnOff.OnOff = True
[2026-08-13T18:16:19] living_room_ac | Thermostat.SystemMode = 3
[2026-08-13T18:21:00] kitchen_light | OnOff.OnOff = True
[2026-08-13T18:22:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = None
[2026-08-13T18:26:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:29:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2306
[2026-08-13T18:30:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-13T18:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2307
[2026-08-13T18:35:02] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:40:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2311
[2026-08-13T18:41:03] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:45:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:46:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:49:02] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T18:50:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2291
[2026-08-13T18:53:30] kitchen_window_contact | BooleanState.StateValue = False
[2026-08-13T19:00:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-13T19:00:00] kitchen_cook_surface | OnOff.OnOff = True
[2026-08-13T19:05:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2287
[2026-08-13T19:05:02] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T19:06:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T19:11:03] entrance_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T19:15:00] master_bedroom_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T19:18:06] dining_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T19:20:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2277
[2026-08-13T19:20:00] kitchen_cook_surface | OnOff.OnOff = False
[2026-08-13T19:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 3050
[2026-08-13T19:26:03] living_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T19:30:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2282
[2026-08-13T19:30:00] second_bedroom_occupancy | OccupancySensing.Occupancy = 0
[2026-08-13T19:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 2289
[2026-08-13T19:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 3220
[2026-08-13T19:35:02] kids_room_occupancy | OccupancySensing.Occupancy = 1
[2026-08-13T19:38:06] dining_room_occupancy | OccupancySensing.Occupancy = 1

## 任务
监控系统标记了潜在异常。请分析下面的日志，判断是否需要采取响应措施，并给出建议。

请按以下 JSON 格式回答：

```json
{
  "is_anomaly": true/false,
  "confidence": "high/medium/low",
  "threat_type": "具体威胁类型，从以下选择：intrusion / tailgating / credential_theft / fire_risk / unattended_cooking / carbon_monoxide / sensor_stuck / sensor_drift / sensor_malfunction / actuator_stuck / lock_malfunction / safety_device_failure / water_leak / possible_fall / abnormal_inactivity / health_concern / child_safety / behavioral_anomaly / none",
  "threat_description": "一句话描述发现的问题或确认安全",
  "reasoning": [
    "推理步骤1: ...",
    "推理步骤2: ...",
    "推理步骤3: ..."
  ],
  "key_evidence": [
    "关键证据1",
    "关键证据2"
  ],
  "recommended_actions": [
    "建议措施1",
    "建议措施2"
  ]
}
```

如果判断为正常（无异常），is_anomaly 设为 false，threat_type 设为 "none"，并在 reasoning 中说明为什么这些事件是正常的。

```json
{
  "is_anomaly": true,
  "confidence": "high",
  "threat_type": "fire_risk",
  "threat_description": "厨房灶具关闭后，温度传感器读数出现异常飙升（从~22°C瞬间升至30.5°C和32.2°C），疑似发生干烧、余温积聚或传感器故障，存在火灾隐患。",
  "reasoning": [
    "1. 识别烹饪行为：日志显示用户在19:00开启厨房灶具，并在19:20关闭，符合正常的晚餐烹饪时间窗口。",
    "2. 分析温度数据异常：在灶具关闭后的短时间内（19:25至19:35），厨房温度传感器记录到两次剧烈的温度跳变，分别达到3050 (30.5°C) 和 3220 (32.2°C)。考虑到环境温度通常在22-23°C左右波动，这种短时间内超过8-10度的骤升且随后迅速回落（19:30又回到22.8°C，但19:35再次飙升）的模式极不正常。",
    "3. 排除正常热惯性：虽然刚关火的灶具有余热，但通常不会导致室温传感器在几分钟内产生如此剧烈且不稳定的波动，尤其是第二次读数出现在第一次读数之后，且数值更高，这不符合自然冷却曲线。",
    "4. 判定风险类型：这种异常高温读数可能由两种情况引起：一是实际发生了局部过热/小火苗（如油锅起火前兆或干烧），二是传感器本身因靠近热源或故障而失灵。无论哪种情况，都构成了潜在的安全威胁（火灾风险或设备失效），需要立即人工确认。"
  ],
  "key_evidence": [
    "[2026-08-13T19:20:00] kitchen_cook_surface | OnOff.OnOff = False (灶具关闭)",
    "[2026-08-13T19:25:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 3050 (异常高温)",
    "[2026-08-13T19:35:00] kitchen_temp_sensor | TemperatureMeasurement.MeasuredValue = 3220 (再次异常高温)"
  ],
  "recommended_actions": [
    "立即通过智能家居APP查看厨房摄像头（如有）或发送通知提醒用户检查厨房现场情况。",
    "若确认为传感器误报，建议重新校准或更换厨房温度传感器；若确认为真实火情或过热，请立即启动紧急灭火程序并联系消防部门。"
  ]
}
```

{
  "is_anomaly": true,
  "confidence": "low",
  "threat_type": "intrusion",
  "threat_description": "存在异常，但原因更可能属于其他类别。",
  "reasoning": [
    "推理步骤1: 日志里有异常，但我把它归因为另一类威胁。"
  ],
  "key_evidence": [
    "灶具已关闭"
  ],
  "recommended_actions": [
    "建议按该错误类别处理。"
  ]
}