mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +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",
|
||||
"dhcp",
|
||||
"energy",
|
||||
"go2rtc",
|
||||
"history",
|
||||
"homeassistant_alerts",
|
||||
"logbook",
|
||||
|
@ -62,8 +62,12 @@ CONFIG_SCHEMA = vol.Schema(
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up WebRTC."""
|
||||
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 configured_by_user:
|
||||
return True
|
||||
_LOGGER.warning("Go2rtc URL required in non-docker installs")
|
||||
return False
|
||||
if not (binary := await _get_binary(hass)):
|
||||
|
@ -26,6 +26,7 @@ ciso8601==2.3.1
|
||||
cryptography==43.0.1
|
||||
dbus-fast==2.24.3
|
||||
fnv-hash-fast==1.0.2
|
||||
go2rtc-client==0.0.1b0
|
||||
ha-av==10.1.1
|
||||
ha-ffmpeg==3.2.1
|
||||
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"
|
||||
|
||||
|
||||
@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(
|
||||
("config", "go2rtc_binary", "is_docker_env", "expected_log_message"),
|
||||
[
|
||||
({}, None, False, "KeyError: 'go2rtc'"),
|
||||
({}, None, True, "KeyError: 'go2rtc'"),
|
||||
({}, None, True, ERR_BINARY_NOT_FOUND),
|
||||
({}, "/usr/bin/go2rtc", True, ERR_CONNECT),
|
||||
({DOMAIN: {}}, None, False, ERR_URL_REQUIRED),
|
||||
({DOMAIN: {}}, None, True, ERR_BINARY_NOT_FOUND),
|
||||
({DOMAIN: {}}, "/usr/bin/go2rtc", True, ERR_CONNECT),
|
||||
|
Loading…
x
Reference in New Issue
Block a user