File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
homeassistant/components/soundtouch Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 44
55from libsoundtouch import soundtouch_device
66from libsoundtouch .device import SoundTouchDevice
7+ import requests
78import voluptuous as vol
89
910from homeassistant .config_entries import ConfigEntry
1011from homeassistant .const import CONF_HOST , Platform
1112from homeassistant .core import HomeAssistant , ServiceCall
13+ from homeassistant .exceptions import ConfigEntryNotReady
1214from homeassistant .helpers import config_validation as cv
1315from homeassistant .helpers .typing import ConfigType
1416
@@ -130,7 +132,14 @@ async def service_handle(service: ServiceCall) -> None:
130132
131133async def async_setup_entry (hass : HomeAssistant , entry : ConfigEntry ) -> bool :
132134 """Set up Bose SoundTouch from a config entry."""
133- device = await hass .async_add_executor_job (soundtouch_device , entry .data [CONF_HOST ])
135+ try :
136+ device = await hass .async_add_executor_job (
137+ soundtouch_device , entry .data [CONF_HOST ]
138+ )
139+ except requests .exceptions .ConnectionError as err :
140+ raise ConfigEntryNotReady (
141+ f"Unable to connect to SoundTouch device at { entry .data [CONF_HOST ]} "
142+ ) from err
134143
135144 hass .data .setdefault (DOMAIN , {})[entry .entry_id ] = SoundTouchData (device )
136145
You can’t perform that action at this time.
0 commit comments