mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Pass the real config for Discord (#76959)
This commit is contained in:
parent
280ae91ba1
commit
6ab9652b60
@ -7,12 +7,20 @@ from homeassistant.const import CONF_API_TOKEN, Platform
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DATA_HASS_CONFIG, DOMAIN
|
||||||
|
|
||||||
PLATFORMS = [Platform.NOTIFY]
|
PLATFORMS = [Platform.NOTIFY]
|
||||||
|
|
||||||
|
|
||||||
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
|
"""Set up the Discord component."""
|
||||||
|
|
||||||
|
hass.data[DATA_HASS_CONFIG] = config
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Discord from a config entry."""
|
"""Set up Discord from a config entry."""
|
||||||
nextcord.VoiceClient.warn_nacl = False
|
nextcord.VoiceClient.warn_nacl = False
|
||||||
@ -30,11 +38,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(
|
discovery.async_load_platform(
|
||||||
hass,
|
hass, Platform.NOTIFY, DOMAIN, dict(entry.data), hass.data[DATA_HASS_CONFIG]
|
||||||
Platform.NOTIFY,
|
|
||||||
DOMAIN,
|
|
||||||
hass.data[DOMAIN][entry.entry_id],
|
|
||||||
hass.data[DOMAIN],
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,3 +8,5 @@ DEFAULT_NAME = "Discord"
|
|||||||
DOMAIN: Final = "discord"
|
DOMAIN: Final = "discord"
|
||||||
|
|
||||||
URL_PLACEHOLDER = {CONF_URL: "https://www.home-assistant.io/integrations/discord"}
|
URL_PLACEHOLDER = {CONF_URL: "https://www.home-assistant.io/integrations/discord"}
|
||||||
|
|
||||||
|
DATA_HASS_CONFIG = "discord_hass_config"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user