Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions homeassistant/components/vivotek/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@

CONF_FRAMERATE = "framerate"

CONF_STREAM_PATH = "stream_path"

DEFAULT_CAMERA_BRAND = "Vivotek"
DEFAULT_NAME = "Vivotek Camera"
DEFAULT_EVENT_0_KEY = "event_i0_enable"
DEFAULT_STREAM_SOURCE = "live.sdp"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
Expand All @@ -33,12 +36,14 @@
vol.Optional(CONF_SSL, default=False): cv.boolean,
vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean,
vol.Optional(CONF_FRAMERATE, default=2): cv.positive_int,
vol.Optional(CONF_STREAM_PATH, default=DEFAULT_STREAM_SOURCE): cv.string,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it impossible to detect this automatically?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows choosing a different stream path mostly to allow using a different encoding. I don't see a clear standard for this at the moment so that's why it's open-ended here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

}
)


def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up a Vivotek IP Camera."""
creds = f"{config[CONF_USERNAME]}:{config[CONF_PASSWORD]}"
args = dict(
config=config,
cam=VivotekCamera(
Expand All @@ -48,12 +53,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
usr=config[CONF_USERNAME],
pwd=config[CONF_PASSWORD],
),
stream_source=(
"rtsp://%s:%s@%s:554/live.sdp",
config[CONF_USERNAME],
config[CONF_PASSWORD],
config[CONF_IP_ADDRESS],
),
stream_source=f"rtsp://{creds}@{config[CONF_IP_ADDRESS]}:554/{config[CONF_STREAM_PATH]}",
)
add_entities([VivotekCam(**args)], True)

Expand Down