Bump rtsp_to_webrtc to 0.4.0 (#63359)

This commit is contained in:
Allen Porter 2022-01-04 02:31:33 -08:00 committed by GitHub
parent 5140c1fa6a
commit 9c166dfff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 6 deletions

View file

@ -21,8 +21,9 @@ from __future__ import annotations
import logging
import async_timeout
from rtsp_to_webrtc.client import Client
from rtsp_to_webrtc.client import get_adaptive_client
from rtsp_to_webrtc.exceptions import ClientError, ResponseError
from rtsp_to_webrtc.interface import WebRTCClientInterface
from homeassistant.components import camera
from homeassistant.config_entries import ConfigEntry
@ -42,10 +43,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up RTSPtoWebRTC from a config entry."""
hass.data.setdefault(DOMAIN, {})
client = Client(async_get_clientsession(hass), entry.data[DATA_SERVER_URL])
client: WebRTCClientInterface
try:
async with async_timeout.timeout(TIMEOUT):
await client.heartbeat()
client = await get_adaptive_client(
async_get_clientsession(hass), entry.data[DATA_SERVER_URL]
)
except ResponseError as err:
raise ConfigEntryNotReady from err
except (TimeoutError, ClientError) as err:

View file

@ -3,7 +3,7 @@
"name": "RTSPtoWebRTC",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/rtsp_to_webrtc",
"requirements": ["rtsp-to-webrtc==0.2.7"],
"requirements": ["rtsp-to-webrtc==0.4.0"],
"dependencies": ["camera"],
"codeowners": [
"@allenporter"

View file

@ -2114,7 +2114,7 @@ rpi-bad-power==0.1.0
# rpi-rf==0.9.7
# homeassistant.components.rtsp_to_webrtc
rtsp-to-webrtc==0.2.7
rtsp-to-webrtc==0.4.0
# homeassistant.components.russound_rnet
russound==0.1.9

View file

@ -1279,7 +1279,7 @@ roonapi==0.0.38
rpi-bad-power==0.1.0
# homeassistant.components.rtsp_to_webrtc
rtsp-to-webrtc==0.2.7
rtsp-to-webrtc==0.4.0
# homeassistant.components.yamaha
rxv==0.7.0

View file

@ -31,6 +31,16 @@ SERVER_URL = "http://127.0.0.1:8083"
CONFIG_ENTRY_DATA = {"server_url": SERVER_URL}
@pytest.fixture(autouse=True)
async def webrtc_server() -> None:
"""Patch client library to force usage of RTSPtoWebRTC server."""
with patch(
"rtsp_to_webrtc.client.WebClient.heartbeat",
side_effect=rtsp_to_webrtc.exceptions.ResponseError(),
):
yield
@pytest.fixture
async def mock_camera(hass) -> AsyncGenerator[None, None]:
"""Initialize a demo camera platform."""