diff --git a/snips/CHANGELOG.md b/snips/CHANGELOG.md index 7ee8bf3..90f7c85 100644 --- a/snips/CHANGELOG.md +++ b/snips/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## 0.7.0 ## +- Updated to latest snips version 0.51.14 +- Added default assistant for hassio builtin intents + ## 0.6.5-p1 - Bugfix wrong path to assistant files diff --git a/snips/Dockerfile b/snips/Dockerfile index e0dc9ea..3c73f26 100644 --- a/snips/Dockerfile +++ b/snips/Dockerfile @@ -5,6 +5,7 @@ FROM $BUILD_FROM COPY run.sh / COPY mosquitto.conf /etc/ COPY asoundrc /root/.asoundrc +COPY assistant.zip /assistant-default.zip RUN chmod a+x /run.sh diff --git a/snips/assistant.zip b/snips/assistant.zip new file mode 100644 index 0000000..9c0476b Binary files /dev/null and b/snips/assistant.zip differ diff --git a/snips/build.json b/snips/build.json index 49132fd..d4bab99 100644 --- a/snips/build.json +++ b/snips/build.json @@ -1,6 +1,6 @@ { "build_from": { - "armhf": "snipsdocker/platform:arm-0.6.5", - "amd64": "snipsdocker/platform:x86-0.6.5" + "armhf": "snipsdocker/platform:arm-0.51.14", + "amd64": "snipsdocker/platform:x86-0.51.14" } } diff --git a/snips/config.json b/snips/config.json index 21313e1..8b4098d 100644 --- a/snips/config.json +++ b/snips/config.json @@ -1,6 +1,6 @@ { "name": "Snips.AI", - "version": "0.6.5-p1", + "version": "0.7", "slug": "snips", "description": "Local voice control platform", "url": "https://home-assistant.io/addons/snips/", @@ -11,17 +11,17 @@ "1883/tcp": 9898 }, "map": ["share"], - "devices": ["/dev/snd:/dev/snd:rwm"], + "audio": true, "options": { "mqtt_bridge": { - "active": false, - "host": "172.17.0.1", + "active": true, + "host": "core-mosquitto", "port": 1883, "user": "", "password": "" }, - "mic": "0,0", - "speaker": "1,0", + "mic": "1,0", + "speaker": "0,0", "assistant": "assistant.zip" }, "schema": { diff --git a/snips/run.sh b/snips/run.sh index 547f86f..d5e8d7c 100644 --- a/snips/run.sh +++ b/snips/run.sh @@ -2,19 +2,36 @@ set -e CONFIG_PATH=/data/options.json -SNIPS_CONFIG=/data/config MQTT_BRIDGE=$(jq --raw-output '.mqtt_bridge.active' $CONFIG_PATH) ASSISTANT=$(jq --raw-output '.assistant' $CONFIG_PATH) SPEAKER=$(jq --raw-output '.speaker' $CONFIG_PATH) MIC=$(jq --raw-output '.mic' $CONFIG_PATH) -echo "[Info] Show audio device" +echo "[INFO] Show audio output device" aplay -l -echo "[Info] Setup audio device" -sed -i "s/%%SPEAKER%%/$SPEAKER/g" /root/.asoundrc -sed -i "s/%%MIC%%/$MIC/g" /root/.asoundrc +echo "[INFO] Show audio input device" +arecord -l + +echo "[INFO] Setup audio device" +if [ -f "/share/asoundrc" ]; then + echo "[INFO] Installing /share/asoundrc" + cp -v /share/asoundrc /root/.asoundrc +else + echo "[INFO] Using default asound.conf" + sed -i "s/%%SPEAKER%%/$SPEAKER/g" /root/.asoundrc + sed -i "s/%%MIC%%/$MIC/g" /root/.asoundrc +fi + +echo "[DEBUG] Using /root/.asoundrc" +cat /root/.asoundrc + +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 # mqtt bridge if [ "$MQTT_BRIDGE" == "true" ]; then @@ -23,7 +40,7 @@ if [ "$MQTT_BRIDGE" == "true" ]; then USER=$(jq --raw-output '.mqtt_bridge.user' $CONFIG_PATH) PASSWORD=$(jq --raw-output '.mqtt_bridge.password' $CONFIG_PATH) - echo "[Info] Setup internal mqtt bridge" + echo "[INFO] Setup internal mqtt bridge" { echo "connection main-mqtt" @@ -36,24 +53,34 @@ if [ "$MQTT_BRIDGE" == "true" ]; then echo "password $PASSWORD" } >> /etc/mosquitto.conf fi - + { - echo "topic # OUT" - echo "topic # IN hermes/ hermes/" + echo "topic hermes/intent/# out" + echo "topic hermes/hotword/toggleOn out" + echo "topic hermes/hotword/toggleOff out" + echo "topic hermes/asr/stopListening out" + echo "topic hermes/asr/startListening out" + echo "topic hermes/nlu/intentNotParsed out" + echo "topic # IN hermes/" } >> /etc/mosquitto.conf fi -echo "[Info] Start internal mqtt broaker" +echo "[INFO] Start internal mqtt broker" mosquitto -c /etc/mosquitto.conf & -# init snips config -mkdir -p "$SNIPS_CONFIG" +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" - unzip -o -u "/share/$ASSISTANT" -d "$SNIPS_CONFIG" + echo "[INFO] Install/Update snips assistant" + unzip -o -u "/share/$ASSISTANT" -d /usr/share/snips +# otherwise use the default +elif [ -f "/assistant-default.zip" ]; then + echo "[INFO] Using default snips assistant" + unzip -o -u "/assistant-default.zip" -d /usr/share/snips fi -ln -s "$SNIPS_CONFIG/assistant/" /usr/share/snips/assistant + +echo "[INFO] Starting snips-watch" +( sleep 2; /usr/bin/snips-watch -vvv --no_color ) & /opt/snips/snips-entrypoint.sh --mqtt localhost:1883