Add yamaha platform retry if receiver unavailable at setup (#122679)
* Add platform retry if recieiver unavailable at setup * Fix Excpetion handling after testing
This commit is contained in:
parent
146ec4e760
commit
3ad2456dd9
1 changed files with 5 additions and 1 deletions
|
@ -18,6 +18,7 @@ from homeassistant.components.media_player import (
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
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
|
# Get the Infos for configuration from config (YAML) or Discovery
|
||||||
config_info = YamahaConfigInfo(config=config, discovery_info=discovery_info)
|
config_info = YamahaConfigInfo(config=config, discovery_info=discovery_info)
|
||||||
# Async check if the Receivers are there in the network
|
# Async check if the Receivers are there in the network
|
||||||
|
try:
|
||||||
zone_ctrls = await hass.async_add_executor_job(_discovery, config_info)
|
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 = []
|
entities = []
|
||||||
for zctrl in zone_ctrls:
|
for zctrl in zone_ctrls:
|
||||||
|
|
Loading…
Add table
Reference in a new issue