developers.home-assistant/docs/intent_conversation.md
Ville Skyttä 770185004b
Code block improvements (#382)
* Use f-strings instead of .format()

* Code block language marker fixes

* Make example code blocks syntactically valid Python

* Run all python code blocks through black

https://github.com/scop/misc/blob/master/black_markdown.py

* Add some missing code block language markers

* Use shell language consistently to mark shell code blocks

* Undo folding of some example dicts

* Remove outdated OrderedDict comments per Python 3.7, replace with plain dict
2020-01-13 21:55:41 +02:00

858 B

title
Registering sentences

The conversation component handles incoming commands from the frontend and converts them to intents. It does this based on registered sentences.

As a component, you can register sentences with the conversation component to allow it to be remote controlled. Refer to named slots by putting the slot name between curly braces: {item}. Use square brackets around (partial) words to mark them as optional.

Example code:

async def async_setup(hass, config):
    hass.components.conversation.async_register(
        "MyCoolIntent",
        ["I think that {object} is [very] cool", "Nothing is cooler than {object}"],
    )

If a sentence like "I think that beer is cool" comes in, the conversation component will generate an intent of type MyCoolIntent and with 1 slot, named object and value beer.