custom_components/bahmcloud_store/__init__.py aktualisiert
This commit is contained in:
@@ -7,7 +7,11 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.components.panel_custom import async_register_panel
|
|
||||||
|
# IMPORTANT:
|
||||||
|
# Use the frontend panel registration to keep HA header/sidebar working on mobile,
|
||||||
|
# similar to how HACS registers its panel.
|
||||||
|
from homeassistant.components.frontend import async_register_built_in_panel
|
||||||
|
|
||||||
from .core import BCSCore, BCSConfig, BCSError
|
from .core import BCSCore, BCSConfig, BCSError
|
||||||
|
|
||||||
@@ -32,17 +36,18 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
|||||||
# Register HTTP views (static panel assets + API)
|
# Register HTTP views (static panel assets + API)
|
||||||
await core.register_http_views()
|
await core.register_http_views()
|
||||||
|
|
||||||
# Register custom panel (no iframe; uses hass.callApi)
|
# Register panel via frontend (keeps navigation/header on mobile)
|
||||||
await async_register_panel(
|
async_register_built_in_panel(
|
||||||
hass,
|
hass,
|
||||||
frontend_url_path="bahmcloud-store",
|
component_name="custom",
|
||||||
webcomponent_name="bahmcloud-store-panel",
|
|
||||||
module_url="/api/bahmcloud_store_static/panel.js?v=31",
|
|
||||||
sidebar_title="Bahmcloud Store",
|
sidebar_title="Bahmcloud Store",
|
||||||
sidebar_icon="mdi:store",
|
sidebar_icon="mdi:store",
|
||||||
require_admin=True,
|
frontend_url_path="bahmcloud-store",
|
||||||
embed_iframe=False, # Critical for correct navigation/header behavior on mobile
|
|
||||||
config={},
|
config={},
|
||||||
|
require_admin=True,
|
||||||
|
# module_url must be reachable without auth (we already serve it public)
|
||||||
|
# Cache-busting is fine here.
|
||||||
|
module_url="/api/bahmcloud_store_static/panel.js?v=31",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initial refresh (index + custom repos + enrichment)
|
# Initial refresh (index + custom repos + enrichment)
|
||||||
|
|||||||
Reference in New Issue
Block a user