From b7a758bd0caee4d0920f51c4565cce2c00673469 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Tue, 21 Sep 2021 23:35:51 +0200 Subject: [PATCH] raise PlatformNotReady when speakers unreachable (#56508) Co-authored-by: Paulus Schoutsen --- homeassistant/components/kef/media_player.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/kef/media_player.py b/homeassistant/components/kef/media_player.py index f32f825acc4..c1c83f81b36 100644 --- a/homeassistant/components/kef/media_player.py +++ b/homeassistant/components/kef/media_player.py @@ -32,6 +32,7 @@ from homeassistant.const import ( STATE_OFF, STATE_ON, ) +from homeassistant.exceptions import PlatformNotReady from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers.event import async_track_time_interval @@ -123,7 +124,10 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= mode = get_ip_mode(host) mac = await hass.async_add_executor_job(partial(get_mac_address, **{mode: host})) - unique_id = f"kef-{mac}" if mac is not None else None + if mac is None: + raise PlatformNotReady("Cannot get the ip address of kef speaker.") + + unique_id = f"kef-{mac}" media_player = KefMediaPlayer( name,