From 3ad2456dd92833e8b62726e39da8e8deb63c5f5b Mon Sep 17 00:00:00 2001 From: "Phill (pssc)" Date: Sun, 28 Jul 2024 09:39:41 +0100 Subject: [PATCH] Add yamaha platform retry if receiver unavailable at setup (#122679) * Add platform retry if recieiver unavailable at setup * Fix Excpetion handling after testing --- homeassistant/components/yamaha/media_player.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/yamaha/media_player.py b/homeassistant/components/yamaha/media_player.py index 61077d648d2..bf217f12ca4 100644 --- a/homeassistant/components/yamaha/media_player.py +++ b/homeassistant/components/yamaha/media_player.py @@ -18,6 +18,7 @@ from homeassistant.components.media_player import ( ) from homeassistant.const import CONF_HOST, CONF_NAME from homeassistant.core import HomeAssistant +from homeassistant.exceptions import PlatformNotReady from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType @@ -157,7 +158,10 @@ async def async_setup_platform( # Get the Infos for configuration from config (YAML) or Discovery config_info = YamahaConfigInfo(config=config, discovery_info=discovery_info) # Async check if the Receivers are there in the network - zone_ctrls = await hass.async_add_executor_job(_discovery, config_info) + try: + zone_ctrls = await hass.async_add_executor_job(_discovery, config_info) + except requests.exceptions.ConnectionError as ex: + raise PlatformNotReady(f"Issue while connecting to {config_info.name}") from ex entities = [] for zctrl in zone_ctrls: