2020-11-03 13:28:55 +00:00
|
|
|
"""Provide info to system health."""
|
|
|
|
from homeassistant.components import system_health
|
|
|
|
from homeassistant.core import HomeAssistant, callback
|
|
|
|
|
|
|
|
from .const import DOMAIN
|
|
|
|
|
|
|
|
|
|
|
|
@callback
|
|
|
|
def async_register(
|
2020-11-10 21:45:59 +00:00
|
|
|
hass: HomeAssistant, register: system_health.SystemHealthRegistration
|
2020-11-03 13:28:55 +00:00
|
|
|
) -> None:
|
|
|
|
"""Register system health callbacks."""
|
2020-11-10 21:45:59 +00:00
|
|
|
register.async_register_info(system_health_info, "/config/lovelace")
|
2020-11-03 13:28:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def system_health_info(hass):
|
|
|
|
"""Get info for the info page."""
|
|
|
|
health_info = {"dashboards": len(hass.data[DOMAIN]["dashboards"])}
|
|
|
|
health_info.update(await hass.data[DOMAIN]["dashboards"][None].async_get_info())
|
|
|
|
health_info.update(await hass.data[DOMAIN]["resources"].async_get_info())
|
|
|
|
return health_info
|