1 """Provide info to system health."""
3 from __future__
import annotations
14 from .const
import DOMAIN, ISY_URL_POSTFIX
15 from .models
import IsyData
22 """Register system health callbacks."""
23 register.async_register_info(system_health_info)
27 """Get info for the info page."""
30 config_entry_id = next(
31 iter(hass.data[DOMAIN])
33 isy_data: IsyData = hass.data[DOMAIN][config_entry_id]
34 isy: ISY = isy_data.root
36 entry = hass.config_entries.async_get_entry(config_entry_id)
37 assert isinstance(entry, ConfigEntry)
38 health_info[
"host_reachable"] = await system_health.async_check_can_reach_url(
39 hass, f
"{entry.data[CONF_HOST]}{ISY_URL_POSTFIX}"
41 health_info[
"device_connected"] = isy.connected
42 health_info[
"last_heartbeat"] = isy.websocket.last_heartbeat
43 health_info[
"websocket_status"] = isy.websocket.status
dict[str, Any] system_health_info(HomeAssistant hass)
None async_register(HomeAssistant hass, system_health.SystemHealthRegistration register)