google-assistant-helper v0.0.3
Impetus
Hi all, I’m a long-time lurker who’s benefited immeasurably from the community, and thought I’d give back now that I have something to share.
My HA is heterogenous, but I’ve been wanting to send announcements via Google Home devices from ST, etc. I haven’t found anything that does what I need well, so I rolled my own.
This project is a Node.js server that provides a helper proxy/middleman for passing commands to the Google Assistant via the published API. It provides the following functionality:
- Broadcast of text messages to Google Assistant devices using the default broadcast voice
- Broadcast of audio files to Google Assistant devices (some restrictions apply)
- Execution of custom commands and broadcast of responses
- Playback of audio resources via Chromecast
- Playback of text via Chromecast using the Google Cloud Text-to-Speech API
- NEW in v0.0.2 - (Limited) control of Chromecast playback - stop, pause, seek, play
- NEW in v0.0.3 - Broadcast of audio responses returned by the Google Assistant to certain custom commands (e…g “Tell me a joke”)
- [Optional] TLS Support
The server presents a webhook that takes JSON posts and executes commands. It is configurable, and supports TLS (strongly recommended for any Internet-facing use).
Requirements
This is a Node.js server, and this documentation will assume that Node.js is installed, and that the user has some familiarity with Node.js and npm
. Naturally, a server of some type is required, whether an RPi, a regular box, or a NAS that runs Linux or can run Docker.
This project should run on most modern Debian variants (including Raspbian). It may run on other operating systems; YMMV. It is verified to work in a Docker image, provided the necessary packages are installed.
Chromecast functionality requires mDNS; on Debian this requires dbus
and avahi-daemon
to be running. You may need to install the libavahi-compat-libdnssd-dev
package.
How To
Go to the repository on Github and read the documentation, which hopefully is reasonably complete. Clone the repository or download an archive of v0.0.1 to get started.
Notes
Zoned broadcasts are supported (in addition to Chromecast groups). See Step 7. in “Setup Instructions” in the README.md
(documentation) on Github for details.
Code quality is important to me, so if any issues arise, please open an issue on Github.
Happy tinkering!