Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.frontend Namespace Reference

Namespaces

 storage
 

Classes

class  IndexView
 
class  Manifest
 
class  ManifestJSONView
 
class  Panel
 
class  PanelRespons
 
class  UrlManager
 

Functions

str _async_render_index_cached (jinja2.Template template, **Any kwargs)
 
None _async_setup_themes (HomeAssistant hass, dict[str, Any]|None themes)
 
pathlib.Path _frontend_root (str|None dev_repo_path)
 
None add_extra_js_url (HomeAssistant hass, str url, bool es5=False)
 
None add_manifest_json_key (str key, Any val)
 
None async_register_built_in_panel (HomeAssistant hass, str component_name, str|None sidebar_title=None, str|None sidebar_icon=None, str|None frontend_url_path=None, dict[str, Any]|None config=None, bool require_admin=False, *bool update=False, str|None config_panel_domain=None)
 
None async_remove_panel (HomeAssistant hass, str frontend_url_path, *bool warn_if_unknown=True)
 
bool async_setup (HomeAssistant hass, ConfigType config)
 
None remove_extra_js_url (HomeAssistant hass, str url, bool es5=False)
 
None websocket_get_icons (HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
 
None websocket_get_panels (HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
 
None websocket_get_themes (HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
 
None websocket_get_translations (HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
 
None websocket_get_version (HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
 
None websocket_subscribe_extra_js (HomeAssistant hass, ActiveConnection connection, dict[str, Any] msg)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string CONF_EXTRA_HTML_URL = "extra_html_url"
 
string CONF_EXTRA_HTML_URL_ES5 = "extra_html_url_es5"
 
string CONF_EXTRA_JS_URL_ES5 = "extra_js_url_es5"
 
string CONF_EXTRA_MODULE_URL = "extra_module_url"
 
string CONF_FRONTEND_REPO = "development_repo"
 
string CONF_JS_VERSION = "javascript_version"
 
string CONF_THEMES = "themes"
 
string CONF_THEMES_DARK = "dark"
 
string CONF_THEMES_LIGHT = "light"
 
string CONF_THEMES_MODES = "modes"
 
 CONFIG_SCHEMA
 
string DATA_DEFAULT_DARK_THEME = "frontend_default_dark_theme"
 
string DATA_DEFAULT_THEME = "frontend_default_theme"
 
string DATA_EXTRA_JS_URL_ES5 = "frontend_extra_js_url_es5"
 
string DATA_EXTRA_MODULE_URL = "frontend_extra_module_url"
 
string DATA_JS_VERSION = "frontend_js_version"
 
string DATA_PANELS = "frontend_panels"
 
string DATA_THEMES = "frontend_themes"
 
string DATA_THEMES_STORE = "frontend_themes_store"
 
string DEFAULT_THEME = "default"
 
string DEFAULT_THEME_COLOR = "#03A9F4"
 
string DOMAIN = "frontend"
 
 EXTENDED_THEME_SCHEMA
 
 MANIFEST_JSON
 
string PRIMARY_COLOR = "primary-color"
 
string SERVICE_RELOAD_THEMES = "reload_themes"
 
string SERVICE_SET_THEME = "set_theme"
 
 THEME_SCHEMA
 
int THEMES_SAVE_DELAY = 60
 
string THEMES_STORAGE_KEY = f"{DOMAIN}_theme"
 
int THEMES_STORAGE_VERSION = 1
 
string VALUE_NO_THEME = "none"
 

Detailed Description

Handle the frontend for Home Assistant.

Function Documentation

◆ _async_render_index_cached()

str homeassistant.components.frontend._async_render_index_cached ( jinja2.Template  template,
**Any  kwargs 
)
private

Definition at line 579 of file __init__.py.

◆ _async_setup_themes()

None homeassistant.components.frontend._async_setup_themes ( HomeAssistant  hass,
dict[str, Any] | None   themes 
)
private
Set up themes data and services.

Definition at line 472 of file __init__.py.

◆ _frontend_root()

pathlib.Path homeassistant.components.frontend._frontend_root ( str | None  dev_repo_path)
private
Return root path to the frontend files.

Definition at line 364 of file __init__.py.

◆ add_extra_js_url()

None homeassistant.components.frontend.add_extra_js_url ( HomeAssistant  hass,
str  url,
bool   es5 = False 
)
Register extra js or module url to load.

This function allows custom integrations to register extra js or module.

Definition at line 341 of file __init__.py.

◆ add_manifest_json_key()

None homeassistant.components.frontend.add_manifest_json_key ( str  key,
Any  val 
)
Add a keyval to the manifest.json.

Definition at line 359 of file __init__.py.

◆ async_register_built_in_panel()

None homeassistant.components.frontend.async_register_built_in_panel ( HomeAssistant  hass,
str  component_name,
str | None   sidebar_title = None,
str | None   sidebar_icon = None,
str | None   frontend_url_path = None,
dict[str, Any] | None   config = None,
bool   require_admin = False,
*bool   update = False,
str | None   config_panel_domain = None 
)
Register a built-in panel.

Definition at line 292 of file __init__.py.

◆ async_remove_panel()

None homeassistant.components.frontend.async_remove_panel ( HomeAssistant  hass,
str  frontend_url_path,
*bool   warn_if_unknown = True 
)
Remove a built-in panel.

Definition at line 327 of file __init__.py.

◆ async_setup()

bool homeassistant.components.frontend.async_setup ( HomeAssistant  hass,
ConfigType  config 
)
Set up the serving of the frontend.

Definition at line 375 of file __init__.py.

◆ remove_extra_js_url()

None homeassistant.components.frontend.remove_extra_js_url ( HomeAssistant  hass,
str  url,
bool   es5 = False 
)
Remove extra js or module url to load.

This function allows custom integrations to remove extra js or module.

Definition at line 350 of file __init__.py.

◆ websocket_get_icons()

None homeassistant.components.frontend.websocket_get_icons ( HomeAssistant  hass,
ActiveConnection  connection,
dict[str, Any]   msg 
)
Handle get icons command.

Definition at line 721 of file __init__.py.

◆ websocket_get_panels()

None homeassistant.components.frontend.websocket_get_panels ( HomeAssistant  hass,
ActiveConnection  connection,
dict[str, Any]   msg 
)
Handle get panels command.

Definition at line 737 of file __init__.py.

◆ websocket_get_themes()

None homeassistant.components.frontend.websocket_get_themes ( HomeAssistant  hass,
ActiveConnection  connection,
dict[str, Any]   msg 
)
Handle get themes command.

Definition at line 753 of file __init__.py.

◆ websocket_get_translations()

None homeassistant.components.frontend.websocket_get_translations ( HomeAssistant  hass,
ActiveConnection  connection,
dict[str, Any]   msg 
)
Handle get translations command.

Definition at line 791 of file __init__.py.

◆ websocket_get_version()

None homeassistant.components.frontend.websocket_get_version ( HomeAssistant  hass,
ActiveConnection  connection,
dict[str, Any]   msg 
)
Handle get version command.

Definition at line 809 of file __init__.py.

◆ websocket_subscribe_extra_js()

None homeassistant.components.frontend.websocket_subscribe_extra_js ( HomeAssistant  hass,
ActiveConnection  connection,
dict[str, Any]   msg 
)
Subscribe to URL manager updates.

Definition at line 829 of file __init__.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.frontend._LOGGER = logging.getLogger(__name__)
private

Definition at line 77 of file __init__.py.

◆ CONF_EXTRA_HTML_URL

string homeassistant.components.frontend.CONF_EXTRA_HTML_URL = "extra_html_url"

Definition at line 46 of file __init__.py.

◆ CONF_EXTRA_HTML_URL_ES5

string homeassistant.components.frontend.CONF_EXTRA_HTML_URL_ES5 = "extra_html_url_es5"

Definition at line 47 of file __init__.py.

◆ CONF_EXTRA_JS_URL_ES5

string homeassistant.components.frontend.CONF_EXTRA_JS_URL_ES5 = "extra_js_url_es5"

Definition at line 49 of file __init__.py.

◆ CONF_EXTRA_MODULE_URL

string homeassistant.components.frontend.CONF_EXTRA_MODULE_URL = "extra_module_url"

Definition at line 48 of file __init__.py.

◆ CONF_FRONTEND_REPO

string homeassistant.components.frontend.CONF_FRONTEND_REPO = "development_repo"

Definition at line 50 of file __init__.py.

◆ CONF_JS_VERSION

string homeassistant.components.frontend.CONF_JS_VERSION = "javascript_version"

Definition at line 51 of file __init__.py.

◆ CONF_THEMES

string homeassistant.components.frontend.CONF_THEMES = "themes"

Definition at line 42 of file __init__.py.

◆ CONF_THEMES_DARK

string homeassistant.components.frontend.CONF_THEMES_DARK = "dark"

Definition at line 45 of file __init__.py.

◆ CONF_THEMES_LIGHT

string homeassistant.components.frontend.CONF_THEMES_LIGHT = "light"

Definition at line 44 of file __init__.py.

◆ CONF_THEMES_MODES

string homeassistant.components.frontend.CONF_THEMES_MODES = "modes"

Definition at line 43 of file __init__.py.

◆ CONFIG_SCHEMA

homeassistant.components.frontend.CONFIG_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  DOMAIN: vol.Schema(
4  {
5  vol.Optional(CONF_FRONTEND_REPO): cv.isdir,
6  vol.Optional(CONF_THEMES): THEME_SCHEMA,
7  vol.Optional(CONF_EXTRA_MODULE_URL): vol.All(
8  cv.ensure_list, [cv.string]
9  ),
10  vol.Optional(CONF_EXTRA_JS_URL_ES5): vol.All(
11  cv.ensure_list, [cv.string]
12  ),
13  # We no longer use these options.
14  vol.Optional(CONF_EXTRA_HTML_URL): cv.match_all,
15  vol.Optional(CONF_EXTRA_HTML_URL_ES5): cv.match_all,
16  vol.Optional(CONF_JS_VERSION): cv.match_all,
17  },
18  )
19  },
20  extra=vol.ALLOW_EXTRA,
21 )

Definition at line 106 of file __init__.py.

◆ DATA_DEFAULT_DARK_THEME

string homeassistant.components.frontend.DATA_DEFAULT_DARK_THEME = "frontend_default_dark_theme"

Definition at line 71 of file __init__.py.

◆ DATA_DEFAULT_THEME

string homeassistant.components.frontend.DATA_DEFAULT_THEME = "frontend_default_theme"

Definition at line 70 of file __init__.py.

◆ DATA_EXTRA_JS_URL_ES5

string homeassistant.components.frontend.DATA_EXTRA_JS_URL_ES5 = "frontend_extra_js_url_es5"

Definition at line 59 of file __init__.py.

◆ DATA_EXTRA_MODULE_URL

string homeassistant.components.frontend.DATA_EXTRA_MODULE_URL = "frontend_extra_module_url"

Definition at line 58 of file __init__.py.

◆ DATA_JS_VERSION

string homeassistant.components.frontend.DATA_JS_VERSION = "frontend_js_version"

Definition at line 57 of file __init__.py.

◆ DATA_PANELS

string homeassistant.components.frontend.DATA_PANELS = "frontend_panels"

Definition at line 56 of file __init__.py.

◆ DATA_THEMES

string homeassistant.components.frontend.DATA_THEMES = "frontend_themes"

Definition at line 69 of file __init__.py.

◆ DATA_THEMES_STORE

string homeassistant.components.frontend.DATA_THEMES_STORE = "frontend_themes_store"

Definition at line 68 of file __init__.py.

◆ DEFAULT_THEME

string homeassistant.components.frontend.DEFAULT_THEME = "default"

Definition at line 72 of file __init__.py.

◆ DEFAULT_THEME_COLOR

string homeassistant.components.frontend.DEFAULT_THEME_COLOR = "#03A9F4"

Definition at line 53 of file __init__.py.

◆ DOMAIN

string homeassistant.components.frontend.DOMAIN = "frontend"

Definition at line 41 of file __init__.py.

◆ EXTENDED_THEME_SCHEMA

homeassistant.components.frontend.EXTENDED_THEME_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  # Theme variables that apply to all modes
4  cv.string: cv.string,
5  # Mode specific theme variables
6  vol.Optional(CONF_THEMES_MODES): vol.Schema(
7  {
8  vol.Optional(CONF_THEMES_LIGHT): vol.Schema({cv.string: cv.string}),
9  vol.Optional(CONF_THEMES_DARK): vol.Schema({cv.string: cv.string}),
10  }
11  ),
12  }
13 )

Definition at line 79 of file __init__.py.

◆ MANIFEST_JSON

homeassistant.components.frontend.MANIFEST_JSON

Definition at line 158 of file __init__.py.

◆ PRIMARY_COLOR

string homeassistant.components.frontend.PRIMARY_COLOR = "primary-color"

Definition at line 75 of file __init__.py.

◆ SERVICE_RELOAD_THEMES

string homeassistant.components.frontend.SERVICE_RELOAD_THEMES = "reload_themes"

Definition at line 129 of file __init__.py.

◆ SERVICE_SET_THEME

string homeassistant.components.frontend.SERVICE_SET_THEME = "set_theme"

Definition at line 128 of file __init__.py.

◆ THEME_SCHEMA

homeassistant.components.frontend.THEME_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  cv.string: (
4  vol.Any(
5  # Legacy theme scheme
6  {cv.string: cv.string},
7  # New extended schema with mode support
8  EXTENDED_THEME_SCHEMA,
9  )
10  )
11  }
12 )

Definition at line 93 of file __init__.py.

◆ THEMES_SAVE_DELAY

int homeassistant.components.frontend.THEMES_SAVE_DELAY = 60

Definition at line 67 of file __init__.py.

◆ THEMES_STORAGE_KEY

string homeassistant.components.frontend.THEMES_STORAGE_KEY = f"{DOMAIN}_theme"

Definition at line 65 of file __init__.py.

◆ THEMES_STORAGE_VERSION

int homeassistant.components.frontend.THEMES_STORAGE_VERSION = 1

Definition at line 66 of file __init__.py.

◆ VALUE_NO_THEME

string homeassistant.components.frontend.VALUE_NO_THEME = "none"

Definition at line 73 of file __init__.py.