1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Google Assistant: Add camera stream trait (#22278)

* Add camera stream trait

* Lint
This commit is contained in:
Paulus Schoutsen
2019-03-23 09:16:43 -07:00
committed by GitHub
parent d81df1f0ae
commit c68b621972
7 changed files with 176 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ from homeassistant.const import (
HTTP_BASIC_AUTHENTICATION, HTTP_DIGEST_AUTHENTICATION, CONF_VERIFY_SSL)
from homeassistant.exceptions import TemplateError
from homeassistant.components.camera import (
PLATFORM_SCHEMA, DEFAULT_CONTENT_TYPE, Camera)
PLATFORM_SCHEMA, DEFAULT_CONTENT_TYPE, SUPPORT_STREAM, Camera)
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers import config_validation as cv
from homeassistant.util.async_ import run_coroutine_threadsafe
@@ -68,6 +68,7 @@ class GenericCamera(Camera):
self._still_image_url.hass = hass
self._limit_refetch = device_info[CONF_LIMIT_REFETCH_TO_URL_CHANGE]
self._frame_interval = 1 / device_info[CONF_FRAMERATE]
self._supported_features = SUPPORT_STREAM if self._stream_source else 0
self.content_type = device_info[CONF_CONTENT_TYPE]
self.verify_ssl = device_info[CONF_VERIFY_SSL]
@@ -85,6 +86,11 @@ class GenericCamera(Camera):
self._last_url = None
self._last_image = None
@property
def supported_features(self):
"""Return supported features for this camera."""
return self._supported_features
@property
def frame_interval(self):
"""Return the interval between frames of the mjpeg stream."""