mirror of
https://github.com/aljazceru/addons.git
synced 2026-02-01 03:05:49 +01:00
snips: Remove add-on from repository (#1044)
This commit is contained in:
@@ -85,10 +85,6 @@ systems that have installed Hass.io.
|
||||
|
||||
Expose Hass.io folders with SMB/CIFS.
|
||||
|
||||
- **[Snips.AI](/snips/README.md)**
|
||||
|
||||
Local voice control platform.
|
||||
|
||||
- **[SSH server](/ssh/README.md)**
|
||||
|
||||
Allow logging in remotely to Hass.io using SSH.
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## 6.1
|
||||
|
||||
- set hermes/audioServer/+/playBytesStreaming/# to allow subscribing from other systems
|
||||
- set hermes/audioServer/+/streamFinished to allow subscribing from other systems
|
||||
- Fix GPG Key for Build
|
||||
|
||||
## 6.0
|
||||
|
||||
- Updated to snips 0.64.0
|
||||
|
||||
***Warning: Need new NLU***
|
||||
|
||||
## 5.3
|
||||
|
||||
- Updated to snips 0.63.2
|
||||
- Pinned docker version to 0.63.2
|
||||
- set hermes/hotword/+/detected out to allow subscribing from other systems
|
||||
|
||||
## 5.2
|
||||
|
||||
- Updated to snips 0.62.3
|
||||
- Add snips-injection
|
||||
|
||||
## 5.1
|
||||
|
||||
- Updated to snips 0.60.8
|
||||
- Containers built from base images
|
||||
|
||||
## 5.0
|
||||
|
||||
- Updated to snips 0.60.1
|
||||
|
||||
## 4.0
|
||||
|
||||
- Use new Hass.io Services API and cleanup config
|
||||
|
||||
## 3.3
|
||||
|
||||
- Updated to snips 0.58.3
|
||||
- NOTE: This version requires an updated assistant from the Snips Console.
|
||||
|
||||
## 3.2
|
||||
|
||||
- Added snips-asr-injections service to allow dynamic entity names
|
||||
|
||||
## 3.1
|
||||
|
||||
- Updated to snips version 0.56.4
|
||||
|
||||
## 3.0
|
||||
|
||||
- Updated to snips version 0.55.2
|
||||
- Updated default assistant with additional languages
|
||||
- Added custom tts which use HA TTS platforms
|
||||
|
||||
## 2.0
|
||||
|
||||
- Use new Supervisor Audio backend
|
||||
- Update preinstalled assistant for Home-Assistant
|
||||
|
||||
## 1.0
|
||||
|
||||
- Updated to snips version 0.53.17
|
||||
|
||||
## 0.9
|
||||
|
||||
- Update preinstalled assistant for Home-Assistant
|
||||
|
||||
## 0.8
|
||||
|
||||
- Updated to snips version 0.52.7
|
||||
|
||||
## 0.7
|
||||
|
||||
- Updated to snips version 0.51.14
|
||||
- Added default assistant for hassio builtin intents
|
||||
@@ -1,49 +0,0 @@
|
||||
ARG BUILD_FROM
|
||||
FROM $BUILD_FROM
|
||||
|
||||
# Copy data
|
||||
COPY data/run.sh /
|
||||
COPY data/mosquitto.conf /etc/
|
||||
COPY data/customtts.sh /usr/bin
|
||||
COPY data/snips-entrypoint.sh /
|
||||
|
||||
ARG BUILD_ARCH
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-transport-https \
|
||||
apt-utils \
|
||||
dirmngr \
|
||||
gnupg-curl \
|
||||
mpg123 \
|
||||
supervisor \
|
||||
unzip \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& if [ "$BUILD_ARCH" = "amd64" ]; \
|
||||
then \
|
||||
bash -c 'echo "deb https://debian.snips.ai/stretch stable main" > /etc/apt/sources.list.d/snips.list' \
|
||||
&& apt-key adv --fetch-keys https://debian.snips.ai/5FFCD0DEB5BA45CD.pub; \
|
||||
else \
|
||||
bash -c 'echo "deb https://raspbian.snips.ai/stretch stable main" > /etc/apt/sources.list.d/snips.list' \
|
||||
&& apt-key adv --fetch-keys https://raspbian.snips.ai/531DD1A7B702B14D.pub; \
|
||||
fi
|
||||
|
||||
ARG SNIPS_VERSION
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
snips-platform-voice=${SNIPS_VERSION} \
|
||||
snips-asr=${SNIPS_VERSION} \
|
||||
snips-injection=${SNIPS_VERSION} \
|
||||
snips-watch=${SNIPS_VERSION} \
|
||||
mosquitto \
|
||||
snips-audio-server=${SNIPS_VERSION} \
|
||||
snips-dialogue=${SNIPS_VERSION} \
|
||||
snips-hotword=${SNIPS_VERSION} \
|
||||
snips-nlu=${SNIPS_VERSION} \
|
||||
snips-tts=${SNIPS_VERSION} \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& curl -L -o /assistant_Hass_de.zip https://s3.amazonaws.com/hassio-addons-data/assistant_Hass_de.zip \
|
||||
&& curl -L -o /assistant_Hass_en.zip https://s3.amazonaws.com/hassio-addons-data/assistant_Hass_en.zip \
|
||||
&& curl -L -o /assistant_Hass_fr.zip https://s3.amazonaws.com/hassio-addons-data/assistant_Hass_fr.zip
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
@@ -1,97 +0,0 @@
|
||||
# Hass.io Core Add-on: Snips.AI
|
||||
|
||||
Support for Snips.ai voice assistant.
|
||||
|
||||
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
|
||||
|
||||
## About
|
||||
|
||||
Snips.ai is an AI-powered voice assistant that runs on the Raspberry Pi 3 and x86 platforms.
|
||||
In contrast to Google Assistant or Amazon Alexa, it runs on-device and is private by design.
|
||||
|
||||
## Installation
|
||||
|
||||
Follow these steps to get the add-on installed on your system:
|
||||
|
||||
1. Navigate in your Home Assistant frontend to **Hass.io** -> **Add-on Store**.
|
||||
2. Find the "Snips.AI" add-on and click it.
|
||||
3. Click on the "INSTALL" button.
|
||||
|
||||
## How to use
|
||||
|
||||
Home Assistant comes with certain Intents builtin to handle common tasks. A complete list of Intents can be found in this wiki [Hass Snips Bundle](https://github.com/tschmidty69/hass-snips-bundle-intents/wiki).
|
||||
|
||||
The Snips add-on by default comes with an assistant that allows you to turn on lights or switches, open covers, or add and list items to a [Shopping List](/integrations/shopping_list/) if that integration is enabled.
|
||||
|
||||
If using a USB microphone and speakers plugged into the Raspberry Pi output, Snips will work without any change to the configuration. Trying saying things like:
|
||||
|
||||
```txt
|
||||
Turn on kitchen light
|
||||
Open garage door
|
||||
What is on my shopping list
|
||||
```
|
||||
|
||||
To get started creating your own configuration, follow [their tutorial](https://docs.snips.ai/getting-started/quick-start-console) to create an assistant and download the training data. You can also add the Home Assistant Skill to your assistant to enable the built-in intents, and add or create your own intents to do more complex tasks.
|
||||
|
||||
Now install and activate the [Samba](/addons/samba/) add-on so you can upload your training data. Connect to the "share" Samba share and copy your assistant over. Name the file `assistant.zip` or whatever you have configured in the configuration options.
|
||||
|
||||
Now it's time to start Snips for the first time. You can configure the microphone and sound card using the Add-on interface. Now start the add-on.
|
||||
|
||||
## Configuration
|
||||
|
||||
Add-on configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"assistant": "assistant.zip",
|
||||
"language": "en",
|
||||
"custom_tts": {
|
||||
"active": false,
|
||||
"platform": "amazon_polly"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Option: `assistant`
|
||||
|
||||
The name of your custom assistant in `/share`. If no assistant is found, then a default assistant will be used.
|
||||
|
||||
### Option: `language`
|
||||
|
||||
This is used to select the default custom assistant. Currently, `en`, `de` and `fr` are supported.
|
||||
|
||||
### Option group `custom_tts`
|
||||
|
||||
Specifies whether a custom tts should be used. And if so,
|
||||
which custom tts.
|
||||
|
||||
#### Option `custom_tts.active`
|
||||
|
||||
Indicates whether a custom tts is used or not.
|
||||
|
||||
#### Option: `custom_tts.platform`
|
||||
|
||||
Specifies which TTS platform to use.
|
||||
|
||||
## Support
|
||||
|
||||
Got questions?
|
||||
|
||||
You have several options to get them answered:
|
||||
|
||||
- The [Home Assistant Discord Chat Server][discord].
|
||||
- The Home Assistant [Community Forum][forum].
|
||||
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
|
||||
|
||||
In case you've found a bug, please [open an issue on our GitHub][issue].
|
||||
|
||||
[aarch64-shield]: https://img.shields.io/badge/aarch64-no-red.svg
|
||||
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
|
||||
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
|
||||
[armv7-shield]: https://img.shields.io/badge/armv7-no-red.svg
|
||||
[discord]: https://discord.gg/c5DvZ4e
|
||||
[forum]: https://community.home-assistant.io
|
||||
[i386-shield]: https://img.shields.io/badge/i386-no-red.svg
|
||||
[issue]: https://github.com/home-assistant/hassio-addons/issues
|
||||
[reddit]: https://reddit.com/r/homeassistant
|
||||
[repository]: https://github.com/hassio-addons/repository
|
||||
@@ -1,21 +0,0 @@
|
||||
# https://dev.azure.com/home-assistant
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
paths:
|
||||
include:
|
||||
- snips/*
|
||||
pr: none
|
||||
|
||||
variables:
|
||||
- name: versionBuilder
|
||||
value: "2.0"
|
||||
- group: docker
|
||||
|
||||
jobs:
|
||||
- template: /.azure/azp-template-addon.yml
|
||||
parameters:
|
||||
addon: "snips"
|
||||
arch: "--armhf --amd64"
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"build_from": {
|
||||
"armhf": "homeassistant/armhf-base-raspbian:stretch",
|
||||
"amd64": "homeassistant/amd64-base-ubuntu:16.04"
|
||||
},
|
||||
"args": {
|
||||
"SNIPS_VERSION": "0.64.0"
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "Snips.AI",
|
||||
"version": "6.1",
|
||||
"slug": "snips",
|
||||
"description": "Local voice control platform",
|
||||
"url": "https://github.com/home-assistant/hassio-addons/tree/master/snips",
|
||||
"arch": ["armhf", "amd64"],
|
||||
"startup": "application",
|
||||
"boot": "auto",
|
||||
"map": ["share"],
|
||||
"tmpfs": "size=10m",
|
||||
"audio": true,
|
||||
"services": ["mqtt:need"],
|
||||
"homeassistant_api": true,
|
||||
"options": {
|
||||
"assistant": "assistant.zip",
|
||||
"language": "en",
|
||||
"custom_tts": {
|
||||
"active": false,
|
||||
"platform": "amazon_polly"
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"assistant": "str",
|
||||
"language": "match(en|de|fr)",
|
||||
"custom_tts": {
|
||||
"active": "bool",
|
||||
"platform": "str"
|
||||
}
|
||||
},
|
||||
"image": "homeassistant/{arch}-addon-snips"
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -x
|
||||
API_KEY="$HASSIO_TOKEN"
|
||||
PLATFORM="$1"
|
||||
FILE="$2"
|
||||
LANG="$3"
|
||||
TEXT="$4"
|
||||
|
||||
MESSAGE="\"{\\\"message\\\": \\\"${TEXT}\\\", \\\"platform\\\": \\\"${PLATFORM}\\\"}\""
|
||||
echo "${MESSAGE}"
|
||||
|
||||
RESPONSE=$(eval curl -s -d "${MESSAGE}" -H \"Authorization: Bearer "${API_KEY}"\" -H \"Type: application/json\" http://hassio/homeassistant/api/tts_get_url)
|
||||
if [ -z "${RESPONSE}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "${RESPONSE}"
|
||||
|
||||
URL="$(echo "${RESPONSE}" | jq --raw-output '.url')"
|
||||
if [ -z "${URL}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f /tmpfs/temp.mp3
|
||||
curl -s -H "Authorization: Bearer ${API_KEY}" "${URL}" -o /tmpfs/temp.mp3
|
||||
if [ -f /tmpfs/temp.mp3 ]; then
|
||||
/usr/bin/mpg123 -w "${FILE}" /tmpfs/temp.mp3
|
||||
fi
|
||||
rm -f /tmpfs/temp.mp3
|
||||
@@ -1,13 +0,0 @@
|
||||
##
|
||||
# defaults
|
||||
listener 1883
|
||||
user root
|
||||
|
||||
##
|
||||
# logging
|
||||
log_dest stdout
|
||||
|
||||
##
|
||||
# datastore
|
||||
persistence true
|
||||
persistence_location /data/
|
||||
@@ -1,106 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
ASSISTANT=$(jq --raw-output '.assistant' $CONFIG_PATH)
|
||||
LANG=$(jq --raw-output '.language // "en"' $CONFIG_PATH)
|
||||
CUSTOMTTS=$(jq --raw-output '.custom_tts.active' $CONFIG_PATH)
|
||||
MQTT_CONFIG=
|
||||
|
||||
echo "[INFO] LANG: ${LANG}"
|
||||
|
||||
echo "[INFO] Checking for /share/snips.toml"
|
||||
if [ -f "/share/snips.toml" ]; then
|
||||
echo "[INFO] - Installing /share/snips.toml"
|
||||
cp -v /share/snips.toml /etc/
|
||||
fi
|
||||
|
||||
if [ "${CUSTOMTTS}" == "true" ]; then
|
||||
PLATFORM=$(jq --raw-output '.custom_tts.platform' $CONFIG_PATH)
|
||||
|
||||
if [ -z "${PLATFORM}" ]; then
|
||||
echo "[ERROR] - platform must be set to use custom tts!"
|
||||
else
|
||||
echo "[INFO] - Using custom tts"
|
||||
(
|
||||
echo "provider = \"customtts\""
|
||||
echo "customtts = { command = [\"/usr/bin/customtts.sh\", \"${PLATFORM}\", \"%%OUTPUT_FILE%%\", \"${LANG}\", \"%%TEXT%%\"] }"
|
||||
) >> /etc/snips.toml
|
||||
fi
|
||||
else
|
||||
echo "[INFO] - Using default tts (picotts)"
|
||||
fi
|
||||
|
||||
# Use Hass.io mqtt services
|
||||
if MQTT_CONFIG="$(curl -s -f -H "X-Hassio-Key: ${HASSIO_TOKEN}" http://hassio/services/mqtt)"; then
|
||||
HOST="$(echo "${MQTT_CONFIG}" | jq --raw-output '.data.host')"
|
||||
PORT="$(echo "${MQTT_CONFIG}" | jq --raw-output '.data.port')"
|
||||
USER="$(echo "${MQTT_CONFIG}" | jq --raw-output '.data.username')"
|
||||
PASSWORD="$(echo "${MQTT_CONFIG}" | jq --raw-output '.data.password')"
|
||||
|
||||
echo "[INFO] Setup Hass.io mqtt service to ${HOST}"
|
||||
|
||||
(
|
||||
echo "connection main-mqtt"
|
||||
echo "address ${HOST}:${PORT}"
|
||||
) >> /etc/mosquitto.conf
|
||||
|
||||
if [ -n "${USER}" ]; then
|
||||
(
|
||||
echo "username ${USER}"
|
||||
echo "password ${PASSWORD}"
|
||||
) >> /etc/mosquitto.conf
|
||||
fi
|
||||
|
||||
(
|
||||
echo "topic hermes/intent/# out"
|
||||
echo "topic hermes/hotword/toggleOn out"
|
||||
echo "topic hermes/hotword/toggleOff out"
|
||||
echo "topic hermes/hotword/+/detected out"
|
||||
echo "topic hermes/asr/stopListening out"
|
||||
echo "topic hermes/asr/startListening out"
|
||||
echo "topic hermes/nlu/intentNotParsed out"
|
||||
echo "topic hermes/audioServer/+/playBytes/# out"
|
||||
echo "topic hermes/audioServer/+/playFinished out"
|
||||
echo "topic hermes/audioServer/+/playBytesStreaming/# out"
|
||||
echo "topic hermes/audioServer/+/streamFinished out"
|
||||
echo "topic # IN hermes/"
|
||||
) >> /etc/mosquitto.conf
|
||||
else
|
||||
echo "[ERROR] No Hass.io mqtt service found!"
|
||||
fi
|
||||
|
||||
echo "[INFO] Start internal mqtt broker"
|
||||
mosquitto -c /etc/mosquitto.conf &
|
||||
|
||||
|
||||
echo "[INFO] Checking for updated ${ASSISTANT} in /share"
|
||||
# check if a new assistant file exists
|
||||
if [ -f "/share/${ASSISTANT}" ]; then
|
||||
echo "[INFO] Install/Update snips assistant"
|
||||
rm -rf /usr/share/snips/assistant
|
||||
unzip -o -u "/share/${ASSISTANT}" -d /usr/share/snips
|
||||
# otherwise use the default
|
||||
else
|
||||
echo "[INFO] Checking for /assistant_Hass_${LANG}.zip"
|
||||
if [ -f "/assistant_Hass_${LANG}.zip" ]; then
|
||||
echo "[INFO] - Using default assistant_Hass_${LANG}.zip"
|
||||
rm -rf /usr/share/snips/assistant
|
||||
unzip -o -u "/assistant_Hass_${LANG}.zip" -d /usr/share/snips
|
||||
else
|
||||
echo "[ERROR] Could not find assistant!"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[INFO] Starting snips-watch"
|
||||
( sleep 2; /usr/bin/snips-watch -vvv --no_color ) &
|
||||
|
||||
/usr/bin/snips-asr --version
|
||||
/usr/bin/snips-injection --version
|
||||
/usr/bin/snips-audio-server --version
|
||||
/usr/bin/snips-dialogue --version
|
||||
/usr/bin/snips-hotword --version
|
||||
/usr/bin/snips-nlu --version
|
||||
|
||||
/snips-entrypoint.sh --mqtt localhost:1883
|
||||
@@ -1,406 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Execute cli if requested
|
||||
if [ "$1" = "snips" ]
|
||||
then
|
||||
shift
|
||||
exec snips "$@"
|
||||
fi
|
||||
|
||||
|
||||
ASSISTANT_FILE=/usr/share/snips/assistant/assistant.json
|
||||
if [ ! -f "$ASSISTANT_FILE" ]
|
||||
then
|
||||
echo "Couldn't find any assistant"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SUPERVISORD_CONF_FILE="/etc/supervisor/conf.d/supervisord.conf"
|
||||
ASR_TYPE=$(jq --raw-output '.asr.type' $ASSISTANT_FILE)
|
||||
ANALYTICS_ENABLED=$(jq --raw-output '.analyticsEnabled' $ASSISTANT_FILE)
|
||||
SNIPS_MOSQUITTO_FLAG="-h localhost -p 1883"
|
||||
|
||||
|
||||
if [ -z "$SNIPS_AUDIO_SERVER_MQTT_ARGS" ]
|
||||
then
|
||||
SNIPS_AUDIO_SERVER_MQTT_ARGS="--frame=256"
|
||||
fi
|
||||
|
||||
if [ -d "/opt/snips/asr" ]
|
||||
then
|
||||
SNIPS_ASR_MODEL=""
|
||||
else
|
||||
SNIPS_ASR_MODEL=""
|
||||
fi
|
||||
if [ -z "$SNIPS_ASR_ARGS" ]
|
||||
then
|
||||
SNIPS_ASR_ARGS="$SNIPS_ASR_MODEL --beam_size=8"
|
||||
fi
|
||||
|
||||
if [ -z "$SNIPS_ASR_MQTT_ARGS" ]
|
||||
then
|
||||
SNIPS_ASR_MQTT_ARGS=""
|
||||
fi
|
||||
|
||||
if [ -z "$SNIPS_DIALOGUE_MQTT_ARGS" ]
|
||||
then
|
||||
SNIPS_DIALOGUE_MQTT_ARGS=""
|
||||
fi
|
||||
|
||||
if [ -z "$SNIPS_ASR_GOOGLE_MQTT_ARGS" ]
|
||||
then
|
||||
SNIPS_ASR_GOOGLE_MQTT_ARGS=""
|
||||
fi
|
||||
|
||||
if [ -z "$SNIPS_HOTWORD_ARGS" ]
|
||||
then
|
||||
SNIPS_HOTWORD_ARGS=""
|
||||
fi
|
||||
if [ -z "$SNIPS_HOTWORD_MQTT_ARGS" ]
|
||||
then
|
||||
SNIPS_HOTWORD_MQTT_ARGS=""
|
||||
fi
|
||||
|
||||
if [ -z "$SNIPS_ANALYTICS_MQTT_ARGS" ]
|
||||
then
|
||||
SNIPS_ANALYTICS_MQTT_ARGS=""
|
||||
fi
|
||||
|
||||
if [ -z "$SNIPS_QUERIES_MQTT_ARGS" ]
|
||||
then
|
||||
SNIPS_QUERIES_MQTT_ARGS=""
|
||||
fi
|
||||
|
||||
|
||||
# Read "global" arguments
|
||||
USE_INTERNAL_MQTT=true
|
||||
ALL_SNIPS_COMPONENTS=("snips-asr-google" "snips-asr" "snips-injection" "snips-audio-server" "snips-tts" "snips-hotword" "snips-nlu" "snips-dialogue" "snips-analytics" "snips-debug")
|
||||
declare -A SNIPS_COMPONENTS
|
||||
for c in "${ALL_SNIPS_COMPONENTS[@]}"
|
||||
do
|
||||
SNIPS_COMPONENTS[$c]=true
|
||||
done
|
||||
|
||||
if [ "$ASR_TYPE" != "google" ]
|
||||
then
|
||||
SNIPS_COMPONENTS["snips-asr-google"]=false
|
||||
elif [ "$ASR_TYPE" != "snips" ]
|
||||
then
|
||||
SNIPS_COMPONENTS["snips-asr"]=false
|
||||
fi
|
||||
|
||||
if [ "$ANALYTICS_ENABLED" != "true" ]
|
||||
then
|
||||
SNIPS_COMPONENTS["snips-analytics"]=false
|
||||
fi
|
||||
|
||||
|
||||
for i in $(seq 1 $#)
|
||||
do
|
||||
j=$((i+1))
|
||||
TYPE_ARG="${!i}"
|
||||
VALUE_ARG="${!j}"
|
||||
if [[ "$TYPE_ARG" = "--verbose" || "$TYPE_ARG" = "-v" ]]
|
||||
then
|
||||
SNIPS_DEBUG=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${SNIPS_DEBUG}" == true ]
|
||||
then
|
||||
echo "Execution env:"
|
||||
env
|
||||
LOGLEVEL="-v"
|
||||
SNIPS_COMPONENTS["snips-debug"]=true
|
||||
else
|
||||
LOGLEVEL=""
|
||||
SNIPS_COMPONENTS["snips-debug"]=false
|
||||
fi
|
||||
|
||||
USE_INCLUDE=false
|
||||
USE_EXCLUDE=false
|
||||
|
||||
for i in $(seq 1 $#)
|
||||
do
|
||||
j=$((i+1))
|
||||
TYPE_ARG="${!i}"
|
||||
VALUE_ARG="${!j}"
|
||||
if [ "$TYPE_ARG" = "--exclude-components" ]
|
||||
then
|
||||
USE_EXCLUDE=true
|
||||
if [ "$USE_INCLUDE" = true ]
|
||||
then
|
||||
echo "Cannot use --include-components and --exclude-components simultaneously"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for j in $(echo $VALUE_ARG|tr ',' ' ')
|
||||
do
|
||||
if [ -z ${SNIPS_COMPONENTS[$i]} ]
|
||||
then
|
||||
echo "Unknown snips component $j. Must be one of ${ALL_SNIPS_COMPONENTS[*]}."
|
||||
exit 1
|
||||
fi
|
||||
unset SNIPS_COMPONENTS["$i"]
|
||||
done
|
||||
elif [ "$TYPE_ARG" = "--include-components" ]
|
||||
then
|
||||
USE_INCLUDE=true
|
||||
if [ "$USE_EXCLUDE" = true ]
|
||||
then
|
||||
echo "Cannot use --include-components and --exclude-components simultaneously"
|
||||
exit 1
|
||||
elif [ -z "$VALUE_ARG" ]
|
||||
then
|
||||
echo "--include-components must be followed by a command-line list of components to include ${ALL_SNIPS_COMPONENTS[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for c in "${ALL_SNIPS_COMPONENTS[@]}"
|
||||
do
|
||||
SNIPS_COMPONENTS[$c]=false
|
||||
done
|
||||
for j in $(echo $VALUE_ARG|tr ',' ' ')
|
||||
do
|
||||
if [[ -z "${SNIPS_COMPONENTS[$i]}" && $j != "none" ]]
|
||||
then
|
||||
echo "Unknown snips component $j. Must be one of ${ALL_SNIPS_COMPONENTS[*]}."
|
||||
exit 1
|
||||
fi
|
||||
SNIPS_COMPONENTS["$i"]=true
|
||||
done
|
||||
elif [ "$TYPE_ARG" = "--mqtt" ]
|
||||
then
|
||||
if [ -z "$VALUE_ARG" ]
|
||||
then
|
||||
echo "'<mqtt_server>:<mqtt_port>' must be specified when using --mqtt"
|
||||
exit 1
|
||||
elif [ "$(echo "$VALUE_ARG" | tr -cd ':' | wc -c)" != 1 ]
|
||||
then
|
||||
echo "--mqtt value must follow the pattern '<mqtt_server>:<mqtt_port>' with server and port separated by a single ':'"
|
||||
exit 1
|
||||
elif [ "$(echo "$VALUE_ARG" | tr -cd '#' | wc -c)" != 0 ]
|
||||
then
|
||||
echo "--mqtt value must follow the pattern '<mqtt_server>:<mqtt_port>'. '#' character is not allowed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SNIPS_MQTT_HOST=$(echo "$VALUE_ARG"| cut -d : -f 1)
|
||||
if [ -z "$SNIPS_MQTT_HOST" ]
|
||||
then
|
||||
echo "Must specify a server when using --mqtt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SNIPS_MQTT_PORT=$(echo "$VALUE_ARG"| cut -d : -f 2)
|
||||
case "$SNIPS_MQTT_PORT" in
|
||||
''|*[!0-9]*)
|
||||
echo "Must specify a numeric value for port when using --mqtt"
|
||||
exit 1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
USE_INTERNAL_MQTT=false
|
||||
SNIPS_MQTT_FLAG="--mqtt '$SNIPS_MQTT_HOST:$SNIPS_MQTT_PORT'"
|
||||
SNIPS_MOSQUITTO_FLAG="-h $SNIPS_MQTT_HOST -p $SNIPS_MQTT_PORT"
|
||||
fi
|
||||
done
|
||||
|
||||
# Generate global configuration
|
||||
cat <<EOT > $SUPERVISORD_CONF_FILE
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
EOT
|
||||
|
||||
|
||||
# Generate snips-asr-google
|
||||
if [ "${SNIPS_COMPONENTS['snips-asr-google']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-asr-google $LOGLEVEL $SNIPS_ASR_GOOGLE_ARGS $SNIPS_MQTT_FLAG $SNIPS_ASR_GOOGLE_MQTT_ARGS"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
|
||||
[program:snips-asr-google]
|
||||
command=/usr/bin/snips-asr-google $LOGLEVEL $SNIPS_ASR_GOOGLE_ARGS $SNIPS_MQTT_FLAG $SNIPS_ASR_GOOGLE_MQTT_ARGS
|
||||
autorestart=true
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-asr-google is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-asr
|
||||
if [ "${SNIPS_COMPONENTS['snips-asr']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-asr $LOGLEVEL $SNIPS_ASR_ARGS $SNIPS_MQTT_FLAG $SNIPS_ASR_MQTT_ARGS"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
|
||||
[program:snips-asr]
|
||||
command=/usr/bin/snips-asr $LOGLEVEL $SNIPS_ASR_ARGS $SNIPS_MQTT_FLAG $SNIPS_ASR_MQTT_ARGS
|
||||
autorestart=true
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-asr is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-audio-server
|
||||
if [ "${SNIPS_COMPONENTS['snips-audio-server']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-audio-server $LOGLEVEL $SNIPS_AUDIO_SERVER_ARGS $SNIPS_MQTT_FLAG $SNIPS_AUDIO_SERVER_MQTT_ARGS"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
|
||||
[program:snips-audio-server]
|
||||
command=/usr/bin/snips-audio-server $LOGLEVEL $SNIPS_AUDIO_SERVER_ARGS $SNIPS_MQTT_FLAG $SNIPS_AUDIO_SERVER_MQTT_ARGS
|
||||
autorestart=true
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-audio-server is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-tts
|
||||
if [ "${SNIPS_COMPONENTS['snips-tts']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-tts $LOGLEVEL $SNIPS_TTS_ARGS $SNIPS_MQTT_FLAG $SNIPS_TTS_MQTT_FLAG"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
[program:snips-tts]
|
||||
command=/usr/bin/snips-tts $LOGLEVEL $SNIPS_TTS_ARGS $SNIPS_MQTT_FLAG $SNIPS_TTS_MQTT_FLAG
|
||||
autorestart=true
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-tts is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-hotword
|
||||
if [ "${SNIPS_COMPONENTS['snips-hotword']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-hotword $SNIPS_HOTWORD_ARGS $LOGLEVEL $SNIPS_MQTT_FLAG $SNIPS_HOTWORD_MQTT_ARGS"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
[program:snips-hotword]
|
||||
command=/usr/bin/snips-hotword $SNIPS_HOTWORD_ARGS $LOGLEVEL $SNIPS_MQTT_FLAG $SNIPS_HOTWORD_MQTT_ARGS
|
||||
autorestart=true
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-hotword is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-nlu
|
||||
if [ "${SNIPS_COMPONENTS['snips-nlu']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-nlu $LOGLEVEL $SNIPS_MQTT_FLAG $SNIPS_QUERIES_MQTT_ARGS"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
[program:snips-nlu]
|
||||
command=/usr/bin/snips-nlu $LOGLEVEL $SNIPS_MQTT_FLAG $SNIPS_QUERIES_MQTT_ARGS
|
||||
autorestart=true
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-nlu is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-dialogue
|
||||
if [ "${SNIPS_COMPONENTS['snips-dialogue']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-dialogue $LOGLEVEL $SNIPS_DIALOGUE_ARGS $SNIPS_MQTT_FLAG $SNIPS_DIALOGUE_MQTT_ARGS"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
[program:snips-dialogue]
|
||||
command=/usr/bin/snips-dialogue $LOGLEVEL $SNIPS_DIALOGUE_ARGS $SNIPS_MQTT_FLAG $SNIPS_DIALOGUE_MQTT_ARGS
|
||||
autorestart=true
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-dialogue is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-analytics
|
||||
if [ "${SNIPS_COMPONENTS['snips-analytics']}" = true ]
|
||||
then
|
||||
echo "Spawning /usr/bin/snips-analytics $LOGLEVEL $SNIPS_MQTT_FLAG $SNIPS_ANALYTICS_MQTT_ARGS"
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
[program:snips-analytics]
|
||||
command=/usr/bin/snips-analytics $LOGLEVEL $SNIPS_MQTT_FLAG $SNIPS_ANALYTICS_MQTT_ARGS
|
||||
autorestart=unexpected
|
||||
directory=/root
|
||||
environment=RUMQTT_READ_TIMEOUT_MS="50"
|
||||
exitcodes=0
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-analytics is disabled"
|
||||
fi
|
||||
|
||||
|
||||
# Generate snips-debug
|
||||
if [ "${SNIPS_COMPONENTS['snips-debug']}" = true ]
|
||||
then
|
||||
echo Spawning snips-debug
|
||||
cat <<EOT >> $SUPERVISORD_CONF_FILE
|
||||
[program:snips-debug]
|
||||
command=mosquitto_sub -v $SNIPS_MOSQUITTO_FLAG -t "hermes/#" -T "hermes/audioServer/+/audioFrame"
|
||||
autorestart=true
|
||||
directory=/root
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
EOT
|
||||
else
|
||||
echo "snips-debug is disabled"
|
||||
fi
|
||||
|
||||
|
||||
if [ "${USE_INTERNAL_MQTT}" = true ]
|
||||
then
|
||||
service mosquitto start
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
export RUMQTT_READ_TIMEOUT_MS=50
|
||||
/usr/bin/supervisord -c $SUPERVISORD_CONF_FILE
|
||||
Reference in New Issue
Block a user