From 59e36e02946a6cbf68d3e4a7788749cd8f6a9890 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 23 Jan 2025 07:00:08 +0000 Subject: [PATCH] Move lovelace function and exception out of const.py --- homeassistant/components/lovelace/cast.py | 3 ++- homeassistant/components/lovelace/const.py | 5 ----- homeassistant/components/lovelace/dashboard.py | 2 +- homeassistant/components/lovelace/util.py | 7 +++++++ 4 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 homeassistant/components/lovelace/util.py diff --git a/homeassistant/components/lovelace/cast.py b/homeassistant/components/lovelace/cast.py index 635425ba3dc..e63ea564f30 100644 --- a/homeassistant/components/lovelace/cast.py +++ b/homeassistant/components/lovelace/cast.py @@ -25,7 +25,8 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.network import NoURLAvailableError, get_url -from .const import DOMAIN, LOVELACE_DATA, ConfigNotFound +from .const import DOMAIN, LOVELACE_DATA +from .util import ConfigNotFound DEFAULT_DASHBOARD = "_default_" diff --git a/homeassistant/components/lovelace/const.py b/homeassistant/components/lovelace/const.py index 0450c62338d..b6c689e7409 100644 --- a/homeassistant/components/lovelace/const.py +++ b/homeassistant/components/lovelace/const.py @@ -13,7 +13,6 @@ from homeassistant.const import ( CONF_URL, EVENT_LOVELACE_UPDATED, # noqa: F401 ) -from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_validation as cv from homeassistant.helpers.typing import VolDictType from homeassistant.util.hass_dict import HassKey @@ -88,7 +87,3 @@ STORAGE_DASHBOARD_CREATE_FIELDS: VolDictType = { } STORAGE_DASHBOARD_UPDATE_FIELDS = DASHBOARD_BASE_UPDATE_FIELDS - - -class ConfigNotFound(HomeAssistantError): - """When no config available.""" diff --git a/homeassistant/components/lovelace/dashboard.py b/homeassistant/components/lovelace/dashboard.py index ddb54e7618f..a1a9a98e5c6 100644 --- a/homeassistant/components/lovelace/dashboard.py +++ b/homeassistant/components/lovelace/dashboard.py @@ -32,8 +32,8 @@ from .const import ( MODE_YAML, STORAGE_DASHBOARD_CREATE_FIELDS, STORAGE_DASHBOARD_UPDATE_FIELDS, - ConfigNotFound, ) +from .util import ConfigNotFound CONFIG_STORAGE_KEY_DEFAULT = DOMAIN CONFIG_STORAGE_KEY = "lovelace.{}" diff --git a/homeassistant/components/lovelace/util.py b/homeassistant/components/lovelace/util.py new file mode 100644 index 00000000000..7d98959d62f --- /dev/null +++ b/homeassistant/components/lovelace/util.py @@ -0,0 +1,7 @@ +"""Utils for Lovelace.""" + +from homeassistant.exceptions import HomeAssistantError + + +class ConfigNotFound(HomeAssistantError): + """When no config available."""