mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Don't check autotracking onvif requirements for users with autotracking disabled (#10350)
* separate autotracking onvif needs from standard ptz control setup * try/except around GetServiceCapabilities call
This commit is contained in:
parent
62d13024f6
commit
9fc1286568
@ -120,6 +120,16 @@ class OnvifController:
|
|||||||
|
|
||||||
ptz = onvif.create_ptz_service()
|
ptz = onvif.create_ptz_service()
|
||||||
|
|
||||||
|
# setup continuous moving request
|
||||||
|
move_request = ptz.create_type("ContinuousMove")
|
||||||
|
move_request.ProfileToken = profile.token
|
||||||
|
self.cams[camera_name]["move_request"] = move_request
|
||||||
|
|
||||||
|
# extra setup for autotracking cameras
|
||||||
|
if (
|
||||||
|
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
|
||||||
|
and self.config.cameras[camera_name].onvif.autotracking.enabled
|
||||||
|
):
|
||||||
request = ptz.create_type("GetConfigurationOptions")
|
request = ptz.create_type("GetConfigurationOptions")
|
||||||
request.ConfigurationToken = profile.PTZConfiguration.token
|
request.ConfigurationToken = profile.PTZConfiguration.token
|
||||||
ptz_config = ptz.GetConfigurationOptions(request)
|
ptz_config = ptz.GetConfigurationOptions(request)
|
||||||
@ -169,11 +179,6 @@ class OnvifController:
|
|||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
||||||
# setup continuous moving request
|
|
||||||
move_request = ptz.create_type("ContinuousMove")
|
|
||||||
move_request.ProfileToken = profile.token
|
|
||||||
self.cams[camera_name]["move_request"] = move_request
|
|
||||||
|
|
||||||
# setup relative moving request for autotracking
|
# setup relative moving request for autotracking
|
||||||
move_request = ptz.create_type("RelativeMove")
|
move_request = ptz.create_type("RelativeMove")
|
||||||
move_request.ProfileToken = profile.token
|
move_request.ProfileToken = profile.token
|
||||||
@ -242,6 +247,10 @@ class OnvifController:
|
|||||||
|
|
||||||
if configs.DefaultRelativeZoomTranslationSpace:
|
if configs.DefaultRelativeZoomTranslationSpace:
|
||||||
supported_features.append("zoom-r")
|
supported_features.append("zoom-r")
|
||||||
|
if (
|
||||||
|
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
|
||||||
|
and self.config.cameras[camera_name].onvif.autotracking.enabled
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
# get camera's zoom limits from onvif config
|
# get camera's zoom limits from onvif config
|
||||||
self.cams[camera_name]["relative_zoom_range"] = (
|
self.cams[camera_name]["relative_zoom_range"] = (
|
||||||
@ -261,6 +270,10 @@ class OnvifController:
|
|||||||
|
|
||||||
if configs.DefaultAbsoluteZoomPositionSpace:
|
if configs.DefaultAbsoluteZoomPositionSpace:
|
||||||
supported_features.append("zoom-a")
|
supported_features.append("zoom-a")
|
||||||
|
if (
|
||||||
|
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
|
||||||
|
and self.config.cameras[camera_name].onvif.autotracking.enabled
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
# get camera's zoom limits from onvif config
|
# get camera's zoom limits from onvif config
|
||||||
self.cams[camera_name]["absolute_zoom_range"] = (
|
self.cams[camera_name]["absolute_zoom_range"] = (
|
||||||
@ -278,7 +291,9 @@ class OnvifController:
|
|||||||
|
|
||||||
# set relative pan/tilt space for autotracker
|
# set relative pan/tilt space for autotracker
|
||||||
if (
|
if (
|
||||||
fov_space_id is not None
|
self.config.cameras[camera_name].onvif.autotracking.enabled_in_config
|
||||||
|
and self.config.cameras[camera_name].onvif.autotracking.enabled
|
||||||
|
and fov_space_id is not None
|
||||||
and configs.DefaultRelativePanTiltTranslationSpace is not None
|
and configs.DefaultRelativePanTiltTranslationSpace is not None
|
||||||
):
|
):
|
||||||
supported_features.append("pt-r-fov")
|
supported_features.append("pt-r-fov")
|
||||||
@ -554,6 +569,7 @@ class OnvifController:
|
|||||||
service_capabilities_request = self.cams[camera_name][
|
service_capabilities_request = self.cams[camera_name][
|
||||||
"service_capabilities_request"
|
"service_capabilities_request"
|
||||||
]
|
]
|
||||||
|
try:
|
||||||
service_capabilities = onvif.get_service("ptz").GetServiceCapabilities(
|
service_capabilities = onvif.get_service("ptz").GetServiceCapabilities(
|
||||||
service_capabilities_request
|
service_capabilities_request
|
||||||
)
|
)
|
||||||
@ -564,6 +580,11 @@ class OnvifController:
|
|||||||
|
|
||||||
# MoveStatus is required for autotracking - should return "true" if supported
|
# MoveStatus is required for autotracking - should return "true" if supported
|
||||||
return find_by_key(vars(service_capabilities), "MoveStatus")
|
return find_by_key(vars(service_capabilities), "MoveStatus")
|
||||||
|
except Exception:
|
||||||
|
logger.warning(
|
||||||
|
f"Camera {camera_name} does not support the ONVIF GetServiceCapabilities method. Autotracking will not function correctly and must be disabled in your config."
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
def get_camera_status(self, camera_name: str) -> None:
|
def get_camera_status(self, camera_name: str) -> None:
|
||||||
if camera_name not in self.cams.keys():
|
if camera_name not in self.cams.keys():
|
||||||
|
Loading…
Reference in New Issue
Block a user