Add NextDNS system health (#74368)

Add system_health
This commit is contained in:
Maciej Bieniek 2022-07-06 05:10:04 +02:00 committed by GitHub
parent 2e81be7721
commit f5e3344bfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 0 deletions

View file

@ -0,0 +1,25 @@
"""Provide info to system health."""
from __future__ import annotations
from typing import Any
from nextdns.const import API_ENDPOINT
from homeassistant.components import system_health
from homeassistant.core import HomeAssistant, callback
@callback
def async_register( # pylint:disable=unused-argument
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."""
return {
"can_reach_server": system_health.async_check_can_reach_url(hass, API_ENDPOINT)
}