Add system health check to Spotify (#43249)

This commit is contained in:
Franck Nijhof 2020-11-27 19:25:17 +01:00 committed by GitHub
parent 29091f4537
commit 0d5dc4aeee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 0 deletions

View file

@ -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

View file

@ -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"
}
}
}

View file

@ -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"
)
}