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

Thanks Daniele,
I have updated to 0.97 and rebooted… The LastAlexa response is however coming back as an empty string on my system. I have added a debug statement to check the command string being sent, which looks okay to me. The preamble, with account login details, is the same as the working call to “LoungeAlexa”.

Could this be because I am using amazon.co.uk? I have looked in the remote_Control script at the lastAlexa section, but cannot see anything obvious. I have version 2021-01-28: v0.17c

|08|04/28/21 14:21:01.828|JobHandler_LuaUPnP::HandleActionRequest device: 391 service: urn:bochicchio-com:serviceId:VeraAlexa1 action: Say <0x6e999520>|
|---|---|---|
|08|04/28/21 14:21:01.828|JobHandler_LuaUPnP::HandleActionRequest argument Text=Generating--100-watts,-battery-is-at-19-percent,,-importing--1500-watts,,-We-are-using-1700-watts,,-with-the-heating,-ON,,- <0x6e999520>|
|08|04/28/21 14:21:01.829|JobHandler_LuaUPnP::HandleActionRequest argument GroupZones=LASTALEXA <0x6e999520>|
|08|04/28/21 14:21:01.829|JobHandler_LuaUPnP::HandleActionRequest argument Volume=50 <0x6e999520>|
|50|04/28/21 14:21:01.830|luup_log:391: VeraAlexa[0.97@391]:addToQueue({ Text=Generating--100-watts,-battery-is-at-19-percent,,-importing--1500-watts,,-We-are-using-1700-watts,,-with-the-heating,-ON,,-, Volume=50, GroupZones=LASTALEXA }) <0x6e999520>|
|50|04/28/21 14:21:01.831|luup_log:391: VeraAlexa[0.97@391](addToQueue@228):addToQueue(2): 0 - true <0x6e999520>|
|50|04/28/21 14:21:01.832|luup_log:391: VeraAlexa[0.97@391](addToQueue@245):addToQueue(3): 1 <0x6e999520>|
|50|04/28/21 14:21:01.834|luup_log:391: VeraAlexa[0.97@391](addToQueue@248):addToQueue(4): playing <0x6e999520>|
|50|04/28/21 14:21:01.835|luup_log:391: VeraAlexa[0.97@391](checkQueue@200):checkQueue: 1 in queue <0x6e999520>|
|50|04/28/21 14:21:01.836|luup_log:391: VeraAlexa[0.97@391](checkQueue@208):checkQueue: play next <0x6e999520>|
|50|04/28/21 14:21:01.838|luup_log:391: VeraAlexa[0.97@391](setVar@120):setVar(urn:bochicchio-com:serviceId:VeraAlexa1,OneTimePassCode,,391) old value  <0x6e999520>|
|50|04/28/21 14:21:01.839|luup_log:391: VeraAlexa[0.97@391](getLastAlexa@404):Execute command [lastAlexa]: export EMAIL=\^^^@gmail.com\ && export PASSWORD=\^^^\ && export MFASECRET=\\ && export NORMALVOL=\50\ && export SPEAKVOL=\50\ && export TTS_LOCALE=\en-uk\ && export LANGUAGE=\en-uk\ && export AMAZON=\amazon.co.uk\ && export ALEXA=\alexa.amazon.co.uk\ && export USE_ANNOUNCEMENT_FOR_SPEAK=\0\ && export TMP=\/storage/alexa\ && /storage/alexa/alexa_remote_control.sh -lastalexa <0x6e999520>|
|50|04/28/21 14:21:03.305|luup_log:391: VeraAlexa[0.97@391](setVar@120):setVar(urn:micasaverde-com:serviceId:HaDevice1,CommFailure,0,391) old value 0 <0x6e999520>|
|50|04/28/21 14:21:03.307|luup_log:391: VeraAlexa[0.97@391](setVar@120):setVar(urn:bochicchio-com:serviceId:VeraAlexa1,LatestResponse,,391) old value sending cmd:speak:Generating--100-watts,-battery-is-at-19-percent,,-importing--1500-watts,,-We-are-using-1700-watts,,-with-the-heating,-ON,,- to dev:LoungeAlexa type:A4ZP7ZC4PI6TO serial:^^^ customerid:^^^ <0x6e999520>|
|06|04/28/21 14:21:03.307|Device_Variable::m_szValue_set device: 391 service: urn:bochicchio-com:serviceId:VeraAlexa1 variable: LatestResponse was: sending cmd:speak:Generating--100-watts,-battery-is-at-19-percent,,-importing--1500-watts,,-We-are-using-1700-watts,,-with-the-heating,-ON,,- to dev:LoungeAlexa type:A4ZP7ZC4PI6TO serial^^^customerid:^^^ now:  #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x6e999520>|
|50|04/28/21 14:21:03.308|luup_log:391: VeraAlexa[0.97@391](@308):Response from Alexa.sh:  <0x6e999520>|

Thanks
Octo

Try with layla.amazon.co.uk as your Alexa host.

Plus, other people mentioned this to me. Try to download a previous version of the bash script and manually update it via scp on your Vera.

Thanks again, tried both steps back to Dec script version, and lalya, but same result for now with empty return.
May try investigating again tomorrow.

Cheers

1 Like

Also, go to the lua file in the package, change devmode variable to true, upload the file again and watch for the .sh commands generated. try them directly in a ssh console, and see what’s the output. it’s the bash script file for sure.

1 Like

Hi!
I have several days already trying to get this plug-in working without success yet.
I installed the files
Created the cookie and uploaded the cookie to Vera via SCP. (Please note that folder /storage/alexa was never created into the unit and I had to create it manually. After creating the folder manually 1 file appeared there plus the cookie now.
I try to test the code luuap but nothing happens.
When looking at the logs, I can see that code is sent to Alexa but seems that Alexa is not replying notting to Vera… there is no reply from alexa in the logs.

Could you help me with my issue?

Set DebugMode variable to 1, then try again. 100% it’s the sh script not working (ie: credentials).

Hi. How do i update from the March 2020 version? I tried uploading all files from Github on version 0.92 and 0.95 (which includes 0.97) but not working. I’m using firmware 7.31 on my vera plus

The latest version is supported only on 7.32 (beta). I’ve no hubs on 7.31.

Thanks for the quick reply, i reverted back to the March 2020 version. All working again. Will try the new versions when i update my veraplus to 7.32.

I was only trying to update to check if there is already a solution to the periodically deleted alexa cookie file. Other than that, the March 2020 version still works great! :slight_smile:

I’ve been struggling with Vera going through a reload nearly every time it has to make an http(s) call to the internet. I’ve been able to recreate the issue with the Sonos Plugin, Nest Plugin, and this one. After reload, the plugin will work for some time (hours) and then, suddenly, reload (after the missed event such as an Alexa callout).

I’m guessing it has something to do with plugins that use luasec but can’t be sure.

Anyway, I think I’ve stabilized my system by (oddly) removing AltUI for now. I highly doubt it was the actual cause but removing the plugin has ceased my reloads - now back to the Alexa plugin

I can’t seem to get this plugin to work after an hour or two. In order to get it to work again, I have to generate a new cookie, reenter by password+new_OTP, and then reload. It’ll work again for a bit and then have to repeat the process.

Any advice?

A little more info. While I think I’ve solved the Vera reload situation, Alexa TTS does stop working after a period of time unless I do a reload.

Here’s an output of my debug. If I reload (and don’t change anything else), it starts working again:

<0x6ed3f520>
06 06/16/21 10:25:39.657 Device_Variable::m_szValue_set device: 178 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1623853539 now: 1623853539 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x6ed3f520>
50 06/16/21 10:25:39.658 luup_log:120: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdateHR, 10:25 AM, 178 <0x6ed3f520>
08 06/16/21 10:25:42.046 JobHandler_LuaUPnP::HandleActionRequest device: 496 service: urn:toggledbits-com:serviceId:ReactorSensor action: RunSceneInline <0x6e1b2520>
08 06/16/21 10:25:42.047 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=496 <0x6e1b2520>
08 06/16/21 10:25:42.047 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:toggledbits-com:serviceId:ReactorSensor <0x6e1b2520>
08 06/16/21 10:25:42.047 JobHandler_LuaUPnP::HandleActionRequest argument action=RunSceneInline <0x6e1b2520>
08 06/16/21 10:25:42.047 JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=grp10jdz8gw.true <0x6e1b2520>
08 06/16/21 10:25:42.048 JobHandler_LuaUPnP::HandleActionRequest argument Options={“contextDevice”:496,“stopRunningScenes”:true} <0x6e1b2520>
08 06/16/21 10:25:42.048 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.4035900020952661 <0x6e1b2520>
50 06/16/21 10:25:42.049 luup_log:453: Reactor: RunScene action invoked, scene “grp10jdz8gw.true” <0x6e1b2520>
06 06/16/21 10:25:42.052 Device_Variable::m_szValue_set device: 453 service: urn:toggledbits-com:serviceId:Reactor variable: runscene was: [ ] now: { “ctx496.scgrp10jdz8gw.true”: { “starttime”: 1623853542, “context”: 496, “scene”: “grp10jdz8gw.true”, “taskid”: “ctx496.scgrp10jdz8gw.true”, “options”: { “stopRunningScenes”: true, “forceReactorScenes”: true, “contextDevice”: 496, “stopPriorScenes”: false }, “owner”: 496, “lastgrouptime”: 1623853542, “lastgroup”: 0 } } #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x6e1b2520>
50 06/16/21 10:25:42.054 luup_log:453: Reactor: “Presence” (#496) Performing “Run Lua” (“grp10jdz8gw.true” group 1 step 1) <0x6e1b2520>
08 06/16/21 10:25:42.202 JobHandler_LuaUPnP::HandleActionRequest device: 561 service: urn:bochicchio-com:serviceId:VeraAlexa1 action: Say <0x6e1b2520>
08 06/16/21 10:25:42.202 JobHandler_LuaUPnP::HandleActionRequest argument Repeat=1 <0x6e1b2520>
08 06/16/21 10:25:42.202 JobHandler_LuaUPnP::HandleActionRequest argument Text=Welcome home, Jennifer <0x6e1b2520>
08 06/16/21 10:25:42.203 JobHandler_LuaUPnP::HandleActionRequest argument GroupZones=Office Echo <0x6e1b2520>
08 06/16/21 10:25:42.203 JobHandler_LuaUPnP::HandleActionRequest argument Volume=50 <0x6e1b2520>
50 06/16/21 10:25:42.204 luup_log:561: VeraAlexa[0.92@561]:addToQueue({ Volume=“50”, Repeat=“1”, Text=“Welcome home, Jennifer”, GroupZones=“Office Echo” }) <0x6e1b2520>
50 06/16/21 10:25:42.205 luup_log:561: VeraAlexa0.92@561:addToQueue(2): 0 - true <0x6e1b2520>
50 06/16/21 10:25:42.205 luup_log:561: VeraAlexa0.92@561:addToQueue(3): 1 <0x6e1b2520>
50 06/16/21 10:25:42.206 luup_log:561: VeraAlexa0.92@561:addToQueue(4): playing <0x6e1b2520>
50 06/16/21 10:25:42.207 luup_log:561: VeraAlexa0.92@561:checkQueue: 1 in queue <0x6e1b2520>
50 06/16/21 10:25:42.207 luup_log:561: VeraAlexa0.92@561:checkQueue: play next <0x6e1b2520>
50 06/16/21 10:25:42.209 luup_log:561: VeraAlexa0.92@561:setVar(“urn:bochicchio-com:serviceId:VeraAlexa1”,“OneTimePassCode”,“”,561) old value “” <0x6e1b2520>
50 06/16/21 10:25:42.209 luup_log:561: VeraAlexa0.92@561:Executing command [TTS]: “-e speak:‘Welcome home, Jennifer’ -d "Office Echo"” <0x6e1b2520>

It also stops working for me after a couple of weeks or so. I did a Reload of the engine and it didn’t fix the problem. When you say you did a reload and it fixed it, perhaps you’re reloading something different?

Unfortunately, the new Vera version that was supposed to help never arrived and likely never will now.

Look for the cookie and check if it’s still ok. You could find hints by looking at the variables as well.

The only way I can get it back is to restore the cookies file and then reload the engine. This works for a few weeks and then the process starts all over again.

When the issue is happening, it does clearly state in the variables that you have to login. The question is, why does the cookie expire and require a new login?

The cookie will expire every two weeks because it’s Amazon doing this. It should auto renew and a luup reload is not needed, since its value is read when an action is executed.

Interesting. That hasn’t been my experience. Reloading luup won’t fix it for me, every few weeks I have to manually open a browser, login and then scp the cookies file over to Vera and then reload… that’s the only way so far I’ve found it will work.

So if I’m reading the Github docs correctly, if I’m on a VeraSecure running 7.31 stable release (7.32 seems to still be a mess in beta) and I have 2FA on my Amazon account (because why wouldn’t you have 2FA on EVERY account you have) this plugin will not work.

Correct?

Yes. As I have no 7.31 system left, I’m not able to test it. It’s probably working, but I’m not sure at this point and it’s limited anyway, since a couple of libs are missing on 7.31.

Still having the issue that about every 2 weeks it stops working and I have to login, re-export the cookie and restart luup. Is there no way to make this stickier?