mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
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
@ -11,7 +11,7 @@ from homeassistant.const import (
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import dt as dt_util, slugify
|
from homeassistant.util import dt as dt_util, slugify
|
||||||
|
|
||||||
REQUIREMENTS = ['doorbirdpy==2.0.6']
|
REQUIREMENTS = ['doorbirdpy==2.0.8']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import logging
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import async_timeout
|
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 homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
|
||||||
from . import DOMAIN as DOORBIRD_DOMAIN
|
from . import DOMAIN as DOORBIRD_DOMAIN
|
||||||
@ -32,7 +32,8 @@ async def async_setup_platform(hass, config, async_add_entities,
|
|||||||
DoorBirdCamera(
|
DoorBirdCamera(
|
||||||
device.live_image_url,
|
device.live_image_url,
|
||||||
_CAMERA_LIVE.format(doorstation.name),
|
_CAMERA_LIVE.format(doorstation.name),
|
||||||
_LIVE_INTERVAL),
|
_LIVE_INTERVAL,
|
||||||
|
device.rtsp_live_video_url),
|
||||||
DoorBirdCamera(
|
DoorBirdCamera(
|
||||||
device.history_image_url(1, 'doorbell'),
|
device.history_image_url(1, 'doorbell'),
|
||||||
_CAMERA_LAST_VISITOR.format(doorstation.name),
|
_CAMERA_LAST_VISITOR.format(doorstation.name),
|
||||||
@ -47,15 +48,27 @@ async def async_setup_platform(hass, config, async_add_entities,
|
|||||||
class DoorBirdCamera(Camera):
|
class DoorBirdCamera(Camera):
|
||||||
"""The camera on a DoorBird device."""
|
"""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."""
|
"""Initialize the camera on a DoorBird device."""
|
||||||
self._url = url
|
self._url = url
|
||||||
|
self._stream_url = stream_url
|
||||||
self._name = name
|
self._name = name
|
||||||
self._last_image = None
|
self._last_image = None
|
||||||
|
self._supported_features = SUPPORT_STREAM if self._stream_url else 0
|
||||||
self._interval = interval or datetime.timedelta
|
self._interval = interval or datetime.timedelta
|
||||||
self._last_update = datetime.datetime.min
|
self._last_update = datetime.datetime.min
|
||||||
super().__init__()
|
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
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Get the name of the camera."""
|
"""Get the name of the camera."""
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Doorbird",
|
"name": "Doorbird",
|
||||||
"documentation": "https://www.home-assistant.io/components/doorbird",
|
"documentation": "https://www.home-assistant.io/components/doorbird",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"doorbirdpy==2.0.6"
|
"doorbirdpy==2.0.8"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -344,7 +344,7 @@ distro==1.4.0
|
|||||||
dlipower==0.7.165
|
dlipower==0.7.165
|
||||||
|
|
||||||
# homeassistant.components.doorbird
|
# homeassistant.components.doorbird
|
||||||
doorbirdpy==2.0.6
|
doorbirdpy==2.0.8
|
||||||
|
|
||||||
# homeassistant.components.dovado
|
# homeassistant.components.dovado
|
||||||
dovado==0.4.1
|
dovado==0.4.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user