Stream support for Doorbird component (#22876)
* Support stream source for doorbird live camera * Support stream source for doorbird live camera * Support stream component on Doorbird camera entities * Bump library version * Update manifest * Lint * Correct parameter order
This commit is contained in:
parent
d8c7160377
commit
36c135c785
4 changed files with 19 additions and 6 deletions
|
@ -11,7 +11,7 @@ from homeassistant.const import (
|
|||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util import dt as dt_util, slugify
|
||||
|
||||
REQUIREMENTS = ['doorbirdpy==2.0.6']
|
||||
REQUIREMENTS = ['doorbirdpy==2.0.8']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
|||
import aiohttp
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components.camera import Camera
|
||||
from homeassistant.components.camera import Camera, SUPPORT_STREAM
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from . import DOMAIN as DOORBIRD_DOMAIN
|
||||
|
@ -32,7 +32,8 @@ async def async_setup_platform(hass, config, async_add_entities,
|
|||
DoorBirdCamera(
|
||||
device.live_image_url,
|
||||
_CAMERA_LIVE.format(doorstation.name),
|
||||
_LIVE_INTERVAL),
|
||||
_LIVE_INTERVAL,
|
||||
device.rtsp_live_video_url),
|
||||
DoorBirdCamera(
|
||||
device.history_image_url(1, 'doorbell'),
|
||||
_CAMERA_LAST_VISITOR.format(doorstation.name),
|
||||
|
@ -47,15 +48,27 @@ async def async_setup_platform(hass, config, async_add_entities,
|
|||
class DoorBirdCamera(Camera):
|
||||
"""The camera on a DoorBird device."""
|
||||
|
||||
def __init__(self, url, name, interval=None):
|
||||
def __init__(self, url, name, interval=None, stream_url=None):
|
||||
"""Initialize the camera on a DoorBird device."""
|
||||
self._url = url
|
||||
self._stream_url = stream_url
|
||||
self._name = name
|
||||
self._last_image = None
|
||||
self._supported_features = SUPPORT_STREAM if self._stream_url else 0
|
||||
self._interval = interval or datetime.timedelta
|
||||
self._last_update = datetime.datetime.min
|
||||
super().__init__()
|
||||
|
||||
@property
|
||||
def stream_source(self):
|
||||
"""Return the stream source."""
|
||||
return self._stream_url
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Return supported features."""
|
||||
return self._supported_features
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Get the name of the camera."""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Doorbird",
|
||||
"documentation": "https://www.home-assistant.io/components/doorbird",
|
||||
"requirements": [
|
||||
"doorbirdpy==2.0.6"
|
||||
"doorbirdpy==2.0.8"
|
||||
],
|
||||
"dependencies": [],
|
||||
"codeowners": [
|
||||
|
|
|
@ -344,7 +344,7 @@ distro==1.4.0
|
|||
dlipower==0.7.165
|
||||
|
||||
# homeassistant.components.doorbird
|
||||
doorbirdpy==2.0.6
|
||||
doorbirdpy==2.0.8
|
||||
|
||||
# homeassistant.components.dovado
|
||||
dovado==0.4.1
|
||||
|
|
Loading…
Add table
Reference in a new issue