Add ONVIF PTZ Stop support (#39734)
This commit is contained in:
parent
b4381c5005
commit
cab186d28f
4 changed files with 13 additions and 2 deletions
|
@ -35,6 +35,7 @@ from .const import (
|
|||
LOGGER,
|
||||
RELATIVE_MOVE,
|
||||
SERVICE_PTZ,
|
||||
STOP_MOVE,
|
||||
ZOOM_IN,
|
||||
ZOOM_OUT,
|
||||
)
|
||||
|
@ -54,7 +55,13 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
vol.Optional(ATTR_DISTANCE, default=0.1): cv.small_float,
|
||||
vol.Optional(ATTR_SPEED, default=0.5): cv.small_float,
|
||||
vol.Optional(ATTR_MOVE_MODE, default=RELATIVE_MOVE): vol.In(
|
||||
[CONTINUOUS_MOVE, RELATIVE_MOVE, ABSOLUTE_MOVE, GOTOPRESET_MOVE]
|
||||
[
|
||||
CONTINUOUS_MOVE,
|
||||
RELATIVE_MOVE,
|
||||
ABSOLUTE_MOVE,
|
||||
GOTOPRESET_MOVE,
|
||||
STOP_MOVE,
|
||||
]
|
||||
),
|
||||
vol.Optional(ATTR_CONTINUOUS_DURATION, default=0.5): cv.small_float,
|
||||
vol.Optional(ATTR_PRESET, default="0"): cv.string,
|
||||
|
|
|
@ -39,5 +39,6 @@ CONTINUOUS_MOVE = "ContinuousMove"
|
|||
RELATIVE_MOVE = "RelativeMove"
|
||||
ABSOLUTE_MOVE = "AbsoluteMove"
|
||||
GOTOPRESET_MOVE = "GotoPreset"
|
||||
STOP_MOVE = "Stop"
|
||||
|
||||
SERVICE_PTZ = "ptz"
|
||||
|
|
|
@ -28,6 +28,7 @@ from .const import (
|
|||
LOGGER,
|
||||
PAN_FACTOR,
|
||||
RELATIVE_MOVE,
|
||||
STOP_MOVE,
|
||||
TILT_FACTOR,
|
||||
ZOOM_FACTOR,
|
||||
)
|
||||
|
@ -433,6 +434,8 @@ class ONVIFDevice:
|
|||
"Zoom": {"x": speed_val},
|
||||
}
|
||||
await ptz_service.GotoPreset(req)
|
||||
elif move_mode == STOP_MOVE:
|
||||
await ptz_service.Stop(req)
|
||||
except ONVIFError as err:
|
||||
if "Bad Request" in err.reason:
|
||||
LOGGER.warning("Device '%s' doesn't support PTZ.", self.name)
|
||||
|
|
|
@ -29,6 +29,6 @@ ptz:
|
|||
description: "PTZ preset profile token. Sets the preset profile token which is executed with GotoPreset"
|
||||
example: "1"
|
||||
move_mode:
|
||||
description: "PTZ moving mode. One of ContinuousMove, RelativeMove, AbsoluteMove or GotoPreset"
|
||||
description: "PTZ moving mode. One of ContinuousMove, RelativeMove, AbsoluteMove, GotoPreset, or Stop"
|
||||
default: "RelativeMove"
|
||||
example: "ContinuousMove"
|
||||
|
|
Loading…
Add table
Reference in a new issue