log an error if a ptz doesn't report a MoveStatus

This commit is contained in:
Josh Hawkins 2023-09-26 15:49:08 -05:00
parent 7edadf7be5
commit 14c197ff6c

View File

@ -152,6 +152,8 @@ class OnvifController:
status_request = ptz.create_type("GetStatus") status_request = ptz.create_type("GetStatus")
status_request.ProfileToken = profile.token status_request.ProfileToken = profile.token
self.cams[camera_name]["status_request"] = status_request self.cams[camera_name]["status_request"] = status_request
status = ptz.GetStatus(status_request)
logger.debug(f"Onvif status config for {camera_name}: {status}")
# setup existing presets # setup existing presets
try: try:
@ -461,6 +463,12 @@ class OnvifController:
pan_tilt_status = getattr(status.MoveStatus, "PanTilt", None) pan_tilt_status = getattr(status.MoveStatus, "PanTilt", None)
zoom_status = getattr(status.MoveStatus, "Zoom", None) zoom_status = getattr(status.MoveStatus, "Zoom", None)
if pan_tilt_status is None:
logger.error(
f"Camera {camera_name} does not support the ONVIF GetStatus method. Autotracking will not function correctly and must be disabled in your config."
)
return
if pan_tilt_status == "IDLE" and (zoom_status is None or zoom_status == "IDLE"): if pan_tilt_status == "IDLE" and (zoom_status is None or zoom_status == "IDLE"):
self.cams[camera_name]["active"] = False self.cams[camera_name]["active"] = False
if not self.ptz_metrics[camera_name]["ptz_stopped"].is_set(): if not self.ptz_metrics[camera_name]["ptz_stopped"].is_set():