From 1050baa9cc04d48137f16ac4074f0d10625ad7e6 Mon Sep 17 00:00:00 2001 From: Kyle Niewiada Date: Fri, 29 Mar 2019 11:08:36 -0400 Subject: [PATCH] throw `PlatformNotReady` if unable to connect (#22515) Throw `PlatformNotReady` for when the device disconnects, or when the Home Assistant is booting and the ADB server is not ready yet. --- homeassistant/components/androidtv/media_player.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/androidtv/media_player.py b/homeassistant/components/androidtv/media_player.py index 5bce21f05a0..0129b547acf 100644 --- a/homeassistant/components/androidtv/media_player.py +++ b/homeassistant/components/androidtv/media_player.py @@ -18,6 +18,7 @@ from homeassistant.const import ( ATTR_COMMAND, ATTR_ENTITY_ID, CONF_DEVICE_CLASS, CONF_HOST, CONF_NAME, CONF_PORT, STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING, STATE_STANDBY) +from homeassistant.exceptions import PlatformNotReady import homeassistant.helpers.config_validation as cv ANDROIDTV_DOMAIN = 'androidtv' @@ -125,7 +126,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): _LOGGER.warning("Could not connect to %s at %s%s", device_name, host, adb_log) - return + raise PlatformNotReady if host in hass.data[ANDROIDTV_DOMAIN]: _LOGGER.warning("Platform already setup on %s, skipping", host)