mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-22 23:44:20 +01:00
google_assistant: Collection of improvement and changes (#905)
* google_assistant: Move data files into a data folder * google_assistant: Prettier YAML files * google_assistant: Fix Markdownlint issues in the changelog * google_assistant: Update add-on link * google_assistant: Sort packages in Dockerfile * google_assistant: Convert add-on to Bashio * google_assistant: Fix add-on build by getting most recent pip directly * google_assistant: Add initial documentation, based on the outdated docs
This commit is contained in:
committed by
Pascal Vizeli
parent
6847f767cd
commit
e836914c69
@@ -1,32 +1,41 @@
|
||||
# Changelog
|
||||
|
||||
## 2.2
|
||||
|
||||
- Use homeassistant ubuntu base images
|
||||
|
||||
## 2.1
|
||||
|
||||
- Add error handling for decoding UTF-8
|
||||
|
||||
## 2.0
|
||||
|
||||
- Update Google Assistant SDK 0.5.0
|
||||
- Update Google Assistant Library 1.0.0
|
||||
- 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
|
||||
|
||||
@@ -4,27 +4,25 @@ FROM $BUILD_FROM
|
||||
# Install packages
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
alsa-utils \
|
||||
libportaudio2 \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
libportaudio2 \
|
||||
alsa-utils \
|
||||
&& pip3 install --no-cache-dir --upgrade \
|
||||
setuptools==41.0.1 \
|
||||
pip==19.1 \
|
||||
&& curl --silent --show-error --retry 5 \
|
||||
"https://bootstrap.pypa.io/get-pip.py" \
|
||||
| python3 \
|
||||
&& pip3 install --no-cache-dir \
|
||||
cherrypy==18.1.1 \
|
||||
google-assistant-grpc==0.2.0 \
|
||||
google-assistant-library==1.0.0 \
|
||||
google-assistant-sdk==0.5.0 \
|
||||
google-assistant-grpc==0.2.0 \
|
||||
google-auth==1.6.3 \
|
||||
requests_oauthlib==1.2.0 \
|
||||
cherrypy==18.1.1 \
|
||||
&& apt-get remove -y --purge python3-pip python3-dev \
|
||||
&& apt-get remove -y --purge python3-dev \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy data
|
||||
COPY run.sh /
|
||||
COPY *.py /
|
||||
COPY data/* /
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
|
||||
95
google_assistant/README.md
Normal file
95
google_assistant/README.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# Hass.io Core Add-on: Google Assistant SDK
|
||||
|
||||
Load and update configuration files for Home Assistant from a Git repository.
|
||||
|
||||
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
|
||||
|
||||
## About
|
||||
|
||||
[Google Assistant][google-assistant] is an AI-powered voice assistant that runs on the Raspberry Pi and x86 platforms and interact via the [DialogFlow][dialogflow-integration] integration with Home-Assistant. You can also use [Google Actions][google-actions] to extend its functionality.
|
||||
|
||||
## ⚠️ These instructions are outdated
|
||||
|
||||
These instructions are outdated - the add-on has been updated and these are no longer accurate or complete.
|
||||
Any help in improving the add-on or this document is highly appreciated.
|
||||
|
||||
## ℹ️ Integration your mobile or Google/Nest Home with Home Assistant
|
||||
|
||||
If you want to integrate your Google Home or mobile phone running Google Assistant, with Home Assistant, then you want the [Google Assistant integration][google-assistant-integration].
|
||||
|
||||
## Installation
|
||||
|
||||
Follow these steps to get the add-on installed on your system:
|
||||
|
||||
1. Navigate in your Home Assistant frontend to **Hass.io** -> **Add-on Store**.
|
||||
2. Find the "Google Assistant SDK" add-on and click it.
|
||||
3. Click on the "INSTALL" button.
|
||||
|
||||
## How to use
|
||||
|
||||
Fist, select the input and output audio devices to use for the Assistant in the "Audio" section of the add-on configuration.
|
||||
|
||||
To enable access to the Google Assistant API, do the following:
|
||||
|
||||
1. In the [Cloud Platform Console][google-platform-project], go to the Projects page. Select an existing project or create a new project
|
||||
1. Open the project. In the top of the page search for Google Assistant API or use [this link][google-assistant-api] and enable it.
|
||||
1. Create an [OAuth Client ID][google-oauth-client], pick type "Other", click "Create" and download the JSON file by clicking the Download JSON button on the right side.
|
||||
|
||||
Now install and activate the [Samba][samba-addon] add-on so you can upload your credential file. Connect to the "share" Samba share and copy your credentials over. Name the file `google_assistant.json`.
|
||||
|
||||
The next step is to authenticate your Google account with Google Assistant. Start the add-on and click on the "OPEN WEB UI" button to start authentication.
|
||||
|
||||
## Configuration
|
||||
|
||||
Add-on configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"client_secrets": "google_assistant.json",
|
||||
"project_id": "project_id_from_google",
|
||||
"model_id": "model_id_from_google"
|
||||
}
|
||||
```
|
||||
|
||||
### Option: `clients_secrets` (required)
|
||||
|
||||
The name of the client secrets file to you've downloaded from Google and placed in your `/share` folder.
|
||||
|
||||
### Option: `project_id` (required)
|
||||
|
||||
Project ID of the project you've created at Google for this add-on.
|
||||
|
||||
### Option: `model_id` (required)
|
||||
|
||||
The ID of the model you've registered at Google for this add-on.
|
||||
|
||||
## Support
|
||||
|
||||
Got questions?
|
||||
|
||||
You have several options to get them answered:
|
||||
|
||||
- The [Home Assistant Discord Chat Server][discord].
|
||||
- The Home Assistant [Community Forum][forum].
|
||||
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
|
||||
|
||||
In case you've found a bug, please [open an issue on our GitHub][issue].
|
||||
|
||||
[aarch64-shield]: https://img.shields.io/badge/aarch64-no-red.svg
|
||||
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
|
||||
[armhf-shield]: https://img.shields.io/badge/armhf-no-red.svg
|
||||
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
|
||||
[dialogflow-integration]: https://www.home-assistant.io/integrations/dialogflow/
|
||||
[discord]: https://discord.gg/c5DvZ4e
|
||||
[forum]: https://community.home-assistant.io
|
||||
[google-actions]: https://actions.google.com/
|
||||
[google-assistant-api]: https://console.developers.google.com/apis/api/embeddedassistant.googleapis.com/overview
|
||||
[google-assistant-integration]: https://www.home-assistant.io/integrations/google_assistant/
|
||||
[google-assistant]: https://assistant.google.com/
|
||||
[google-oauth-client]: https://console.developers.google.com/apis/credentials/oauthclient
|
||||
[google-platform-project]: https://console.cloud.google.com/project
|
||||
[i386-shield]: https://img.shields.io/badge/i386-no-red.svg
|
||||
[issue]: https://github.com/home-assistant/hassio-addons/issues
|
||||
[reddit]: https://reddit.com/r/homeassistant
|
||||
[repository]: https://github.com/hassio-addons/repository
|
||||
[samba-addon]: https://github.com/home-assistant/hassio-addons/tree/master/samba
|
||||
@@ -11,12 +11,11 @@ pr: none
|
||||
|
||||
variables:
|
||||
- name: versionBuilder
|
||||
value: '2.0'
|
||||
value: "2.0"
|
||||
- group: docker
|
||||
|
||||
|
||||
jobs:
|
||||
- template: /.azure/azp-template-addon.yml
|
||||
- template: /.azure/azp-template-addon.yml
|
||||
parameters:
|
||||
addon: 'google_assistant'
|
||||
arch: '--armv7 --amd64'
|
||||
addon: "google_assistant"
|
||||
arch: "--armv7 --amd64"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "2.2",
|
||||
"slug": "google_assistant",
|
||||
"description": "A virtual personal assistant developed by Google",
|
||||
"url": "https://home-assistant.io/addons/google_assistant/",
|
||||
"url": "https://github.com/home-assistant/hassio-addons/tree/master/google_assistant",
|
||||
"startup": "application",
|
||||
"boot": "auto",
|
||||
"arch": ["armv7", "amd64"],
|
||||
|
||||
26
google_assistant/data/run.sh
Executable file
26
google_assistant/data/run.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bashio
|
||||
|
||||
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 /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
|
||||
|
||||
basio::log.info "Starting Hass.io GAssisant SDK..."
|
||||
exec python3 /hassio_gassistant.py \
|
||||
"${CRED_JSON}" "${PROJECT_ID}" "${MODEL_ID}" < /dev/null
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CONFIG_PATH=/data/options.json
|
||||
CLIENT_JSON=/data/client.json
|
||||
CRED_JSON=/data/cred.json
|
||||
|
||||
CLIENT_SECRETS=$(jq --raw-output '.client_secrets' $CONFIG_PATH)
|
||||
PROJECT_ID=$(jq --raw-output '.project_id' $CONFIG_PATH)
|
||||
MODEL_ID=$(jq --raw-output '.model_id' $CONFIG_PATH)
|
||||
|
||||
# check if a new assistant file exists
|
||||
if [ -f "/share/$CLIENT_SECRETS" ]; then
|
||||
echo "[Info] Install/Update service client_secrets file"
|
||||
cp -f "/share/$CLIENT_SECRETS" "$CLIENT_JSON"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CRED_JSON" ] && [ -f "$CLIENT_JSON" ]; then
|
||||
echo "[Info] Start WebUI for handling oauth2"
|
||||
python3 /hassio_oauth.py "$CLIENT_JSON" "$CRED_JSON"
|
||||
elif [ ! -f "$CRED_JSON" ]; then
|
||||
echo "[Error] You need initialize GoogleAssistant with a client secret json!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[Info] Run Hass.io GAssisant SDK"
|
||||
exec python3 /hassio_gassistant.py "$CRED_JSON" "$PROJECT_ID" "$MODEL_ID" < /dev/null
|
||||
Reference in New Issue
Block a user