[功能] fam-edge 运动心跳支持 - /api/ss/motion 空 events 心跳刷新, has_motion_in_range_local 按 max_heartbeat_age_sec(900s) fail-open
This commit is contained in:
@@ -205,7 +205,10 @@ def ss_motion():
|
||||
{"event_id": 25349, "camera_id": 2, "event_type": 10,
|
||||
"start_time": 1787318023, "duration": 149, "thumbnail_url": "107471,12075"}
|
||||
]}
|
||||
start_time/duration 为 Unix epoch(与 SS 同源,时区无关)。
|
||||
start_time/duration 为 Unix epoch(与 SS 同源,时区无关)。events 可以是空数组
|
||||
——NAS 侧也会定期用空 events 单纯调一次这个接口当心跳,证明推送链路还活着
|
||||
(鉴权通过就刷新心跳,不要求 stored>0),供 has_motion_in_range_local() 判断
|
||||
"无运动"结论是否可信。
|
||||
落库 ss_motion_events(按 event_id 幂等),供 video_processor 本地预过滤使用。
|
||||
"""
|
||||
if not _check_token():
|
||||
@@ -218,6 +221,7 @@ def ss_motion():
|
||||
return jsonify({"error": "events 必须是数组"}), 400
|
||||
try:
|
||||
stored = state.get_db().record_motion_events(events)
|
||||
state.get_db().record_motion_heartbeat()
|
||||
except Exception as e:
|
||||
logger.error(f"ss_motion 落库异常: {e}")
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
Reference in New Issue
Block a user