diff --git a/custom_components/o365/repairs.py b/custom_components/o365/repairs.py index 1c24b71..bce971b 100644 --- a/custom_components/o365/repairs.py +++ b/custom_components/o365/repairs.py @@ -9,10 +9,12 @@ from homeassistant.components.http import HomeAssistantView from homeassistant.components.repairs import RepairsFlow # ConfirmRepairFlow, from homeassistant.core import HomeAssistant, callback +from homeassistant.helpers.network import get_url from .const import ( AUTH_CALLBACK_NAME, AUTH_CALLBACK_PATH_ALT, + AUTH_CALLBACK_PATH_DEFAULT, CONF_ACCOUNT, CONF_ACCOUNT_CONF, CONF_ACCOUNT_NAME, @@ -28,7 +30,6 @@ build_minimum_permissions, build_requested_permissions, build_token_filename, - get_callback_url, validate_permissions, ) @@ -185,3 +186,11 @@ async def get(self, request): headers={"content-type": "text/html"}, text="This window can be closed", ) + + +def get_callback_url(hass, alt_config): + """Get the callback URL.""" + if alt_config: + return f"{get_url(hass, prefer_external=True)}{AUTH_CALLBACK_PATH_ALT}" + + return AUTH_CALLBACK_PATH_DEFAULT diff --git a/custom_components/o365/utils.py b/custom_components/o365/utils.py index af60cc0..6e3e81a 100644 --- a/custom_components/o365/utils.py +++ b/custom_components/o365/utils.py @@ -11,15 +11,12 @@ from bs4 import BeautifulSoup from homeassistant.const import CONF_ENABLED, CONF_NAME from homeassistant.helpers.entity import async_generate_entity_id -from homeassistant.helpers.network import get_url from homeassistant.util import dt from voluptuous.error import Error as VoluptuousError from O365.calendar import Attendee # pylint: disable=no-name-in-module) from .const import ( - AUTH_CALLBACK_PATH_ALT, - AUTH_CALLBACK_PATH_DEFAULT, CONF_ACCOUNT_NAME, CONF_AUTO_REPLY_SENSORS, CONF_CAL_ID, @@ -541,14 +538,6 @@ def check_file_location(hass, filepath, newpath): shutil.move(oldpath, newpath) -def get_callback_url(hass, alt_config): - """Get the callback URL.""" - if alt_config: - return f"{get_url(hass, prefer_external=True)}{AUTH_CALLBACK_PATH_ALT}" - - return AUTH_CALLBACK_PATH_DEFAULT - - def build_entity_id(hass, name): """Build and entity ID.""" return async_generate_entity_id(