4/14/2019 - Added support for Swedish characters. Thanks @chrbratt!
12/18/2018 Update - Added support for the assistant-relay 'presets' using the new [P] prefix
12/16/2018 Update - Added new Assistant Relay Version 2 Driver for those users who would prefer to use Greg Hesp's new Assistant Relay v2.
NOTE: You must use the Driver that corresponds to your version of the Assistant Relay running on your Raspberry Pi (or similar.)
I recently received my first Google Home device. I was very intrigued by the Google Home Assistant Relay project over on ST.
I followed Greg Hesp's directions to get the assistant-relay nodejs server up and running on a Raspberry Pi 3. I am not going to explain those steps, as he already has them documented on his GitHub repository. Make sure you have assistant-relay working before proceeding with any Hubitat changes.
I looked at his existing Device Type Handler and SmartApp, and decided that I wanted something simpler for my Hubitat port. I know webCoRE is an option, but I wanted to stick with RM and other native apps. So, I wrote a new Hubitat Driver that implements the standard 'Speech Synthesis' and 'Notification' Capabilities, to allow it to be used by most existing Apps that look for these capabilties (like Rule Machine, Hubitat Safety Monitor, etc...)
I have posted the driver on my GitHub repository below. Simply copy (from RAW window) and paste the code into a new Hubitat Driver, then click save. Afterwards, click on Devices, Add New Virtual Device, and enter the name, label, network id, and select the 'Google Home Assistant Relay' driver from the bottom of your drivers list. Afterwards, update the user preferences with your assistant-relay server's LAN IP Address and port (defaults to 3000), click save, and then feel free to type any text you want into either of the two fields, and press the corresponding button to test it.
This driver supports most of the features of the Google Assistant Relay server.
- Normal TTS broadcasts are achieved by simply submitting the raw TEXT you want spoken. NOTE: A recent change by Google now results in every TTS being prefixed with "Broadcast from %username%," and then your text. This cannot be disabled as Google made this change on their back end.
- Hello World.
- Hubitat is amazing!
- Preset commands require the [P] prefix be added to you preset keyword as shown below
- [P]wakeup
- [P]breakfast
- [P]lunch
- [P]dinner
- [P]timetoleave
- [P]arrivedhome
- [P]ontheway
- [P]movietime
- [P]tvtime
- [P]bedtime
- Custom Commands simply need a [CC] prefix added to them (these are not spoken aloud, instead they cause an action as if you had spoken to the Google Assistant/Home device)
- [CC]turn on kitchen light
- [CC]turn off kitchen light
- Custom Commands with Converse need a [CCC] prefix added to them (these commands allow the Google Home device to respond aloud to your command.)
- [CCC]what is the temperature outside
Note - feature #4 above does not always result in the same response as asking the Google Home device directly. Often it is an abbreviated response. This is an issue with Google's back end, not the Hubitat Driver, nor the Assistant-Relay NodeJS server.
Here is the driver. As always, feedback is welcome!
Assistant Relay Version 1 Driver
My personal MS Word instructions are available at Hubitat/Drivers/google-home-assistant-relay.src/RaspberryPi-Assistant-Relay_v1.docx at master · ogiewon/Hubitat · GitHub
Assistant Relay Version 2 Driver
My personal MS Word instructions are available at Hubitat/Drivers/google-home-assistant-relay-v2.src/RaspberryPi-Assistant-Relay_v2.docx at master · ogiewon/Hubitat · GitHub
Credit for 99% of this work goes to Greg Hesp over on ST! My driver is really very simple. It just issues HTTP Post commands.
[UPDATE] @Ryan780 on ST has found the fix to the problem of assistant-relay seeming to work yet no audio coming from the Google Home Device. Looks like IPv6 was the problem. Disabling it on his router resolved the issue. See below.