home-automation-home-assistant/custom_components/fontawesome/__init__.py

47 γραμμές
1.1 KiB
Python

2021-08-28 19:21:19 +00:00
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'
2021-08-28 19:21:19 +00:00
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):
2021-08-28 19:21:19 +00:00
hass.http.register_static_path(
LOADER_URL,
hass.config.path(LOADER_PATH),
True
)
2021-08-28 19:21:19 +00:00
add_extra_js_url(hass, LOADER_URL)
2021-08-28 19:21:19 +00:00
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
2021-08-28 19:21:19 +00:00
async def async_setup_entry(hass, entry):
return True
2021-08-28 19:21:19 +00:00
async def async_remove_entry(hass, entry):
return True