From fa605f394c1432afa6e07262ca970ad31ffde762 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 10 Dec 2017 10:58:00 +0100 Subject: [PATCH] Update command and other things --- source/_components/snips.markdown | 61 +++++++++++++++++-------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/source/_components/snips.markdown b/source/_components/snips.markdown index 622bfa904e0..642faabf93d 100644 --- a/source/_components/snips.markdown +++ b/source/_components/snips.markdown @@ -12,40 +12,40 @@ ha_category: Voice ha_release: 0.48 --- -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. +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. The latest documentation can be found here: [Snips Platform Documentation](https://github.com/snipsco/snips-platform-documentation/wiki). ![Snips Modules](/images/screenshots/snips_modules.png) -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. +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. ![Snips Modules](/images/screenshots/snips_nlu.png) ## {% linkable_title The Snips Voice Platform %} -### Installation +### {% linkable_title Installation %} -The Snips Voice Platform is installed as a docker image on Raspberry Pi with the following command: +The Snips Voice Platform is installed as a Docker image on Raspberry Pi with the following command: -```sh +```bash (pi) $ curl https://install.snips.ai -sSf | sh ``` Snips can also be installed on a Debian/Ubuntu machine as well: -```sh -sudo apt-get update -sudo apt-get install -y dirmngr -sudo bash -c 'echo "deb https://debian.snips.ai/$(lsb_release -cs) stable main" > /etc/apt/sources.list.d/snips.list' -sudo apt-key adv --keyserver pgp.mit.edu --recv-keys F727C778CCB0A455 +```bash +$ sudo apt-get update +$ sudo apt-get install -y dirmngr +$ sudo bash -c 'echo "deb https://debian.snips.ai/$(lsb_release -cs) stable main" > /etc/apt/sources.list.d/snips.list' +$ sudo apt-key adv --keyserver pgp.mit.edu --recv-keys F727C778CCB0A455 -sudo apt-get update -sudo apt-get install -y snips-platform-voice +$ sudo apt-get update +$ sudo apt-get install -y snips-platform-voice ``` -### Creating an assistant +### {% linkable_title Creating an assistant %}
@@ -53,29 +53,32 @@ sudo apt-get install -y snips-platform-voice 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: -```sh +```bash $ scp assistantproj_XXX.zip pi@pi_hostname:/home/pi/assistant.zip ``` and installed locally via the `snips-install-assistant` helper script: -```sh +```bash (pi) $ sudo snips-install-assistant assistant.zip ``` -### Running Snips +### {% linkable_title Running Snips %} 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). Start the Snips Voice Platform using the `snips` command: Raspberry Pi: -```sh + +```bash (pi) $ snips ``` + Debian/Ubuntu: -```sh -sudo systemctl start "snips-*" + +```bash +$ sudo systemctl start "snips-*" ``` Snips is now ready to take voice commands from the microphone. To trigger the listening, simply say @@ -88,26 +91,30 @@ followed by a command, e.g. 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/intent/` 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. -#### Optional: specifying an external MQTT broker +#### {% linkable_title Optional: specifying an external MQTT broker %} By default, Snips runs its own MQTT broker. But we can also tell Snips to use an external broker by specifying this when launching Snips. In this case, instead of running the `snips` command above (which assumes we are using the internal MQTT broker), we use the full launch command with explicitly specified parameters (replace `MQTT_BROKER_IP` and `MQTT_BROKER_PORT` with appropriate values): Raspberry Pi: ```sh -$ docker run -t --rm --name snips --log-driver none -v /home/pi/.asoundrc:/root/.asoundrc -v /opt/snips/config:/opt/snips/config --privileged -v /dev/snd:/dev/snd snipsdocker/platform --mqtt MQTT_BROKER_IP:MQTT_BROKER_PORT +$ docker run -t --rm --name snips --log-driver none \ + -v /home/pi/.asoundrc:/root/.asoundrc \ + -v /opt/snips/config:/opt/snips/config \ + --privileged -v /dev/snd:/dev/snd snipsdocker/platform \ + --mqtt MQTT_BROKER_IP:MQTT_BROKER_PORT ``` Debian/Ubuntu: -Edit the /etc/snips.toml file. See snips documentation for more information on configuring this +Edit the `/etc/snips.toml` file. See snips documentation for more information on configuring this For more details on launch options, check the documentation on [Snips Platform Commands](https://github.com/snipsco/snips-platform-documentation/wiki/6.--Learn-more:-Platform-Commands#using-a-custom-mqtt-bus). -## Home Assistant configuration +## {% linkable_title Home Assistant configuration %} -### Specifying the MQTT broker +### {% linkable_title Specifying the MQTT broker %} -Messages between Snips and Home Assistant are passed via MQTT. We must tell Home Assistant which MQTT broker to use by adding the following entry to `configuration.yaml`: +Messages between Snips and Home Assistant are passed via MQTT. We must tell Home Assistant which [MQTT broker](/docs/mqtt/) to use by adding the following entry to the `configuration.yaml` file: ```yaml mqtt: @@ -123,9 +130,9 @@ mqtt: port: 9898 ``` -Alternatively, MQTT can be configured to bridge messages between servers if using a custom mqtt broker such as mosquitto. +Alternatively, MQTT can be configured to bridge messages between servers if using a custom MQTT broker such as `mosquitto`. -### Triggering actions +### {% linkable_title Triggering actions %} In Home Assistant, we trigger actions based on intents produced by Snips using the [`intent_script`](/components/intent_script) component. For instance, the following block handles `ActivateLightColors` intents (included in the Snips IoT intent bundle) to change light colors: