I'm a developer who knows only few things about groovy. I'm playing with groovy to modify an app. I have Echo Speak installed.
Is there an easy way in Groovy to speak a text on an Alexa device ?
I'm a developer who knows only few things about groovy. I'm playing with groovy to modify an app. I have Echo Speak installed.
Is there an easy way in Groovy to speak a text on an Alexa device ?
Groovy per se, no. Echo Speaks can be used to create devices on Hubitat, and these devices are what you can use to speak text on Alexa. You can play around with the commands on the device page to see what they do (fill in any required or desired parameters, then click the command name/button itself to execute the command), but for most automation purposes, what you'd be doing is calling these commands from an app--whether built-in or custom. This, of course, assumes you have Echo Speaks set up already (and have created one or more Alexa devices on your Hubitat system using it). If not, that--or some TTS device of some kind on your hub--is a prerequisite.
In a custom app, you'd need to get a reference to the device from an input
on one of your app page
s, then you can just run the desired command on the device. The command name is a regular Groovy method call on the device object--something like myDevice.speak("My text")
for the "Speak" command (or similar for whatever one you use). The fact that it is an Echo Speaks device specifically won't matter, as long as the command name is one available on your device (and Echo Speaks does put several custom commands on the device, so it sort of does matter in that not all of these will be available on any TTS device you use, but in general, this abstraction is how the device model works).
That's the general idea. If you aren't familiar with Hubitat's app development model, you might need more information. In that case, sharing more specifics would likely get you more targeted advice. Good luck!
Thank you for your answer. I'm a little bit familiar with Hubitat app. I made my own driver for an existing app that did not include my type of device.
I'm using an app that was develop by a guy here and I'd like to add a speak to my Alexa device. As I said, I already installed Echo Speaks so all my Alexa devices exists on Hubitat. Not sure I understand what you mean by myDevice.speak("My text")
. If it's so simple, how do I specify one of my Alexa device to be myDevice ? Sorry for the dummy question.
That would be from a standard app input, something like:
input name: "myDevice", type: "capability.speechSynthesis", title: "Select speaker"
It's not clear how familiar you are with this or where you are in the process, so sharing more would always be welcome.
I know just enough to reproduce what you just explained. I did a test and it works.
Thank you so much for your help !
If you go to the hubitat repository on github, there is a lot of groovy examples there for you to work with or modify while you learn.
Good to know, thank you.