Skip to content

Commit

Permalink
Fix StaticPath warnings (#725)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Lovén <[email protected]>
  • Loading branch information
hmmbob and thomasloven authored Jul 31, 2024
1 parent 45058e0 commit 49e6e5b
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions custom_components/browser_mod/mod_view.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from homeassistant.components.frontend import add_extra_js_url, async_register_built_in_panel
from homeassistant.components.http import StaticPathConfig

from .const import FRONTEND_SCRIPT_URL, SETTINGS_PANEL_URL

Expand All @@ -10,16 +11,26 @@
async def async_setup_view(hass):

# Serve the Browser Mod controller and add it as extra_module_url
hass.http.register_static_path(
FRONTEND_SCRIPT_URL,
hass.config.path("custom_components/browser_mod/browser_mod.js"),
await hass.http.async_register_static_paths(
[
StaticPathConfig(
FRONTEND_SCRIPT_URL,
hass.config.path("custom_components/browser_mod/browser_mod.js"),
True,
)
]
)
add_extra_js_url(hass, FRONTEND_SCRIPT_URL)

# Serve the Browser Mod Settings panel and register it as a panel
hass.http.register_static_path(
SETTINGS_PANEL_URL,
hass.config.path("custom_components/browser_mod/browser_mod_panel.js"),
await hass.http.async_register_static_paths(
[
StaticPathConfig(
SETTINGS_PANEL_URL,
hass.config.path("custom_components/browser_mod/browser_mod_panel.js"),
True,
)
]
)
async_register_built_in_panel(
hass=hass,
Expand Down

0 comments on commit 49e6e5b

Please sign in to comment.