-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcheck_ptz.py
More file actions
36 lines (31 loc) · 874 Bytes
/
check_ptz.py
File metadata and controls
36 lines (31 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Path: examples/check_ptz.py
Author: @kaburagisec
Created: September 17, 2025
Tested devices: EZVIZ H8C (https://www.ezviz.com/inter/product/h8c/43162)
This script checks basic PTZ functionality of an ONVIF-compliant device.
"""
from time import sleep
from onvif import ONVIFClient
HOST = "192.168.1.3"
PORT = 80
USERNAME = "admin"
PASSWORD = "admin123"
try:
client = ONVIFClient(HOST, PORT, USERNAME, PASSWORD)
media = client.media()
profile = media.GetProfiles()[0]
ptz = client.ptz()
ptz.ContinuousMove(
ProfileToken=profile.token,
Velocity={"PanTilt": {"x": 0.1, "y": 0}}, # pan right
)
sleep(2)
ptz.ContinuousMove(
ProfileToken=profile.token,
Velocity={"PanTilt": {"x": -0.1, "y": 0}}, # pan left
)
sleep(2.5)
ptz.Stop(ProfileToken=profile.token)
except Exception as e:
print(e)