Snips 0.55.2 (#285)

* added customtts and default assistants

* Added ES assistant and customtts updates

* Added ES assistant and customtts updates

* Added customtts and new assistants

* Added customtts and new assistants

* Update config.json

* Added customtts and new assistants

* Added some quotes

* Added some quotes

* Added some quotes

* Remove binaries and install from pkg

* Remove binaries and install from pkg

* Update Dockerfile

* Update config.json

* test

* updated version

* Update config.json

* Update config.json

* Update Dockerfile

* Update config.json

* Update customtts.sh

* Update CHANGELOG.md

* Update run.sh

* Update run.sh

* Update config.json

* Update build.json

* Update CHANGELOG.md

* Update build.json
This commit is contained in:
Tod Schmidt
2018-05-07 06:38:24 -04:00
committed by Pascal Vizeli
parent 473a37b8be
commit 3762e3066b
10 changed files with 90 additions and 12 deletions

View File

@@ -1,5 +1,10 @@
# Changelog
## 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

View File

@@ -4,8 +4,13 @@ FROM $BUILD_FROM
# Copy data
COPY run.sh /
COPY mosquitto.conf /etc/
COPY assistant.zip /assistant-default.zip
COPY customtts.sh /usr/bin
COPY assistant_* /
RUN chmod a+x /run.sh
RUN chmod a+x /run.sh \
&& chmod a+x /usr/bin/customtts.sh \
&& apt-get update \
&& apt-get install -y mpg123 \
&& apt-get clean all
ENTRYPOINT [ "/run.sh" ]

Binary file not shown.

BIN
snips/assistant_Hass_de.zip Executable file

Binary file not shown.

BIN
snips/assistant_Hass_en.zip Executable file

Binary file not shown.

BIN
snips/assistant_Hass_fr.zip Executable file

Binary file not shown.

View File

@@ -1,6 +1,6 @@
{
"build_from": {
"armhf": "snipsdocker/platform:arm-0.53.17",
"amd64": "snipsdocker/platform:x86-0.53.17"
"armhf": "snipsdocker/platform:arm-0.55.2",
"amd64": "snipsdocker/platform:x86-0.55.2"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "Snips.AI",
"version": "2.0",
"version": "3.0",
"slug": "snips",
"description": "Local voice control platform",
"url": "https://home-assistant.io/addons/snips/",
@@ -11,7 +11,9 @@
"1883/tcp": 9898
},
"map": ["share"],
"tmpfs": "size=10m",
"audio": true,
"homeassistant_api": true,
"options": {
"mqtt_bridge": {
"active": true,
@@ -20,7 +22,12 @@
"user": "",
"password": ""
},
"assistant": "assistant.zip"
"assistant": "assistant.zip",
"language": "en",
"custom_tts": {
"active": false,
"platform": "amazon_polly"
}
},
"schema": {
"mqtt_bridge": {
@@ -30,7 +37,12 @@
"user": "str",
"password": "str"
},
"assistant": "str"
"assistant": "str",
"language": "match((?:en|de|fr))",
"custom_tts": {
"active": "bool",
"platform": "string"
}
},
"image": "homeassistant/{arch}-addon-snips"
}

30
snips/customtts.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
#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 -H \"x-ha-access: "$API_KEY"\" -H \"Type: application/json\" http://hassio/homeassistant/api/tts_get_url -d "$MESSAGE")
if [ "$RESPONSE" = "" ]; then
exit 1
fi
echo "$RESPONSE"
URL=$(echo "$RESPONSE" | jq --raw-output '.url')
if [ "$URL" = "" ]; then
exit 1
fi
rm /tmpfs/temp.mp3
curl -s -H "x-ha-access: $API_KEY" "$URL" -o /tmpfs/temp.mp3
if [ -f /tmpfs/temp.mp3 ]; then
/usr/bin/mpg123 -w "$FILE" /tmpfs/temp.mp3
fi
rm /tmpfs/temp.mp3

View File

@@ -5,13 +5,30 @@ CONFIG_PATH=/data/options.json
MQTT_BRIDGE=$(jq --raw-output '.mqtt_bridge.active' $CONFIG_PATH)
ASSISTANT=$(jq --raw-output '.assistant' $CONFIG_PATH)
LANG=$(jq --raw-output '.language // "en"' $CONFIG_PATH)
CUSTOMTTS=$(jq --raw-output '.custom_tts.active' $CONFIG_PATH)
PLATFORM=$(jq --raw-output '.custom_tts.platform' $CONFIG_PATH)
echo "[INFO] LANG: $LANG"
echo "[INFO] Checking for /share/snips.toml"
if [ -f "/share/snips.toml" ]; then
echo "[INFO] Installing /share/snips.toml"
echo "[INFO] - Installing /share/snips.toml"
cp -v /share/snips.toml /etc/
fi
if [ "$CUSTOMTTS" == "true" ]; then
if [ -z "$PLATFORM" ]; then
echo "[ERROR] - platform must be set to use custom tts!"
else
echo "[INFO] - Using custom tts"
echo "provider = \"customtts\"" >> /etc/snips.toml
echo "customtts = { command = [\"/usr/bin/customtts.sh\", \"$PLATFORM\", \"%%OUTPUT_FILE%%\", \"$LANG\", \"%%TEXT%%\"] }" >> /etc/snips.toml
fi
else
echo "[INFO] - Using default tts (picotts)"
fi
# mqtt bridge
if [ "$MQTT_BRIDGE" == "true" ]; then
HOST=$(jq --raw-output '.mqtt_bridge.host' $CONFIG_PATH)
@@ -40,6 +57,8 @@ if [ "$MQTT_BRIDGE" == "true" ]; then
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 # IN hermes/"
} >> /etc/mosquitto.conf
fi
@@ -52,11 +71,18 @@ 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
elif [ -f "/assistant-default.zip" ]; then
echo "[INFO] Using default snips assistant"
unzip -o -u "/assistant-default.zip" -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"