Use EntityFeature in ffmpeg (#69390)
This commit is contained in:
parent
20c1a155b6
commit
1fe5b1e68a
1 changed files with 3 additions and 6 deletions
|
@ -5,7 +5,7 @@ from haffmpeg.camera import CameraMjpeg
|
||||||
from haffmpeg.tools import IMAGE_JPEG
|
from haffmpeg.tools import IMAGE_JPEG
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
|
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera, CameraEntityFeature
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
|
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
|
||||||
|
@ -40,6 +40,8 @@ async def async_setup_platform(
|
||||||
class FFmpegCamera(Camera):
|
class FFmpegCamera(Camera):
|
||||||
"""An implementation of an FFmpeg camera."""
|
"""An implementation of an FFmpeg camera."""
|
||||||
|
|
||||||
|
_attr_supported_features = CameraEntityFeature.STREAM
|
||||||
|
|
||||||
def __init__(self, hass, config):
|
def __init__(self, hass, config):
|
||||||
"""Initialize a FFmpeg camera."""
|
"""Initialize a FFmpeg camera."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -49,11 +51,6 @@ class FFmpegCamera(Camera):
|
||||||
self._input = config.get(CONF_INPUT)
|
self._input = config.get(CONF_INPUT)
|
||||||
self._extra_arguments = config.get(CONF_EXTRA_ARGUMENTS)
|
self._extra_arguments = config.get(CONF_EXTRA_ARGUMENTS)
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return supported features."""
|
|
||||||
return SUPPORT_STREAM
|
|
||||||
|
|
||||||
async def stream_source(self):
|
async def stream_source(self):
|
||||||
"""Return the stream source."""
|
"""Return the stream source."""
|
||||||
return self._input.split(" ")[-1]
|
return self._input.split(" ")[-1]
|
||||||
|
|
Loading…
Add table
Reference in a new issue