HA 2026.10 stores dashboard configs as .storage/lovelace.{url_path}
with hyphens replaced by underscores. Direct file read is more reliable
than internal hass.data access which varies across versions.
Also added error logging to async_setup_entry for WS registration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""Luma Home — config bridge between HA dashboards and Luma TV app."""
|
|
|
|
import logging
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .const import DOMAIN
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
|
"""Set up the Luma Home component."""
|
|
hass.data.setdefault(DOMAIN, {})
|
|
return True
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
"""Set up Luma Home from a config entry."""
|
|
hass.data.setdefault(DOMAIN, {})
|
|
hass.data[DOMAIN][entry.entry_id] = {
|
|
"dashboard_url_path": entry.data.get("dashboard_url_path", "luma-tv"),
|
|
}
|
|
try:
|
|
from . import websocket_api
|
|
websocket_api.async_register_commands(hass)
|
|
_LOGGER.info("Luma Home WS commands registered successfully")
|
|
except Exception:
|
|
_LOGGER.exception("Failed to register Luma Home WS commands")
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
"""Unload a config entry."""
|
|
hass.data[DOMAIN].pop(entry.entry_id, None)
|
|
return True
|