Fix g-assistant (#293)

* Update config.json

* Update CHANGELOG.md

* Update config.json

* Update run.sh

* Update hassio_gassistant.py
This commit is contained in:
Pascal Vizeli
2018-05-09 20:28:13 +02:00
committed by GitHub
parent d2d1d8aa01
commit 01ee4990ec
4 changed files with 11 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
# Changelog
## 1.2
- Add model id
## 1.1
- Bugfix OAuth webinterface

View File

@@ -1,6 +1,6 @@
{
"name": "Google Assistant",
"version": "1.1",
"version": "1.2",
"slug": "google_assistant",
"description": "A virtual personal assistant developed by Google",
"url": "https://home-assistant.io/addons/google_assistant/",
@@ -14,10 +14,12 @@
},
"webui": "http://[HOST]:[PORT:9324]",
"options": {
"client_secrets": "google_assistant.json"
"client_secrets": "google_assistant.json",
"model_id": null
},
"schema": {
"client_secrets": "str"
"client_secrets": "str",
"model_id": "str"
},
"image": "homeassistant/{arch}-addon-google_assistant"
}

View File

@@ -27,6 +27,6 @@ if __name__ == '__main__':
credentials = google.oauth2.credentials.Credentials(token=None, **json.load(data))
# run assistant
with Assistant(credentials) as assistant:
with Assistant(credentials, sys.argv[2]) as assistant:
for event in assistant.start():
process_event(event)

View File

@@ -6,6 +6,7 @@ CLIENT_JSON=/data/client.json
CRED_JSON=/data/cred.json
CLIENT_SECRETS=$(jq --raw-output '.client_secrets' $CONFIG_PATH)
MODEL_ID=$(jq --raw-output '.model_id' $CONFIG_PATH)
# check if a new assistant file exists
if [ -f "/share/$CLIENT_SECRETS" ]; then
@@ -21,4 +22,4 @@ elif [ ! -f "$CRED_JSON" ]; then
exit 1
fi
exec python3 /hassio_gassistant.py "$CRED_JSON" < /dev/null
exec python3 /hassio_gassistant.py "$CRED_JSON" "$MODEL_ID" < /dev/null