Fix camera onboarding and consolidate device management for v0.1.33
This commit is contained in:
@@ -230,6 +230,7 @@ def save_camera(body, actor=None):
|
||||
item['archiveRecorderId'] = archive_recorder
|
||||
item.update(id=key, siteId=site, host=host_address(recorder['host'] if recorder else body.get('host', '')),
|
||||
port=integer(recorder['port'] if recorder else body.get('port', 554), 1, 65535), familyId=family)
|
||||
item['onvifPort'] = integer(body.get('onvifPort', old.get('onvifPort', 80)), 1, 65535)
|
||||
HOUSEHOLDS.endpoint(actor, item['host'])
|
||||
for k, default in [('mainPath', '/stream1'), ('subPath', '/stream2')]:
|
||||
path = clean_text(body.get(k, default), 500, required=True)
|
||||
@@ -768,6 +769,10 @@ class Handler(BaseHTTPRequestHandler):
|
||||
raise Problem('设备密码格式不正确')
|
||||
try:
|
||||
result = onvif.inspect(host, port, username, password)
|
||||
except PermissionError:
|
||||
raise Problem('摄像机认证失败,请填写设备本地账号和密码;平台接入密码可能不同', 422)
|
||||
except (urllib.error.URLError, TimeoutError, OSError):
|
||||
raise Problem('服务器无法连接摄像机,请检查设备地址、ONVIF 端口以及服务器到该局域网的路由', 502)
|
||||
except Exception:
|
||||
raise Problem('ONVIF 读取未成功,请检查账号、设备时间、服务端口及 ONVIF 是否启用', 502)
|
||||
self.answer(result)
|
||||
|
||||
Reference in New Issue
Block a user