Add stopping

This commit is contained in:
Shea Smith 2021-11-27 03:05:38 +00:00
parent e910bac1ae
commit e2a776556d
2 changed files with 29 additions and 0 deletions

View File

@ -459,6 +459,26 @@ def ptz_sethome(camera_name):
return "Camera named {} not found".format(camera_name), 404
@bp.route("/<camera_name>/ptz/stop")
def ptz_stop(camera_name):
if (
camera_name in current_app.frigate_config.cameras
and current_app.frigate_config.cameras[camera_name].onvif.host is not None
):
if current_app.ptz_cameras.get(camera_name) is None:
current_app.ptz_cameras[camera_name] = Ptz(
current_app.frigate_config.cameras[camera_name]
)
ptz = current_app.ptz_cameras[camera_name]
ptz.stop()
return "", 204
else:
return "Camera named {} not found".format(camera_name), 404
@bp.route("/<camera_name>/ptz/gotohome")
def ptz_gotohome(camera_name):
if (

View File

@ -98,3 +98,12 @@ class Ptz:
request.Speed.PanTilt.x = self.turn_speed
request.Speed.PanTilt.y = self.turn_speed
self.ptz_service.GotoPreset(request)
def stop(self):
request = {
"ProfileToken": self.move_request.ProfileToken,
"PanTilt": True,
"Zoom": True,
}
self.ptz_service.Stop(request)
self.active = False