Skip to content

Commit 8a2eb33

Browse files
Merge pull request #59 from shaonianzhentan/dev
适配新版HA
2 parents b961697 + ea9c358 commit 8a2eb33

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

custom_components/ha_file_explorer/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from homeassistant.config_entries import ConfigEntry
22
from homeassistant.core import HomeAssistant
33
import 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
55
from homeassistant.components.http import StaticPathConfig
66
from .http_api import HttpApi
77
from .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

2833
async 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

custom_components/ha_file_explorer/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "ha_file_explorer",
33
"name": "\u6587\u4EF6\u7BA1\u7406",
4-
"version": "2025.10.17",
4+
"version": "2025.12.6",
55
"config_flow": true,
66
"documentation": "https://github.com/shaonianzhentan/ha_file_explorer",
77
"requirements": [],

0 commit comments

Comments
 (0)