1 """Provide info to system health."""
3 from __future__
import annotations
11 from .coordinator
import (
19 SUPERVISOR_PING =
"http://{ip_address}/supervisor/ping"
20 OBSERVER_URL =
"http://{ip_address}:4357"
27 """Register system health callbacks."""
28 register.async_register_info(system_health_info)
32 """Get info for the info page."""
33 ip_address = os.environ[
"SUPERVISOR"]
39 healthy: bool | dict[str, str]
40 if supervisor_info
is not None and supervisor_info.get(
"healthy"):
48 supported: bool | dict[str, str]
49 if supervisor_info
is not None and supervisor_info.get(
"supported"):
54 "error":
"Unsupported",
58 "host_os": host_info.get(
"operating_system"),
59 "update_channel": info.get(
"channel"),
60 "supervisor_version": f
"supervisor-{info.get('supervisor')}",
61 "agent_version": host_info.get(
"agent_version"),
62 "docker_version": info.get(
"docker"),
63 "disk_total": f
"{host_info.get('disk_total')} GB",
64 "disk_used": f
"{host_info.get('disk_used')} GB",
66 "supported": supported,
67 "host_connectivity": network_info.get(
"host_internet"),
68 "supervisor_connectivity": network_info.get(
"supervisor_internet"),
69 "ntp_synchronized": host_info.get(
"dt_synchronized"),
70 "virtualization": host_info.get(
"virtualization"),
73 if info.get(
"hassos")
is not None:
75 information[
"board"] = os_info.get(
"board")
77 information[
"supervisor_api"] = system_health.async_check_can_reach_url(
79 SUPERVISOR_PING.format(ip_address=ip_address),
80 OBSERVER_URL.format(ip_address=ip_address),
82 information[
"version_api"] = system_health.async_check_can_reach_url(
84 f
"https://version.home-assistant.io/{info.get('channel')}.json",
87 information[
"installed_addons"] =
", ".join(
88 f
"{addon['name']} ({addon['version']})"
89 for addon
in (supervisor_info
or {}).
get(
"addons", [])
web.Response get(self, web.Request request, str config_key)
dict[str, Any]|None get_supervisor_info(HomeAssistant hass)
dict[str, Any]|None get_info(HomeAssistant hass)
dict[str, Any]|None get_host_info(HomeAssistant hass)
dict[str, Any]|None get_network_info(HomeAssistant hass)
dict[str, Any]|None get_os_info(HomeAssistant hass)
None async_register(HomeAssistant hass, system_health.SystemHealthRegistration register)
dict[str, Any] system_health_info(HomeAssistant hass)