Migrate google assistant to new audio (#1160)

* Migrate google assistant to new audio

* Fix lint

* clean old handling stuff
This commit is contained in:
Pascal Vizeli
2020-03-02 11:11:07 +01:00
committed by GitHub
parent 7639eef0e7
commit 9000291523
9 changed files with 58 additions and 50 deletions

View File

@@ -34,9 +34,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libpulse0 \ libpulse0 \
git \ git \
tar \ tar \
xz-utils \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
\ \
&& curl -SL "https://storage.googleapis.com/shellcheck/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar xzf - \ && curl -SL "https://storage.googleapis.com/shellcheck/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar xJf - \
&& cp "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" /usr/bin/ \ && cp "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" /usr/bin/ \
&& rm -rf shellcheck-v${SHELLCHECK_VERSION} && rm -rf shellcheck-v${SHELLCHECK_VERSION}

View File

@@ -1,42 +1,23 @@
# Changelog # Changelog
## 2.2 ## 2.3.0
- Update Google Assistant SDK 0.5.1
- Update Google Assistant Library 1.1.0
- Use homeassistant debian base images
- Support new audio backend
- Migrate to s6-overlay
## 2.2.0
- Use homeassistant ubuntu base images - Use homeassistant ubuntu base images
## 2.1 ## 2.1.0
- Add error handling for decoding UTF-8 - Add error handling for decoding UTF-8
## 2.0 ## 2.0.0
- Update Google Assistant SDK 0.5.0 - Update Google Assistant SDK 0.5.0
- Update Google Assistant Library 1.0.0 - Update Google Assistant Library 1.0.0
- Revert base images - Revert base images
## 1.5
- Change event handling
## 1.4
- Fix typo
## 1.3
- Add project id with new device register system
## 1.2
- Add model id
## 1.1
- Bugfix OAuth webinterface
## 1.0
- Update Google Assistant SDK 0.4.4
- Update Google Assistant Library 0.1.1
- Use new Hass.io Audio System
- Use now a ubuntu based image

View File

@@ -1,28 +1,34 @@
ARG BUILD_FROM ARG BUILD_FROM
FROM $BUILD_FROM FROM $BUILD_FROM
ARG \
GOOGLE_GRPC_VERSION \
GOOGLE_LIBRARY_VERSION \
GOOGLE_SDK_VERSION \
GOOGLE_AUTH_VERSION \
REQUESTS_OAUTHLIB_VERSION \
CHERRYPY_VERSION
# Install packages # Install packages
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
alsa-utils \
libportaudio2 \ libportaudio2 \
libasound2-plugins \
python3 \ python3 \
python3-dev \ python3-dev \
&& curl --silent --show-error --retry 5 \ && curl --silent --show-error --retry 5 \
"https://bootstrap.pypa.io/get-pip.py" \ "https://bootstrap.pypa.io/get-pip.py" \
| python3 \ | python3 \
&& pip3 install --no-cache-dir \ && pip3 install --no-cache-dir \
cherrypy==18.1.1 \ cherrypy=="${CHERRYPY_VERSION}" \
google-assistant-grpc==0.2.0 \ google-assistant-grpc=="${GOOGLE_GRPC_VERSION}" \
google-assistant-library==1.0.0 \ google-assistant-library=="${GOOGLE_LIBRARY_VERSION}" \
google-assistant-sdk==0.5.0 \ google-assistant-sdk=="${GOOGLE_SDK_VERSION}" \
google-auth==1.6.3 \ google-auth=="${GOOGLE_AUTH_VERSION}" \
requests_oauthlib==1.2.0 \ requests_oauthlib=="${REQUESTS_OAUTHLIB_VERSION}" \
&& apt-get remove -y --purge python3-dev \ && apt-get remove -y --purge python3-dev \
&& apt-get clean -y \ && apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy data # Copy data
COPY data/* / COPY rootfs /
ENTRYPOINT [ "/run.sh" ]

View File

@@ -1,6 +1,15 @@
{ {
"build_from": { "build_from": {
"armv7": "homeassistant/armv7-base-ubuntu:18.04", "armhf": "homeassistant/armhf-base-debian:buster",
"amd64": "homeassistant/amd64-base-ubuntu:18.04" "armv7": "homeassistant/armv7-base-debian:buster",
"amd64": "homeassistant/amd64-base-debian:buster"
},
"args": {
"GOOGLE_GRPC_VERSION": "0.2.1",
"GOOGLE_LIBRARY_VERSION": "1.0.1",
"GOOGLE_SDK_VERSION": "0.5.1",
"GOOGLE_AUTH_VERSION": "1.11.2",
"REQUESTS_OAUTHLIB_VERSION": "1.3.0",
"CHERRYPY_VERSION": "18.5.0"
} }
} }

View File

@@ -1,12 +1,13 @@
{ {
"name": "Google Assistant SDK", "name": "Google Assistant SDK",
"version": "2.2", "version": "2.3.0",
"slug": "google_assistant", "slug": "google_assistant",
"description": "A virtual personal assistant developed by Google", "description": "A virtual personal assistant developed by Google",
"url": "https://github.com/home-assistant/hassio-addons/tree/master/google_assistant", "url": "https://github.com/home-assistant/hassio-addons/tree/master/google_assistant",
"startup": "application", "startup": "application",
"boot": "auto", "boot": "auto",
"arch": ["armv7", "amd64"], "arch": ["armhf", "armv7", "amd64"],
"init": false,
"advanced": true, "advanced": true,
"stage": "experimental", "stage": "experimental",
"map": ["share"], "map": ["share"],

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Take down the S6 supervision tree when Google Assistant fails
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bashio #!/usr/bin/with-contenv bashio
# ==============================================================================
# Start Google Assistant service
# ==============================================================================
CLIENT_JSON=/data/client.json CLIENT_JSON=/data/client.json
CRED_JSON=/data/cred.json CRED_JSON=/data/cred.json
@@ -16,11 +18,11 @@ fi
if ! bashio::fs.file_exists "${CRED_JSON}" && bashio::fs.file_exists "${CLIENT_JSON}"; if ! bashio::fs.file_exists "${CRED_JSON}" && bashio::fs.file_exists "${CLIENT_JSON}";
then then
bashio::log.info "Starting WebUI for handling OAuth2..." bashio::log.info "Starting WebUI for handling OAuth2..."
python3 /hassio_oauth.py "${CLIENT_JSON}" "${CRED_JSON}" python3 /usr/bin/hassio_oauth.py "${CLIENT_JSON}" "${CRED_JSON}"
elif ! bashio::fs.file_exists "${CRED_JSON}"; then elif ! bashio::fs.file_exists "${CRED_JSON}"; then
bashio::exit.nok "You need initialize Google Assistant with a client secret JSON!" bashio::exit.nok "You need initialize Google Assistant with a client secret JSON!"
fi fi
basio::log.info "Starting Home Assistant GAssisant SDK..." basio::log.info "Starting Home Assistant GAssisant SDK..."
exec python3 /hassio_gassistant.py \ exec python3 /usr/bin/hassio_gassistant.py \
"${CRED_JSON}" "${PROJECT_ID}" "${MODEL_ID}" < /dev/null "${CRED_JSON}" "${PROJECT_ID}" "${MODEL_ID}"