from __future__ import annotations import os from dataclasses import dataclass @dataclass(frozen=True) class Settings: ha_url: str | None = None ha_token: str | None = None model_store: str = ".model_store" automation_store: str = ".automation_store" @property def ha_configured(self) -> bool: return bool(self.ha_url and self.ha_token) def load_settings() -> Settings: return Settings( ha_url=os.getenv("SILLYHOME_HA_URL") or os.getenv("HA_URL"), ha_token=os.getenv("SILLYHOME_HA_TOKEN") or os.getenv("HA_TOKEN"), model_store=os.getenv("SILLYHOME_MODEL_STORE", ".model_store"), automation_store=os.getenv("SILLYHOME_AUTOMATION_STORE", ".automation_store"), )