mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Enforce unique ID for Hassio discovery (#36671)
This commit is contained in:
parent
c1cf3679aa
commit
e8b16f0dfd
@ -17,7 +17,7 @@ To update, run python3 -m script.hassfest
|
|||||||
FLOWS = {}
|
FLOWS = {}
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
UNIQUE_ID_IGNORE = {"esphome", "fritzbox", "heos", "huawei_lte"}
|
UNIQUE_ID_IGNORE = {"huawei_lte", "mqtt", "adguard"}
|
||||||
|
|
||||||
|
|
||||||
def validate_integration(config: Config, integration: Integration):
|
def validate_integration(config: Config, integration: Integration):
|
||||||
@ -30,17 +30,20 @@ def validate_integration(config: Config, integration: Integration):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
needs_unique_id = integration.domain not in UNIQUE_ID_IGNORE and any(
|
config_flow = config_flow_file.read_text()
|
||||||
bool(integration.manifest.get(key))
|
|
||||||
for keys in DISCOVERY_INTEGRATIONS.values()
|
needs_unique_id = integration.domain not in UNIQUE_ID_IGNORE and (
|
||||||
for key in keys
|
"async_step_hassio" in config_flow
|
||||||
|
or any(
|
||||||
|
bool(integration.manifest.get(key))
|
||||||
|
for keys in DISCOVERY_INTEGRATIONS.values()
|
||||||
|
for key in keys
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not needs_unique_id:
|
if not needs_unique_id:
|
||||||
return
|
return
|
||||||
|
|
||||||
config_flow = config_flow_file.read_text()
|
|
||||||
|
|
||||||
has_unique_id = (
|
has_unique_id = (
|
||||||
"self.async_set_unique_id" in config_flow
|
"self.async_set_unique_id" in config_flow
|
||||||
or "config_entry_flow.register_discovery_flow" in config_flow
|
or "config_entry_flow.register_discovery_flow" in config_flow
|
||||||
|
Loading…
x
Reference in New Issue
Block a user