forked from home-assistant/core
Add system health check to Spotify (#43249)
This commit is contained in:
@@ -832,6 +832,7 @@ omit =
|
|||||||
homeassistant/components/spotcrime/sensor.py
|
homeassistant/components/spotcrime/sensor.py
|
||||||
homeassistant/components/spotify/__init__.py
|
homeassistant/components/spotify/__init__.py
|
||||||
homeassistant/components/spotify/media_player.py
|
homeassistant/components/spotify/media_player.py
|
||||||
|
homeassistant/components/spotify/system_health.py
|
||||||
homeassistant/components/squeezebox/__init__.py
|
homeassistant/components/squeezebox/__init__.py
|
||||||
homeassistant/components/squeezebox/browse_media.py
|
homeassistant/components/squeezebox/browse_media.py
|
||||||
homeassistant/components/squeezebox/media_player.py
|
homeassistant/components/squeezebox/media_player.py
|
||||||
|
@@ -16,5 +16,10 @@
|
|||||||
"reauth_account_mismatch": "The Spotify account authenticated with, does not match the account needed re-authentication."
|
"reauth_account_mismatch": "The Spotify account authenticated with, does not match the account needed re-authentication."
|
||||||
},
|
},
|
||||||
"create_entry": { "default": "Successfully authenticated with Spotify." }
|
"create_entry": { "default": "Successfully authenticated with Spotify." }
|
||||||
|
},
|
||||||
|
"system_health": {
|
||||||
|
"info": {
|
||||||
|
"api_endpoint_reachable": "Spotify API endpoint reachable"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
homeassistant/components/spotify/system_health.py
Normal file
20
homeassistant/components/spotify/system_health.py
Normal 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"
|
||||||
|
)
|
||||||
|
}
|
Reference in New Issue
Block a user