[修复] MotionNotifier 补回 camera_ids 属性 - 避免重新开启轮询时 _fetch_events 引用缺失属性崩溃

This commit is contained in:
ericwyuan
2026-08-22 10:58:56 +08:00
parent ca6d425b19
commit e52d8e9103

View File

@@ -61,6 +61,8 @@ class MotionNotifier:
self.timeout = int(cfg.get('timeout_sec', 10)) self.timeout = int(cfg.get('timeout_sec', 10))
# 是否启用轮询:用户要求不轮询,改由 SS Webhook 推送(默认关闭) # 是否启用轮询:用户要求不轮询,改由 SS Webhook 推送(默认关闭)
self.poll_enabled = bool(cfg.get('poll_enabled', False)) self.poll_enabled = bool(cfg.get('poll_enabled', False))
# 轮询路径poll_enabled=true 时关注的摄像头Webhook 路径用摄像头名映射
self.camera_ids = cfg.get('camera_ids', [2])
# 摄像头名 -> camera_id 静态映射(优先),启动时再从 SS 拉一份补全 # 摄像头名 -> camera_id 静态映射(优先),启动时再从 SS 拉一份补全
self.camera_name_to_id = { self.camera_name_to_id = {
str(k): int(v) for k, v in (cfg.get('camera_name_to_id') or {}).items() str(k): int(v) for k, v in (cfg.get('camera_name_to_id') or {}).items()