|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: "Snips" |
| 4 | +description: "Instructions how to integrate Snips within Home Assistant." |
| 5 | +date: 2017-06-22 12:00 |
| 6 | +sidebar: true |
| 7 | +comments: false |
| 8 | +sharing: true |
| 9 | +footer: true |
| 10 | +logo: snips.png |
| 11 | +ha_category: Voice |
| 12 | +ha_release: 0.48 |
| 13 | +--- |
| 14 | + |
| 15 | +The [Snips Voice Platform](https://www.snips.ai) allows users to add powerful voice assistants to their Raspberry Pi devices without compromising on Privacy. It runs 100% on-device, and does not require an Internet connection. It features Hotword Detection, Automatic Speech Recognition (ASR), Natural Language Understanding (NLU) and Dialog Management. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +Snips takes voice or text as input, and produces *intents* as output, which are explicit representations of an intention behind an utterance, and which can subsequently be used by Home Assistant to perform appropriate actions. |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +## {% linkable_title The Snips Voice Platform %} |
| 25 | + |
| 26 | +### Installation |
| 27 | + |
| 28 | +The Snips Voice Platform is installed on Raspberry Pi with the following command: |
| 29 | + |
| 30 | +```sh |
| 31 | +(pi) $ curl https://install.snips.ai -sSf | sh |
| 32 | +``` |
| 33 | + |
| 34 | +### Creating an assistant |
| 35 | + |
| 36 | +<div class='videoWrapper'> |
| 37 | +<iframe src="https://player.vimeo.com/video/223255884" width="700" height="380" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> |
| 38 | +</div> |
| 39 | + |
| 40 | +Snips assistants are created via the [Snips Console](https://console.snips.ai). Once trained, the assistant should be downloaded and copied to the Raspberry Pi: |
| 41 | + |
| 42 | +```sh |
| 43 | +$ scp assistantproj_XXX.zip pi@pi_hostname:/home/pi/assistant.zip |
| 44 | +``` |
| 45 | + |
| 46 | +and installed locally via the `snips-install-assistant` helper script: |
| 47 | + |
| 48 | +```sh |
| 49 | +(pi) $ sudo snips-install-assistant assistant.zip |
| 50 | +``` |
| 51 | + |
| 52 | +### Running Snips |
| 53 | + |
| 54 | +Make sure that a microphone is plugged to the Raspberry Pi. If you are having trouble setting up audio, we have written a guide on [Raspberry Pi Audio Configuration](https://github.com/snipsco/snips-platform-documentation/wiki/1.-Setup-the-Snips-Voice-Platform-on-your-Raspberry-Pi#configuring-the-audio). |
| 55 | + |
| 56 | +Start the Snips Voice Platform using the `snips` command: |
| 57 | + |
| 58 | +```sh |
| 59 | +(pi) $ snips |
| 60 | +``` |
| 61 | + |
| 62 | +Snips is now ready to take voice commands from the microphone. To trigger the listening, simply say |
| 63 | + |
| 64 | +> Hey Snips |
| 65 | +
|
| 66 | +followed by a command, e.g. |
| 67 | + |
| 68 | +> Set the lights to green in the living room |
| 69 | +
|
| 70 | +We should see the transcribed phrase in the logs, as well as a properly parsed intent. The intent is published on MQTT, on the `hermes/nlu/intentParsed` topic. The Snips Home Assistant component subscribes to this topic, and handles the intent according to the rules defined in `configuration.yaml`, as explained below. |
| 71 | + |
| 72 | +## Home Assistant configuration |
| 73 | + |
| 74 | +By default, the Snips MQTT broker runs on port 9898. We should tell Home Assistant to use this as a broker, rather than its own, by adding the following section to `configuration.yaml`: |
| 75 | + |
| 76 | +```yaml |
| 77 | +mqtt: |
| 78 | + broker: 127.0.0.1 |
| 79 | + port: 9898 |
| 80 | +``` |
| 81 | +
|
| 82 | +In Home Assistant, we trigger actions based on intents produced by Snips. This is done in `configuration.yaml`. For instance, the following block handles `ActivateLightColors` intents (included in the Snips IoT intent bundle) to change light colors: |
| 83 | + |
| 84 | +```yaml |
| 85 | +snips: |
| 86 | + intents: |
| 87 | + ActivateLightColor: |
| 88 | + action: |
| 89 | + - service: light.turn_on |
| 90 | + data_template: |
| 91 | + entity_id: light.{% raw %}{{ objectLocation | replace(" ","_") }}{% endraw %} |
| 92 | + color_name: {% raw %}{{ objectColor }}{% endraw %} |
| 93 | +``` |
0 commit comments