mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Drop @bind_hass use from hassio component (#111522)
* Drop `@bind_hass` use from hassio component * Add comment why we import locally --------- Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
committed by
GitHub
parent
0e329d2572
commit
4e4345f04e
@@ -40,7 +40,11 @@ def get_supervisor_network_url(
|
||||
hass: HomeAssistant, *, allow_ssl: bool = False
|
||||
) -> str | None:
|
||||
"""Get URL for home assistant within supervisor network."""
|
||||
if hass.config.api is None or not hass.components.hassio.is_hassio():
|
||||
# Local import to avoid circular dependencies
|
||||
# pylint: disable-next=import-outside-toplevel
|
||||
from homeassistant.components.hassio import is_hassio
|
||||
|
||||
if hass.config.api is None or not is_hassio(hass):
|
||||
return None
|
||||
|
||||
scheme = "http"
|
||||
@@ -125,6 +129,10 @@ def get_url(
|
||||
prefer_cloud: bool = False,
|
||||
) -> str:
|
||||
"""Get a URL to this instance."""
|
||||
# Local import to avoid circular dependencies
|
||||
# pylint: disable-next=import-outside-toplevel
|
||||
from homeassistant.components.hassio import get_host_info, is_hassio
|
||||
|
||||
if require_current_request and http.current_request.get() is None:
|
||||
raise NoURLAvailableError
|
||||
|
||||
@@ -176,8 +184,7 @@ def get_url(
|
||||
)
|
||||
|
||||
known_hostnames = ["localhost"]
|
||||
if hass.components.hassio.is_hassio():
|
||||
host_info = hass.components.hassio.get_host_info()
|
||||
if is_hassio(hass) and (host_info := get_host_info(hass)):
|
||||
known_hostnames.extend(
|
||||
[host_info["hostname"], f"{host_info['hostname']}.local"]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user