Catch onvif command error

This commit is contained in:
Nicolas Mowen 2024-12-19 07:30:43 -07:00
parent b149828c9f
commit 7bf2b56ce6

View File

@ -558,6 +558,7 @@ class OnvifController:
if not self._init_onvif(camera_name): if not self._init_onvif(camera_name):
return return
try:
if command == OnvifCommandEnum.init: if command == OnvifCommandEnum.init:
# already init # already init
return return
@ -569,11 +570,14 @@ class OnvifController:
_, pan, tilt = param.split("_") _, pan, tilt = param.split("_")
self._move_relative(camera_name, float(pan), float(tilt), 0, 1) self._move_relative(camera_name, float(pan), float(tilt), 0, 1)
elif ( elif (
command == OnvifCommandEnum.zoom_in or command == OnvifCommandEnum.zoom_out command == OnvifCommandEnum.zoom_in
or command == OnvifCommandEnum.zoom_out
): ):
self._zoom(camera_name, command) self._zoom(camera_name, command)
else: else:
self._move(camera_name, command) self._move(camera_name, command)
except ONVIFError as e:
logger.error(f"Unable to handle onvif command: {e}")
def get_camera_info(self, camera_name: str) -> dict[str, any]: def get_camera_info(self, camera_name: str) -> dict[str, any]:
if camera_name not in self.cams.keys(): if camera_name not in self.cams.keys():