1
1
home-automation-home-assistant/custom_components/fontawesome/__init__.py
2021-08-28 21:21:19 +02:00

47 Zeilen
1.1 KiB
Python

import logging
from homeassistant.components.frontend import add_extra_js_url
LOGGER = logging.getLogger(__name__)
DOMAIN = "fontawesome"
DATA_EXTRA_MODULE_URL = 'frontend_extra_module_url'
LOADER_URL = f'/{DOMAIN}/main.js'
LOADER_PATH = f'custom_components/{DOMAIN}/main.js'
ICONS_URL = f'/{DOMAIN}/icons'
ICONS_PATH = f'custom_components/{DOMAIN}/data'
CUSTOM_ICONS_URL = f'/{DOMAIN}/icons/pro'
CUSTOM_ICONS_PATH = 'custom_icons/'
async def async_setup(hass, config):
hass.http.register_static_path(
LOADER_URL,
hass.config.path(LOADER_PATH),
True
)
add_extra_js_url(hass, LOADER_URL)
for iset in ["brands", "regular", "solid"]:
hass.http.register_static_path(
ICONS_URL + "/" + iset,
hass.config.path(ICONS_PATH + "/" + iset),
True
)
hass.http.register_static_path(
CUSTOM_ICONS_URL,
hass.config.path(CUSTOM_ICONS_PATH),
True
)
return True
async def async_setup_entry(hass, entry):
return True
async def async_remove_entry(hass, entry):
return True