For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /developers/dev_101_config.md.

Config

hass 对象 上存在一个 Config 类的实例。Config 类包含了用户首选的单位、config 目录路径以及加载了哪些 components。

NameTypeDescription
latitudefloat实例位置的纬度
longitudefloat实例位置的经度
elevationint实例的海拔
location_namestr实例名称
time_zonestr时区
unitsUnitSystem单位系统
internal_urlstr可在内部访问实例的 URL
external_urlstr可在外部访问实例的 URL
currencystr首选货币
countrystr实例所在的国家
languagestr首选语言
config_sourceConfigSource配置是通过 UI 设置还是存储在 YAML 中
skip_pipbool如果为 True,启动时会跳过对 requirements 的 pip install
skip_pip_packageslist[str]启动时安装 requirements 时要跳过的包列表
componentsset[str]已加载的 components 列表
apiApiConfigAPI (HTTP) 服务器配置
config_dirstr存放配置的目录
allowlist_external_dirsset[str]允许访问的外部目录列表
allowlist_external_urlsset[str]允许 integrations 使用的外部 URL 列表
media_dirsdict[str, str]integrations 可使用的媒体文件夹字典
safe_modeboolHome Assistant 是否正在以 safe mode 运行
legacy_templatesbool使用旧的模板行为

它还提供了若干 helper 方法。