Move intent registration to own integration (#29280)
* Move intent registration to own integration. * Lint
This commit is contained in:
parent
d91dd68b31
commit
d1aa0cea97
16 changed files with 389 additions and 289 deletions
|
@ -3,9 +3,12 @@ import logging
|
|||
import re
|
||||
from typing import Optional
|
||||
|
||||
from homeassistant import core
|
||||
from homeassistant.components.cover import INTENT_CLOSE_COVER, INTENT_OPEN_COVER
|
||||
from homeassistant.components.shopping_list import INTENT_ADD_ITEM, INTENT_LAST_ITEMS
|
||||
from homeassistant import core, setup
|
||||
from homeassistant.components.cover.intent import INTENT_CLOSE_COVER, INTENT_OPEN_COVER
|
||||
from homeassistant.components.shopping_list.intent import (
|
||||
INTENT_ADD_ITEM,
|
||||
INTENT_LAST_ITEMS,
|
||||
)
|
||||
from homeassistant.const import EVENT_COMPONENT_LOADED
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import intent
|
||||
|
@ -58,6 +61,9 @@ class DefaultAgent(AbstractConversationAgent):
|
|||
|
||||
async def async_initialize(self, config):
|
||||
"""Initialize the default agent."""
|
||||
if "intent" not in self.hass.config.components:
|
||||
await setup.async_setup_component(self.hass, "intent", {})
|
||||
|
||||
config = config.get(DOMAIN, {})
|
||||
intents = self.hass.data.setdefault(DOMAIN, {})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue