File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
custom_components/panda_status Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ """System Health platform for panda_status custom component."""
2+
3+ from typing import TYPE_CHECKING , Any
4+
5+ from custom_components .panda_status .const import DOMAIN
6+ from homeassistant .components import system_health
7+ from homeassistant .const import CONF_URL
8+ from homeassistant .core import HomeAssistant , callback
9+
10+ if TYPE_CHECKING :
11+ from .data import PandaStatusConfigEntry
12+
13+
14+ @callback
15+ def async_register (
16+ hass : HomeAssistant , # noqa: ARG001
17+ register : system_health .SystemHealthRegistration ,
18+ ) -> None :
19+ """Register system health callbacks."""
20+ register .async_register_info (system_health_info )
21+
22+
23+ async def system_health_info (hass : HomeAssistant ) -> dict [str , Any ]:
24+ """Get info for the info page."""
25+ config_entry : PandaStatusConfigEntry = hass .config_entries .async_entries (DOMAIN )[0 ]
26+
27+ return {
28+ "can_reach_server" : system_health .async_check_can_reach_url (
29+ hass , config_entry .data [CONF_URL ]
30+ ),
31+ }
Original file line number Diff line number Diff line change 1616 "abort" : {
1717 "already_configured" : " This entry is already configured."
1818 }
19+ },
20+ "system_health" : {
21+ "info" : {
22+ "can_reach_server" : " WebSocket reachable"
23+ }
1924 }
2025}
You can’t perform that action at this time.
0 commit comments