FYI - I am moving the status of this integration to DEPRECATED, as I have not used nor touched this code for a few years. For those looking for Alexa TTS, please take a look at Echo Speaks.
Direct Text to Speech integration from your Hubitat Hub to Amazon's cloud servers.
v0.1.0 - Initial Release
v0.2.0 - Fixed a bug causing the app to hang when the cookie is invalid. Added support for more 'Alexa Devices' like tablets, thermostats, etc... Thanks @stephack!
v0.3.0 - Added multi-country support and ability to rename app
v0.4.0 - Added Virtual Container support - Thanks @stephack
v0.4.1 - Added Error Notification support (e.g. Pushover) for cookie issues (e.g. expiration)
v0.4.2 - Improved notification for expired cookie
v0.4.3 - Prevent sending empty messages to Amazon
v0.4.4 - Added Notification for Message Rate Exceeded
v0.4.5 - Added support for direct copy and paste of the cookie header into the App - Thanks @stephack
v0.4.6 - Added support for Italy - Thanks @gabriele
v0.5.0 - Added support for automatic cookie refresh with external NodeJS webserver - Thanks @gabriele
v0.5.1 - Change contentType for http call in order to eliminate a nagging exception
v0.5.2 - Attempt to add volume control, but not working so commented out
v0.5.3 - Added app events to have some historic logging
v0.5.4 - Attempt to add support for Australia (Successfully tested)
v0.5.5 - Reduced live log messages
v0.5.6 - Added support for a new "All Echos" child device, which allows for broadcasts to all Echos.
v0.5.7 - Added an override switch that disables all voice messages when off (thanks @rjb.bob!)
v0.5.8 - Added support for Brazil (thank you Marco Felicio / @maffpt)
v0.5.9 - Changed automatic cookie refresh time to 1am to avoid hub maintenance window
v0.6.0 - Add notification if cookie updated successfully, also add setVolume command for each Echo device. Thank you @kahn-hubitat!
v0.6.1 - Add support for Ecobee Thermostat with Alexa builtin. Thank you Greg Veres!
v0.6.2 - Added timeout parameter to all http calls
**v0.6.0/6.1/6.2 Adds support for Ecobee Thermostat with builtin Alexa, adds very simple one-way volume control of the Echo device, and improves reliability by adding a http timeout parameter to all calls.
v0.5.6 Adds optional support for an "All Echos" child device which you can choose to select along with your other Echo devices. This device, allows Alexa Broadcast TTS to all of the Echo devices on your Amazon Account (whether or not you have selected them as part of this integration.) All of your devices will perform the TTS at approximately the same time, however they are not precisely synchronized. Using this broadcast feature does have the advantage of only issuing one call to Amazon, thus preventing the tripping of Amazon's rate limiting/throttling of calls to their servers.
v0.5.1 addresses an exception that was raised and caught each time a TTS message was sent to Amazon. The exception was thrown by the underlying platform while trying to process the response as json. Working with support, I have changed the expected contentType to text/plain and the exceptions appear to be resolved. Hubitat Support noticed this error while troubleshooting various users' hubs over the past few months. Please upgrade your Alexa TTS App to v0.5.1 as soon as possible to eliminate this issue.
v0.5.0 Thanks to the amazing efforts of @gabriele, you can now automatically keep your Alexa Cookie refreshed using an external NodeJS web server (e.g. a Raspberry Pi.) Please read the revised ReadMe for instructions on setting this up!
WARNING: v0.4.x will delete and create new child devices if you choose to enable the virtual container support feature. To use the Virtual Container feature, you will need @stephack's Virtual Container Driver from his repo at https://github.com/stephack/Hubitat/blob/master/drivers/Virtual%20Container/Virtual%20Container.groovy
Most users have found that the cookie expires after 14 days. You will need to get a new cookie each time it expires. With v0.5.0, you can now use a local NodeJS server to help automate this process. You can also continue to use the F12 method found in the ReadMe to manually update the cookie. I have added a new Notification Device selection option to the App. Choosing a device, like Pushover, will tell you when the Alexa TTS Manager App is having an problem taking to the Alexa servers.
- No Raspberry Pi required (except for AlexaCookie.js for automatic Cookie Renewal! v0.5.0)
- No link back to your old SmartThings hub
Just a simple Parent App / Child Driver pair to install (and some web browser cookie stealing/editing/hacking ) Read on if you're interested!
As someone who does not own any devices that natively support Text to Speech (TTS), I have been waiting for Amazon to implement an open TTS API so I can use my Alexa Devices. It seems like Amazon is not quite ready to release this functionality, so I decided I would develop a workaround. Initially, I was inspired by the work of @cwwilson08 to use a Telnet session to a Raspberry Pi to run a shell script. I am happy to see that @cwwilson08 was able to get this working after the Hubitat team resolved an issue in the Telnet Client.
The directions for getting this integration up and running can be found in my ReadMe below:
Here are a few pictures to help make some of the steps a little easier to visualize.
"Alexa TTS Manager" Apps Code Installation
"Child Alexa TTS" Drivers Code installation
Configuring the "Alexa TTS Manager" App
Enter your cookie string and click Next.
Note: Creating this cookie string is the hardest part of the process and is detailed in the ReadMe. As of v0.5.0, you can now optionally use @gabriele's awesome AlexaCookie NodeJS server app on an external server (e.g. Raspberry Pi) to automate the cookie renewal process.
Click the drop down list and select the devices you want to use.
If this list is empty, check the logs (most likely your cookie string is not correct, or your cookie is no longer valid.)
Optionally, you can turn on the Virtual Container feature to keep your Alexa devices grouped together in your Devices list. Click Done, which will create a "Child Alexa TTS" device for each of your Alexa devices you just selected. Note: Unchecking a device, after the child is created, will not remove the child. You will need to manually remove the child if desired. This is to prevent accidentally deleting a child that is used by a bunch of automations.
Now go take a look at your "Devices" list and you will see the new "AlexaTTS name" child devices. Do not change the Device Network ID's of these. You can safely change the Label to whatever you'd like though.
You can then click on one of these child devices to bring up a very simple TTS device. Type in any text you'd like below the Speak button, and then click Speak. The appropriate Alexa device will then wake up and speak your phrase.
You can then incorporate these child devices into any automations that are able to utilize the "Speech Synthesis" Capability, like Rule Machine.
I would like to thank @cwwilson08 and @chuck.schwer for their inspiration and technical assistance. Also, I appreciate the very quick beta testing done by @stephack which helped to improve the documentation.
As always, feedback is appreciated. If anyone wants to add more functionality or improve the ReadMe, I'd be happy to entertain pull requests.