mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Include go2rtc in default_config (#129144)
* Include go2rtc in default_config * Fail if binary not found in docker environment
This commit is contained in:
parent
7b8a32f630
commit
4f1e4e7471
@ -9,6 +9,7 @@
|
|||||||
"conversation",
|
"conversation",
|
||||||
"dhcp",
|
"dhcp",
|
||||||
"energy",
|
"energy",
|
||||||
|
"go2rtc",
|
||||||
"history",
|
"history",
|
||||||
"homeassistant_alerts",
|
"homeassistant_alerts",
|
||||||
"logbook",
|
"logbook",
|
||||||
|
@ -62,8 +62,12 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up WebRTC."""
|
"""Set up WebRTC."""
|
||||||
url: str | None = None
|
url: str | None = None
|
||||||
if not (url := config[DOMAIN].get(CONF_URL)):
|
if not (configured_by_user := DOMAIN in config) or not (
|
||||||
|
url := config[DOMAIN].get(CONF_URL)
|
||||||
|
):
|
||||||
if not is_docker_env():
|
if not is_docker_env():
|
||||||
|
if not configured_by_user:
|
||||||
|
return True
|
||||||
_LOGGER.warning("Go2rtc URL required in non-docker installs")
|
_LOGGER.warning("Go2rtc URL required in non-docker installs")
|
||||||
return False
|
return False
|
||||||
if not (binary := await _get_binary(hass)):
|
if not (binary := await _get_binary(hass)):
|
||||||
|
@ -26,6 +26,7 @@ ciso8601==2.3.1
|
|||||||
cryptography==43.0.1
|
cryptography==43.0.1
|
||||||
dbus-fast==2.24.3
|
dbus-fast==2.24.3
|
||||||
fnv-hash-fast==1.0.2
|
fnv-hash-fast==1.0.2
|
||||||
|
go2rtc-client==0.0.1b0
|
||||||
ha-av==10.1.1
|
ha-av==10.1.1
|
||||||
ha-ffmpeg==3.2.1
|
ha-ffmpeg==3.2.1
|
||||||
habluetooth==3.6.0
|
habluetooth==3.6.0
|
||||||
|
@ -259,11 +259,28 @@ ERR_INVALID_URL = "Invalid config for 'go2rtc': invalid url"
|
|||||||
ERR_URL_REQUIRED = "Go2rtc URL required in non-docker installs"
|
ERR_URL_REQUIRED = "Go2rtc URL required in non-docker installs"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("config", "go2rtc_binary", "is_docker_env"),
|
||||||
|
[
|
||||||
|
({}, None, False),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@pytest.mark.usefixtures("mock_get_binary", "mock_is_docker_env", "mock_server")
|
||||||
|
async def test_non_user_setup_with_error(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
caplog: pytest.LogCaptureFixture,
|
||||||
|
) -> None:
|
||||||
|
"""Test setup integration does not fail if not setup by user."""
|
||||||
|
|
||||||
|
assert await async_setup_component(hass, DOMAIN, config)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("config", "go2rtc_binary", "is_docker_env", "expected_log_message"),
|
("config", "go2rtc_binary", "is_docker_env", "expected_log_message"),
|
||||||
[
|
[
|
||||||
({}, None, False, "KeyError: 'go2rtc'"),
|
({}, None, True, ERR_BINARY_NOT_FOUND),
|
||||||
({}, None, True, "KeyError: 'go2rtc'"),
|
({}, "/usr/bin/go2rtc", True, ERR_CONNECT),
|
||||||
({DOMAIN: {}}, None, False, ERR_URL_REQUIRED),
|
({DOMAIN: {}}, None, False, ERR_URL_REQUIRED),
|
||||||
({DOMAIN: {}}, None, True, ERR_BINARY_NOT_FOUND),
|
({DOMAIN: {}}, None, True, ERR_BINARY_NOT_FOUND),
|
||||||
({DOMAIN: {}}, "/usr/bin/go2rtc", True, ERR_CONNECT),
|
({DOMAIN: {}}, "/usr/bin/go2rtc", True, ERR_CONNECT),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user