Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corr-252 #255

Merged
merged 14 commits into from
Oct 27, 2021
6 changes: 6 additions & 0 deletions custom_components/spotcast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@


def setup(hass, config):

# get spotify core integration status
if not helpers.get_spotify_install_status(hass):
_LOGGER.error("Spotify integration was not found, aborting setup...")
return False

"""Setup the Spotcast service."""
conf = config[DOMAIN]

Expand Down
13 changes: 13 additions & 0 deletions custom_components/spotcast/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ def get_spotify_devices(hass, spotify_user_id):
_LOGGER.debug("get_spotify_devices: %s", resp)
return resp

def get_spotify_install_status(hass):

platform_string = "spotify"
platforms = entity_platform.async_get_platforms(hass, platform_string)
platform_count = len(platforms)

if platform_count == 0:
_LOGGER.error("%s integration not found", platform_string)
else:
_LOGGER.debug("%s integration found", platform_string)

return platform_count != 0


def get_cast_devices(hass):
platforms = entity_platform.async_get_platforms(hass, "cast")
Expand Down