Files
addons/google_assistant/rootfs/etc/services.d/google-assistant/run
Eric Matte 9d83c89415 Upgrade web server for OAuth connection process [add-on: google_assistant] (#1267)
* Update pages styling and better error handling

* Fix css

* Offload static folder to /usr/share/public

* Remove unnecessary os import

* Add a changelog and update the version

* Update google_assistant/config.json

* Update google_assistant/CHANGELOG.md

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
2020-05-06 14:13:21 +02:00

28 lines
1.1 KiB
Plaintext

#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start Google Assistant service
# ==============================================================================
CLIENT_JSON=/data/client.json
CRED_JSON=/data/cred.json
CLIENT_SECRETS=$(bashio::config 'client_secrets')
MODEL_ID=$(bashio::config 'model_id')
PROJECT_ID=$(bashio::config 'project_id')
# check if a new assistant file exists
if bashio::fs.file_exists "/share/${CLIENT_SECRETS}"; then
bashio::log.info "Installing/Updating service client_secrets file"
cp -f "/share/${CLIENT_SECRETS}" "${CLIENT_JSON}"
fi
if ! bashio::fs.file_exists "${CRED_JSON}" && bashio::fs.file_exists "${CLIENT_JSON}"; then
bashio::log.info "Starting WebUI for handling OAuth2..."
python3 /usr/bin/hassio_oauth.py "${CLIENT_JSON}" "${CRED_JSON}"
elif ! bashio::fs.file_exists "${CRED_JSON}"; then
bashio::exit.nok "You need initialize Google Assistant with a client secret JSON!"
fi
bashio::log.info "Starting Home Assistant GAssisant SDK..."
exec python3 /usr/bin/hassio_gassistant.py \
"${CRED_JSON}" "${PROJECT_ID}" "${MODEL_ID}"