INNER CODE UNIT · Python
WMData
dummylabs/thewatchman · custom_components/watchman/__init__.py:51
class WMData:
"""Watchman runtime data."""
coordinator: WatchmanCoordinator
hub: WatchmanHub
async def async_setup_entry(hass: HomeAssistant, config_entry: WMConfigEntry) -> bool:
"""Set up this integration using UI."""
from .const import DB_FILENAME, LEGACY_DB_FILENAME
legacy_db_path = Path(hass.config.path(".storage", LEGACY_DB_FILENAME))
db_path = Path(hass.config.path(".storage", DB_FILENAME))
# One-time migration: rename watchman.db to watchman_v2.db
if not db_path.exists() and legacy_db_path.exists():
_LOGGER.info(
"Migrating legacy database %s to %s", LEGACY_DB_FILENAME, DB_FILENAME
)