Update Google Assistant SDK 0.5.0 (#298)

* Update Dockerfile

* Update config.json

* Update CHANGELOG.md

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update run.sh

* Update hassio_gassistant.py

* Update config.json

* Update hassio_gassistant.py

* Update hassio_gassistant.py

* Update build.json

* Update CHANGELOG.md
This commit is contained in:
Pascal Vizeli
2018-05-10 18:07:10 +02:00
committed by GitHub
parent 4521cae429
commit 168eaca4d6
6 changed files with 25 additions and 9 deletions

View File

@@ -1,5 +1,10 @@
# Changelog
## 2.0
- Update Google Assistant SDK 0.5.0
- Update Google Assistant Library 1.0.0
- Revert base images
## 1.5
- Change event handling

View File

@@ -3,9 +3,14 @@ FROM $BUILD_FROM
# Install packages
RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y --no-install-recommends \
jq tzdata python3 python3-dev python3-pip libportaudio2 alsa-utils \
&& pip3 install google-assistant-library google-auth requests_oauthlib cherrypy \
&& pip3 install --no-cache-dir --upgrade setuptools \
&& pip3 install --no-cache-dir \
google-assistant-library==1.0.0 \
google-assistant-sdk==0.5.0 \
google-assistant-grpc==0.2.0 \
google-auth requests_oauthlib cherrypy \
&& apt-get remove -y --purge python3-pip python3-dev \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -1,6 +1,6 @@
{
"build_from": {
"armhf": "multiarch/ubuntu-core:armhf-xenial",
"amd64": "multiarch/ubuntu-core:amd64-xenial"
"armhf": "multiarch/debian-debootstrap:armhf-stretch",
"amd64": "multiarch/debian-debootstrap:amd64-stretch"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "Google Assistant",
"version": "1.5",
"name": "Google Assistant SDK",
"version": "2.0",
"slug": "google_assistant",
"description": "A virtual personal assistant developed by Google",
"url": "https://home-assistant.io/addons/google_assistant/",

View File

@@ -27,21 +27,24 @@ if __name__ == '__main__':
device_json = Path(DEVICE_CONFIG)
# open credentials
print("OAth with Google")
with cred_json.open('r') as data:
credentials = google.oauth2.credentials.Credentials(token=None, **json.load(data))
# Read device info
print("Initialize device infos")
if device_json.exists():
with device_json.open('r') as data:
device_info = json.load(data)
device_model_id = device_config['model_id']
last_device_id = device_config.get('last_device_id', None)
device_model_id = device_info['model_id']
last_device_id = device_info.get('last_device_id', None)
else:
device_model_id = sys.argv[3]
last_device_id = None
# run assistant
print("Run Google Assistant SDK")
with Assistant(credentials, device_model_id) as assistant:
events = assistant.start()
device_id = assistant.device_id
@@ -58,5 +61,7 @@ if __name__ == '__main__':
'model_id': device_model_id,
}, dev_file)
for event in event:
for event in events:
process_event(event)
print("Close Google Assistant SDK")

View File

@@ -23,4 +23,5 @@ elif [ ! -f "$CRED_JSON" ]; then
exit 1
fi
echo "[Info] Run Hass.io GAssisant SDK"
exec python3 /hassio_gassistant.py "$CRED_JSON" "$PROJECT_ID" "$MODEL_ID" < /dev/null