-
-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Expand file tree
/
Copy pathsystem_health.py
More file actions
28 lines (20 loc) · 804 Bytes
/
system_health.py
File metadata and controls
28 lines (20 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Provide info to system health."""
from typing import Any
from homeassistant.components import system_health
from homeassistant.const import CONF_URL
from homeassistant.core import HomeAssistant, callback
from .const import DOMAIN
@callback
def async_register(
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) -> None:
"""Register system health callbacks."""
register.async_register_info(system_health_info)
async def system_health_info(hass: HomeAssistant) -> dict[str, Any]:
"""Get info for the info page."""
config_entry = hass.config_entries.async_entries(DOMAIN)[0]
return {
"can_reach_server": system_health.async_check_can_reach_url(
hass, f"{config_entry.data[CONF_URL].rstrip('/')}/api/system/status"
),
}