Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Constants for the onvif component."""
2 
3 import logging
4 
5 from httpx import RequestError
6 from onvif.exceptions import ONVIFError
7 from zeep.exceptions import Fault, TransportError
8 
9 LOGGER = logging.getLogger(__package__)
10 
11 DOMAIN = "onvif"
12 
13 DEFAULT_PORT = 80
14 DEFAULT_ARGUMENTS = "-pred 1"
15 
16 CONF_DEVICE_ID = "deviceid"
17 CONF_HARDWARE = "hardware"
18 CONF_SNAPSHOT_AUTH = "snapshot_auth"
19 CONF_ENABLE_WEBHOOKS = "enable_webhooks"
20 DEFAULT_ENABLE_WEBHOOKS = True
21 
22 ATTR_PAN = "pan"
23 ATTR_TILT = "tilt"
24 ATTR_ZOOM = "zoom"
25 ATTR_DISTANCE = "distance"
26 ATTR_SPEED = "speed"
27 ATTR_MOVE_MODE = "move_mode"
28 ATTR_CONTINUOUS_DURATION = "continuous_duration"
29 ATTR_PRESET = "preset"
30 
31 DIR_UP = "UP"
32 DIR_DOWN = "DOWN"
33 DIR_LEFT = "LEFT"
34 DIR_RIGHT = "RIGHT"
35 ZOOM_OUT = "ZOOM_OUT"
36 ZOOM_IN = "ZOOM_IN"
37 PAN_FACTOR = {DIR_RIGHT: 1, DIR_LEFT: -1}
38 TILT_FACTOR = {DIR_UP: 1, DIR_DOWN: -1}
39 ZOOM_FACTOR = {ZOOM_IN: 1, ZOOM_OUT: -1}
40 CONTINUOUS_MOVE = "ContinuousMove"
41 RELATIVE_MOVE = "RelativeMove"
42 ABSOLUTE_MOVE = "AbsoluteMove"
43 GOTOPRESET_MOVE = "GotoPreset"
44 STOP_MOVE = "Stop"
45 
46 SERVICE_PTZ = "ptz"
47 
48 
49 # Some cameras don't support the GetServiceCapabilities call
50 # and will return a 404 error which is caught by TransportError
51 GET_CAPABILITIES_EXCEPTIONS = (ONVIFError, Fault, RequestError, TransportError)