-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Bluesound", | ||
"HACS" | ||
"HACS", | ||
"hass" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,30 @@ | ||
"""The Bluesound component.""" | ||
from __future__ import annotations | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
|
||
from . import hub | ||
from .const import DOMAIN | ||
|
||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Set up Hello World from a config entry.""" | ||
# Store an instance of the "connecting" class that does the work of speaking | ||
# with your actual devices. | ||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = hub.Hub(hass, entry.data["host"]) | ||
|
||
# This creates each HA object for each platform your device requires. | ||
# It's done by calling the `async_setup_entry` function in each platform module. | ||
await hass.config_entries.async_forward_entry_setups(entry, "media_player") | ||
return True | ||
|
||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Unload a config entry.""" | ||
# This is called when an entry/configured device is to be removed. The class | ||
# needs to unload itself, and remove callbacks. See the classes for further | ||
# details | ||
unload_ok = await hass.config_entries.async_unload_platforms(entry, "media_player") | ||
if unload_ok: | ||
hass.data[DOMAIN].pop(entry.entry_id) | ||
|
||
return unload_ok |