Home Assistant Unofficial Reference 2024.12.1
system_health.py
Go to the documentation of this file.
1 """Provide info to system health."""
2 
3 from __future__ import annotations
4 
5 from typing import Any
6 
7 from homeassistant.components import system_health
8 from homeassistant.core import HomeAssistant, callback
9 from homeassistant.helpers import system_info
10 
11 
12 @callback
14  hass: HomeAssistant, register: system_health.SystemHealthRegistration
15 ) -> None:
16  """Register system health callbacks."""
17  register.async_register_info(system_health_info)
18 
19 
20 async def system_health_info(hass: HomeAssistant) -> dict[str, Any]:
21  """Get info for the info page."""
22  info = await system_info.async_get_system_info(hass)
23 
24  return {
25  "version": f"core-{info.get('version')}",
26  "installation_type": info.get("installation_type"),
27  "dev": info.get("dev"),
28  "hassio": info.get("hassio"),
29  "docker": info.get("docker"),
30  "user": info.get("user"),
31  "virtualenv": info.get("virtualenv"),
32  "python_version": info.get("python_version"),
33  "os_name": info.get("os_name"),
34  "os_version": info.get("os_version"),
35  "arch": info.get("arch"),
36  "timezone": info.get("timezone"),
37  "config_dir": hass.config.config_dir,
38  }
None async_register(HomeAssistant hass, system_health.SystemHealthRegistration register)
dict[str, Any] system_health_info(HomeAssistant hass)