Alexa TTS (Text-To-Speech) [and more] plug-in for Vera

I finally found some time to package this thing, so I’m happy to present my new plug-in, allowing Alexa to play TTS (text-to-speech) dinamically.

It’s based on the famous https://raw.githubusercontent.com/thorsten-gehrig/alexa-remote-control/master/alexa_remote_control_plain.sh to execute TTS (Text-To-Speech) commands against your Amazon Echo.

Right now, only TTS is implemented, but any other commands can be called. This is a work in progress.

The script will automatically download and install the .sh script from the aforementioned GitHub repo. If you don’t like it, simply do it the first time, than overwrite the file with your own version.

Right now it’s only working with accounts not based on MFA (Multi Factor Authentication). In the future I will probably re-write it entirely in LUA, but it’s woking fine since 1+ year for me and I decided to donate it to the community.

YMMV, since it’s a bit hacky and the setup is convoluted, but it’s rock solid and the speech quality is very good.

Please take a look at GitHub for further instructions, but it’s basically emulating the Sonos/DLNA plugins, so the same LUA code can be used to control the devices.

Since the script is able to do much more, I will probably implement other actions, since I use it to trigger routines from my Vera, start music, etc (directly using the script, with no corresponding luup actions).

9 Likes

I’m going to enjoy this after hacking the TTS script! Thanks!

C

Nice!! Trying it out… But where do i enter?:

After installation, ensure to change Username, Password, DefaultEcho, DefaultVolume, Language and AlexaHost/AmazonHost to your settings. Please refer to the original script instruction for more info.

There is no such forms to fill anywhere in the device i made…
/Mattias

You need to edit the .sh file that should have been downloaded. I just need to find it!

C

OK I’m a bit stumped.
I have a device but no icon.
Not obvious finding the .sh script to edit the user / pass data
Checking through the files:

Sprinkler Controller
in

D_VeraAlexa1.xml

Which I assume is an error :slight_smile:

I can see
local BIN_PATH = “/storage/alexa”
But I have no /storage/alexa

So I’m going to stop now and hope you can explain where I’ve screwed it up.

Cheers!

C

yes, the device has no icon at the moment, since it’s mostly about a non visual action.

sorry about the lack of info, you can simply set those under advanced, then variables. no need to hack the .sh file.

Those automatically created variables, so you can modify them under settings, advanced, variables.

Thanks.
I was expecting an icon due to the PNG file :slight_smile:

If I go into Advanced > Variables I have nothing other than white space. Nothing even to add new variables (NB I’m not on the 7.30 beta yet…)

Cheers

C

That’s a sign that it’s not going well. Can you please take a look at the logs?

Also, I’m not sure if there’s a /storage/ directory before 7.30, I’m on 7.30 from such a long time that I don’t remember it anymore. I can easily adapt it to other FW, I just need to identify a correct path.

There’s certainly /storage:

root@MiOS_50103066:~# cd /storage/
root@MiOS_50103066:/storage# ls
cmh-backup cmh-firmware

This log help?

50 11/16/19 15:17:09.178 luup_log:0: AAH> Amazon Alexa Helper plugin rev 30 starting up <0x76de2520>
50 11/16/19 15:17:09.196 luup_log:0: AAH> Amazon Alexa Helper plugin startup done <0x76de2520>
01 11/16/19 15:17:11.838 luup_require [string “module(“L_VeraAlexa1”, package.seeall)…”]:159: unexpected symbol near ‘3’ <0x76de2520>
01 11/16/19 15:17:11.840 LuImplementation::StartLua running startup code for 166 I_VeraAlexa1.xml failed <0x76de2520>

C

My bad, there was a 3 somewhere in the code. Please try it again.

Groovy. I have the device, ta!

And confirmed working! Awesome!

C

1 Like

Great. Icon will follow soon, as well as the other things the sh script is able to do. I just need to find some time to find the right actions and service ids.

Utterly brill, sir!

C

Hello
I tried but it only worked the first time
Then more voice mail
I looked at the log
11/17/19 16:42:52.171 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunLua <0x71fc1520>
08 11/17/19 16:42:52.171 JobHandler_LuaUPnP::HandleActionRequest argument id=lu_action <0x71fc1520>
08 11/17/19 16:42:52.171 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1 <0x71fc1520>
08 11/17/19 16:42:52.172 JobHandler_LuaUPnP::HandleActionRequest argument action=RunLua <0x71fc1520>
08 11/17/19 16:42:52.172 JobHandler_LuaUPnP::HandleActionRequest argument Code=luup.call_action(“urn:dlna-org:serviceId:DLNAMediaController1”, “Say”, {Text=“Hello Alexa”, Volume=30, GroupZones=“Freebox Delta”}, 140) <0x71fc1520>
08 11/17/19 16:42:52.174 JobHandler_LuaUPnP::HandleActionRequest device: 140 service: urn:dlna-org:serviceId:DLNAMediaController1 action: Say <0x71fc1520>
08 11/17/19 16:42:52.174 JobHandler_LuaUPnP::HandleActionRequest argument Text=Hello Alexa <0x71fc1520>
08 11/17/19 16:42:52.175 JobHandler_LuaUPnP::HandleActionRequest argument GroupZones=Freebox Delta <0x71fc1520>
08 11/17/19 16:42:52.175 JobHandler_LuaUPnP::HandleActionRequest argument Volume=30 <0x71fc1520>
50 11/17/19 16:42:52.176 luup_log:140: VeraAlexa: TTS added to queue for 140 <0x71fc1520>

01 11/17/19 16:43:42.101 LuaInterface::CallFunction_Timer-5 function checkQueue failed [string “module(“L_VeraAlexa1”, package.seeall)…”]:278: bad argument #1 to ‘remove’ (table expected, got nil) <0x7441c520>

Well done! I attempted something like this last year but gave up due to the lack of announcement syncing between the echos potentially causing a cacophony unlike the SONOS which lead me to gave up. Is it still the case?

Yes, you can use all as zone, but it will play one per time anyway. It’s a limitation of the script/hack it is based on.

In an ideal world, you could write a skill and use that, but this will involve more cloud. In its simplicity, this solution works very well.

Can you please share your code? Thanks.

Yeah, ‘All’ doesn’t work that well with the original script. There’s a rate limit that kicks in somewhere :frowning:
C

Hello @therealdb , I am not sure if i did something wrong but it is not working for me, can you help please,

  • I downloaded all the files and uploaded them to my Vera Plus (running Beta .30 firmware)
  • created the device as described and rebooted Vera
  • changed my username and my password Only (I have a US account)
  • created a manual scene and put the following in the luup code:
    luup.call_action(“urn:dlna-org:serviceId:DLNAMediaController1”, “Say”, {Text=“Hello from Vera Alexa”, Volume=50, GroupZones=“Bedroom”}, 214)
    I have a group named Bedroom and i have an Echo device named Bedroom, i tried to run the scene many times but didn’t get anything?

what i am doing wrong?

thanks,