mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
commit
d82d7fa2e9
@ -73,8 +73,8 @@ async def async_setup(hass, config):
|
|||||||
conf.get("ssh_key", conf.get("pub_key", "")),
|
conf.get("ssh_key", conf.get("pub_key", "")),
|
||||||
conf[CONF_MODE],
|
conf[CONF_MODE],
|
||||||
conf[CONF_REQUIRE_IP],
|
conf[CONF_REQUIRE_IP],
|
||||||
conf[CONF_INTERFACE],
|
interface=conf[CONF_INTERFACE],
|
||||||
conf[CONF_DNSMASQ],
|
dnsmasq=conf[CONF_DNSMASQ],
|
||||||
)
|
)
|
||||||
|
|
||||||
await api.connection.async_connect()
|
await api.connection.async_connect()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "asuswrt",
|
"domain": "asuswrt",
|
||||||
"name": "ASUSWRT",
|
"name": "ASUSWRT",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/asuswrt",
|
"documentation": "https://www.home-assistant.io/integrations/asuswrt",
|
||||||
"requirements": ["aioasuswrt==1.2.2"],
|
"requirements": ["aioasuswrt==1.2.3"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": ["@kennedyshead"]
|
"codeowners": ["@kennedyshead"]
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "SimpliSafe",
|
"name": "SimpliSafe",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/simplisafe",
|
"documentation": "https://www.home-assistant.io/integrations/simplisafe",
|
||||||
"requirements": ["simplisafe-python==9.0.3"],
|
"requirements": ["simplisafe-python==9.0.4"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": ["@bachya"]
|
"codeowners": ["@bachya"]
|
||||||
}
|
}
|
||||||
|
@ -562,34 +562,36 @@ def _log_pkg_error(package: str, component: str, config: Dict, message: str) ->
|
|||||||
_LOGGER.error(message)
|
_LOGGER.error(message)
|
||||||
|
|
||||||
|
|
||||||
def _identify_config_schema(module: ModuleType) -> Tuple[Optional[str], Optional[Dict]]:
|
def _identify_config_schema(module: ModuleType) -> Optional[str]:
|
||||||
"""Extract the schema and identify list or dict based."""
|
"""Extract the schema and identify list or dict based."""
|
||||||
try:
|
try:
|
||||||
key = next(k for k in module.CONFIG_SCHEMA.schema if k == module.DOMAIN) # type: ignore
|
key = next(k for k in module.CONFIG_SCHEMA.schema if k == module.DOMAIN) # type: ignore
|
||||||
except (AttributeError, StopIteration):
|
except (AttributeError, StopIteration):
|
||||||
return None, None
|
return None
|
||||||
|
|
||||||
schema = module.CONFIG_SCHEMA.schema[key] # type: ignore
|
schema = module.CONFIG_SCHEMA.schema[key] # type: ignore
|
||||||
|
|
||||||
if hasattr(key, "default") and not isinstance(
|
if hasattr(key, "default") and not isinstance(
|
||||||
key.default, vol.schema_builder.Undefined
|
key.default, vol.schema_builder.Undefined
|
||||||
):
|
):
|
||||||
default_value = schema(key.default())
|
default_value = module.CONFIG_SCHEMA({module.DOMAIN: key.default()})[ # type: ignore
|
||||||
|
module.DOMAIN # type: ignore
|
||||||
|
]
|
||||||
|
|
||||||
if isinstance(default_value, dict):
|
if isinstance(default_value, dict):
|
||||||
return "dict", schema
|
return "dict"
|
||||||
|
|
||||||
if isinstance(default_value, list):
|
if isinstance(default_value, list):
|
||||||
return "list", schema
|
return "list"
|
||||||
|
|
||||||
return None, None
|
return None
|
||||||
|
|
||||||
t_schema = str(schema)
|
t_schema = str(schema)
|
||||||
if t_schema.startswith("{") or "schema_with_slug_keys" in t_schema:
|
if t_schema.startswith("{") or "schema_with_slug_keys" in t_schema:
|
||||||
return ("dict", schema)
|
return "dict"
|
||||||
if t_schema.startswith(("[", "All(<function ensure_list")):
|
if t_schema.startswith(("[", "All(<function ensure_list")):
|
||||||
return ("list", schema)
|
return "list"
|
||||||
return "", schema
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _recursive_merge(conf: Dict[str, Any], package: Dict[str, Any]) -> Union[bool, str]:
|
def _recursive_merge(conf: Dict[str, Any], package: Dict[str, Any]) -> Union[bool, str]:
|
||||||
@ -642,8 +644,7 @@ async def merge_packages_config(
|
|||||||
merge_list = hasattr(component, "PLATFORM_SCHEMA")
|
merge_list = hasattr(component, "PLATFORM_SCHEMA")
|
||||||
|
|
||||||
if not merge_list and hasattr(component, "CONFIG_SCHEMA"):
|
if not merge_list and hasattr(component, "CONFIG_SCHEMA"):
|
||||||
merge_type, _ = _identify_config_schema(component)
|
merge_list = _identify_config_schema(component) == "list"
|
||||||
merge_list = merge_type == "list"
|
|
||||||
|
|
||||||
if merge_list:
|
if merge_list:
|
||||||
config[comp_name] = cv.remove_falsy(
|
config[comp_name] = cv.remove_falsy(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 107
|
MINOR_VERSION = 107
|
||||||
PATCH_VERSION = "3"
|
PATCH_VERSION = "4"
|
||||||
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
||||||
__version__ = f"{__short_version__}.{PATCH_VERSION}"
|
__version__ = f"{__short_version__}.{PATCH_VERSION}"
|
||||||
REQUIRED_PYTHON_VER = (3, 7, 0)
|
REQUIRED_PYTHON_VER = (3, 7, 0)
|
||||||
|
@ -139,7 +139,7 @@ aio_georss_gdacs==0.3
|
|||||||
aioambient==1.0.4
|
aioambient==1.0.4
|
||||||
|
|
||||||
# homeassistant.components.asuswrt
|
# homeassistant.components.asuswrt
|
||||||
aioasuswrt==1.2.2
|
aioasuswrt==1.2.3
|
||||||
|
|
||||||
# homeassistant.components.automatic
|
# homeassistant.components.automatic
|
||||||
aioautomatic==0.6.5
|
aioautomatic==0.6.5
|
||||||
@ -1856,7 +1856,7 @@ simplehound==0.3
|
|||||||
simplepush==1.1.4
|
simplepush==1.1.4
|
||||||
|
|
||||||
# homeassistant.components.simplisafe
|
# homeassistant.components.simplisafe
|
||||||
simplisafe-python==9.0.3
|
simplisafe-python==9.0.4
|
||||||
|
|
||||||
# homeassistant.components.sisyphus
|
# homeassistant.components.sisyphus
|
||||||
sisyphus-control==2.2.1
|
sisyphus-control==2.2.1
|
||||||
|
@ -50,7 +50,7 @@ aio_georss_gdacs==0.3
|
|||||||
aioambient==1.0.4
|
aioambient==1.0.4
|
||||||
|
|
||||||
# homeassistant.components.asuswrt
|
# homeassistant.components.asuswrt
|
||||||
aioasuswrt==1.2.2
|
aioasuswrt==1.2.3
|
||||||
|
|
||||||
# homeassistant.components.automatic
|
# homeassistant.components.automatic
|
||||||
aioautomatic==0.6.5
|
aioautomatic==0.6.5
|
||||||
@ -649,7 +649,7 @@ sentry-sdk==0.13.5
|
|||||||
simplehound==0.3
|
simplehound==0.3
|
||||||
|
|
||||||
# homeassistant.components.simplisafe
|
# homeassistant.components.simplisafe
|
||||||
simplisafe-python==9.0.3
|
simplisafe-python==9.0.4
|
||||||
|
|
||||||
# homeassistant.components.sleepiq
|
# homeassistant.components.sleepiq
|
||||||
sleepyq==0.7
|
sleepyq==0.7
|
||||||
|
@ -722,7 +722,7 @@ async def test_merge_id_schema(hass):
|
|||||||
for domain, expected_type in types.items():
|
for domain, expected_type in types.items():
|
||||||
integration = await async_get_integration(hass, domain)
|
integration = await async_get_integration(hass, domain)
|
||||||
module = integration.get_component()
|
module = integration.get_component()
|
||||||
typ, _ = config_util._identify_config_schema(module)
|
typ = config_util._identify_config_schema(module)
|
||||||
assert typ == expected_type, f"{domain} expected {expected_type}, got {typ}"
|
assert typ == expected_type, f"{domain} expected {expected_type}, got {typ}"
|
||||||
|
|
||||||
|
|
||||||
@ -995,15 +995,30 @@ async def test_component_config_exceptions(hass, caplog):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"domain, schema, expected",
|
"domain, schema, expected",
|
||||||
[
|
[
|
||||||
("zone", vol.Schema({vol.Optional("zone", default=[]): list}), "list"),
|
("zone", vol.Schema({vol.Optional("zone", default=list): [int]}), "list"),
|
||||||
("zone", vol.Schema({vol.Optional("zone", default=dict): dict}), "dict"),
|
("zone", vol.Schema({vol.Optional("zone", default=[]): [int]}), "list"),
|
||||||
|
(
|
||||||
|
"zone",
|
||||||
|
vol.Schema({vol.Optional("zone", default={}): {vol.Optional("hello"): 1}}),
|
||||||
|
"dict",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"zone",
|
||||||
|
vol.Schema(
|
||||||
|
{vol.Optional("zone", default=dict): {vol.Optional("hello"): 1}}
|
||||||
|
),
|
||||||
|
"dict",
|
||||||
|
),
|
||||||
|
("zone", vol.Schema({vol.Optional("zone"): int}), None),
|
||||||
|
("zone", vol.Schema({"zone": int}), None),
|
||||||
|
("not_existing", vol.Schema({vol.Optional("zone", default=dict): dict}), None,),
|
||||||
|
("non_existing", vol.Schema({"zone": int}), None),
|
||||||
|
("zone", vol.Schema({}), None),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_identify_config_schema(domain, schema, expected):
|
def test_identify_config_schema(domain, schema, expected):
|
||||||
"""Test identify config schema."""
|
"""Test identify config schema."""
|
||||||
assert (
|
assert (
|
||||||
config_util._identify_config_schema(Mock(DOMAIN=domain, CONFIG_SCHEMA=schema))[
|
config_util._identify_config_schema(Mock(DOMAIN=domain, CONFIG_SCHEMA=schema))
|
||||||
0
|
|
||||||
]
|
|
||||||
== expected
|
== expected
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user