1 """The bluesound component."""
3 from dataclasses
import dataclass
5 from pyblu
import Player, SyncStatus
6 from pyblu.errors
import PlayerUnreachableError
16 from .const
import DOMAIN
17 from .services
import setup_services
19 CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
21 PLATFORMS = [Platform.MEDIA_PLAYER]
26 """Bluesound data class."""
29 sync_status: SyncStatus
32 type BluesoundConfigEntry = ConfigEntry[BluesoundRuntimeData]
35 async
def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
36 """Set up the Bluesound."""
37 if DOMAIN
not in hass.data:
38 hass.data[DOMAIN] = []
45 hass: HomeAssistant, config_entry: BluesoundConfigEntry
47 """Set up the Bluesound entry."""
48 host = config_entry.data[CONF_HOST]
49 port = config_entry.data[CONF_PORT]
51 async
with Player(host, port, session=session, default_timeout=10)
as player:
53 sync_status = await player.sync_status(timeout=1)
54 except PlayerUnreachableError
as ex:
59 await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
65 """Unload a config entry."""
66 return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
None setup_services(HomeAssistant hass)
bool async_setup_entry(HomeAssistant hass, BluesoundConfigEntry config_entry)
bool async_unload_entry(HomeAssistant hass, ConfigEntry config_entry)
bool async_setup(HomeAssistant hass, ConfigType config)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)