feat: add executor-backed SQLite path resolver helper

This commit is contained in:
Joshua King
2026-09-13 15:10:33 -04:00
parent 3b9ffa383f
commit ec0fc29160
2 changed files with 136 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
"""SQLite storage path resolution for the NestQuest integration."""
from __future__ import annotations
from pathlib import Path
from homeassistant.core import HomeAssistant
from .const import SQLITE_DB_FILENAME
def _ensure_dir(path: Path) -> None:
"""Create the given directory and any missing parents."""
path.mkdir(parents=True, exist_ok=True)
async def async_get_db_path(hass: HomeAssistant) -> Path:
"""Return the absolute path to the NestQuest SQLite database file."""
db_path = Path(hass.config.path(SQLITE_DB_FILENAME))
await hass.async_add_executor_job(_ensure_dir, db_path.parent)
return db_path