11from homeassistant .config_entries import ConfigEntry
22from homeassistant .core import HomeAssistant
33import homeassistant .helpers .config_validation as cv
4- from homeassistant .components .frontend import async_register_built_in_panel
4+ from homeassistant .components .frontend import async_register_built_in_panel , async_remove_panel
55from homeassistant .components .http import StaticPathConfig
66from .http_api import HttpApi
77from .manifest import manifest
@@ -17,14 +17,19 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
1717 [ StaticPathConfig (url_path , hass .config .path ("custom_components/" + DOMAIN + "/www" ), False ) ]
1818 )
1919
20- async_register_built_in_panel (hass , "iframe" ,
21- NAME , "mdi:folder" , DOMAIN , {"url" : f'{ url_path } /index.html?v={ manifest .version } ' },
22- entry .data .get ('require_admin' )
20+ async_register_built_in_panel (
21+ hass ,
22+ "iframe" ,
23+ sidebar_title = NAME ,
24+ sidebar_icon = "mdi:folder" ,
25+ frontend_url_path = DOMAIN ,
26+ config = {"url" : f"{ url_path } /index.html?v={ manifest .version } " },
27+ require_admin = entry .data .get ("require_admin" , False ),
2328 )
2429
2530 hass .http .register_view (HttpApi )
2631 return True
2732
2833async def async_unload_entry (hass : HomeAssistant , entry : ConfigEntry ) -> bool :
29- hass . components . frontend . async_remove_panel (DOMAIN )
34+ async_remove_panel (DOMAIN )
3035 return True
0 commit comments