[RELEASE] Home Assistant Alexa TTS Proxy (another Alexa TTS option)

Code link here for easy visibility; description and setup below:

As I'm sure anyone who is searching is aware, there are at least a couple options for getting Alexa devices (Amazon Echo, etc.) to do text-to-speech (TTS) on Hubitat for things like announcements: Amazon Alexa Text to Speech and the famous Echo Speaks are two I've used, and you may wish to check those out before this one.

Here is a third option, which will primarily be of interest to those who already have Home Assistant (HASS) set up. It works through a service that the unofficial Alexa Media Player integration for Home Assistant exposes. On the Hubitat side, this just requires adding the driver and configuring the device to point to you HASS instance. The driver is single-purpose: proxying text from Hubitat to HASS for the purpose of TTS. It is one-way (Hubitat to HASS), TTS only (no media player functions), and very simple (under 100 lines of code).

On the Home Assistant side, you will need Alexa Media Player set up (HACS is the easiest way, but it can also be done manually). One advantage of this method is that you do not need to set up a separate server to do things like refresh the authentication/cookie; the HASS integration handles that for you. (The downside, of course, is that you need a Home Assistant setup do do this in the first place.)

Setup is basically:

  1. Ensure you have Home Assistant and the unofficial Alexa Media Player integration (formerly "component") configured
  2. Install the HASS Alexa TTS proxy driver code on Hubitat, Raw URL for copy/paste import (see above for pretty/formatted link): https://raw.githubusercontent.com/RMoRobert/Hubitat/master/drivers/HASS-AlexaTTS-Proxy.groovy
  3. Add a new (virtual) device using the newly installed driver, "HASS Alexa TTS Proxy."
  4. Configure the device:
    • Home Assistant URI: point to the URL for your HASS API, which by default runs on the same port as the front end. Include the protocol (and port if non-default), possibly something like
    • Home Assistant long-lived access token: generate from your HASS profile (username/icon in lower left)
    • Home Assistant domain/service: you will need to retrieve this from Developer Tools > Services in the HASS interface; search for notify.alexa_media_, and you should recognize device names and groups you have set up, like notify.alexa_media_johns_echo or notify.alexa_media_upstairs.

Then, use the device like you'd use any speech synthesis/TTS device in any Hubitat app (maybe test it from the device page first to see how it works :smiley: -- if it doesn't make sure you did step 4, especially the last part, correctly).

Not sure if there will be much interest in this approach, but figured I'd share anyway!


Download the Hubitat app