Move intent registration to own integration (#29280)

* Move intent registration to own integration.

* Lint
This commit is contained in:
Paulus Schoutsen 2019-12-01 14:12:57 -08:00 committed by GitHub
parent d91dd68b31
commit d1aa0cea97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 389 additions and 289 deletions

View file

@ -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, {})