mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-01 16:55:21 +03:00
Add stopping
This commit is contained in:
parent
e910bac1ae
commit
e2a776556d
@ -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 (
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user