diff --git a/.coveragerc b/.coveragerc index 064fe422358..9989f20aff3 100644 --- a/.coveragerc +++ b/.coveragerc @@ -832,6 +832,7 @@ omit = homeassistant/components/spotcrime/sensor.py homeassistant/components/spotify/__init__.py homeassistant/components/spotify/media_player.py + homeassistant/components/spotify/system_health.py homeassistant/components/squeezebox/__init__.py homeassistant/components/squeezebox/browse_media.py homeassistant/components/squeezebox/media_player.py diff --git a/homeassistant/components/spotify/strings.json b/homeassistant/components/spotify/strings.json index 8745df8e56f..74df79c4d78 100644 --- a/homeassistant/components/spotify/strings.json +++ b/homeassistant/components/spotify/strings.json @@ -16,5 +16,10 @@ "reauth_account_mismatch": "The Spotify account authenticated with, does not match the account needed re-authentication." }, "create_entry": { "default": "Successfully authenticated with Spotify." } + }, + "system_health": { + "info": { + "api_endpoint_reachable": "Spotify API endpoint reachable" + } } } diff --git a/homeassistant/components/spotify/system_health.py b/homeassistant/components/spotify/system_health.py new file mode 100644 index 00000000000..a22f7b8a821 --- /dev/null +++ b/homeassistant/components/spotify/system_health.py @@ -0,0 +1,20 @@ +"""Provide info to system health.""" +from homeassistant.components import system_health +from homeassistant.core import HomeAssistant, callback + + +@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): + """Get info for the info page.""" + return { + "api_endpoint_reachable": system_health.async_check_can_reach_url( + hass, "https://api.spotify.com" + ) + }