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

Here is an example Automate flow that will intercept the OTP text from amazon and foward to vera
SMS to vera otp ⋅ Community ⋅ Automate for Android (This runs on phone that receives the OTP text)

if the android device is not on local network when receiving the OTP, it will attempt to send a cloud message to this flow, which runs on a local android device.

you will need to edit the flows to work with your gmail account and vera ip and your VeraAlexa DeviceNum.
https://llamalab.com/automate/community/flows/32493

1 Like

Thank you. Is there an iphone solution?

No idea as i do not use Iphone.

I doubt you’ll find it because it’s not technically possible for iOS. You could, in theory, try to compile oathtool for Vera. Your best bet, if you have a spare raspberry PI/linux around, is to use it on a Linux box.

Hello, just installed latest version of the plugin (from Github).
I created the device as explained, rebooted the Vera and went to set the needed variables. But there ain’t no username or password fields (as you can see in the screenshot). Here is what I have in the log:

50 01/06/21 18:44:32.413 luup_log:587: VeraAlexa Controller Plug-In starting… <0x2bbe7680>
50 01/06/21 18:44:32.463 luup_log:587: VeraAlexa[0.9.0@587]:Plugin starting <0x2bbe7680>
01 01/06/21 18:44:32.465 LuaInterface::CallFunction_Startup-1 device 587 function startupPlugin failed [string “module(“L_VeraAlexa1”, package.seeall)…”]:89: bad argument #3 to ‘format’ (string expected, got nil) <0x2bbe7680>
01 01/06/21 18:44:32.465 LuImplementation::StartLua running startup code for 587 I_VeraAlexa1.xml failed <0x2bbe7680>

Any help will be much appreciated.

the error is related to username and password that are missing. Looking at the source code, this is very strange, as other variables are correctly populating. Could you try to load it again?

Otherwise, try to set them via code:

luup.variable_set("urn:bochicchio-com:serviceId:VeraAlexa1", "Username", "Username", devNum)
luup.variable_set("urn:bochicchio-com:serviceId:VeraAlexa1", "Password", "Password", devNum)

where devNum is your device ID (587). And then reload your luup engine.

Thank you,
So I tried with those commands but didn’t help - still no username and password fields.
Deleted the 587 device, then I created a new one. Restarted but got the same fields - still no username and password.
Did the same commands then restart the Luup engine - nothing, restarted the Vera - still no username and password fields.

I’m thinking to go and set them inside the source code files. I know that isn’t the brightest idea but … it seems like I won’t get them in the UI.

After setting them, hard refresh your browser (CTRL+F5), because the latest fw versions are known for their problems with caching.

The best way to see if variables are OK is to navigate to

http://vera.local:3480/data_request?id=status&DeviceNum=588

This is getting really wierd. I did hard refresh of course. Now I even opened the UI in incognito mode. And yet still no username and password fields. So I checked the device status the way you posted:

{ “Device_Num_588”: { “states”: [ { “id”: 67, “service”: “urn:bochicchio-com:serviceId:VeraAlexa1”, “variable”: “DebugMode”, “value”: “0” }, { “id”: 68, “service”: “urn:bochicchio-com:serviceId:VeraAlexa1”, “variable”: “Username”, “value”: “Username” }, { “id”: 69, “service”: “urn:bochicchio-com:serviceId:VeraAlexa1”, “variable”: “Password”, “value”: “Password” }, …

So they are there but do not show in UI. So I thought I’ll just set them this way and maybe it will work even though I don’t see them in the UI. But then I looked in the log and saw this:

50 01/07/21 11:59:50.095 luup_log:588: VeraAlexa Controller Plug-In starting… <0x2bec1680>
50 01/07/21 11:59:50.182 luup_log:588: VeraAlexa[0.9.0@588]:Plugin starting <0x2bec1680>
01 01/07/21 11:59:50.184 LuaInterface::CallFunction_Startup-1 device 588 function startupPlugin failed [string “module(“L_VeraAlexa1”, package.seeall)…”]:89: bad argument #3 to ‘format’ (string expected, got nil) <0x2bec1680>
01 01/07/21 11:59:50.184 LuImplementation::StartLua running startup code for 588 I_VeraAlexa1.xml failed <0x2bec1680>

I kind of expected to see error regarding bad username and password or problem with login but not that it is still nil.

Now I opened the source code and I saw that you check the firmware version. Mine is 1.7.1030 and I can update it up to 1.7.1040 but nothing more than that because I’m with Vera 3. Could this be a problem? For some reason I don’t have a folder VeraAlexa in /etc/cmh-ludl/ . Maybe I should make it manually?

That’s strange and weird (and I can’t repro, since I’m on fw 7.32 beta). Try to add more logs to the source code, and place this inside buildCommand

D(masterID, 'username: %1', username)

I’ve never tried it on a Vera 3, but if the folder is not created, maybe there’s something strange going on (ie: a different disk structure).

Should I add this right under this part:

-- init default vars
initVar(MYSID, "DebugMode", 0, masterID)
initVar(MYSID, "Username", "youraccount@amazon.com", masterID)
initVar(MYSID, "Password", "password", masterID)
initVar(MYSID, "DefaultEcho", "Bedroom", masterID)
initVar(MYSID, "DefaultVolume", 50, masterID)

or somewhere else?

Also there is /etc/cmh-ludl/ and I can see there all the files including the ones about VeraAlexa plugin. Tried to create it manually and it was created without any problem.

So I created that folder and put that line that you posted right under the section I pasted in previous comment. Set configured to 0 and restarted my Vera. Log still shows the same. It didn’t show anything like username:… So I really don’t know how come the device gets configured but misses some parts since I’m looking at the code and I just don’t get it. Maybe there is something else I’m missing. The folder VeraAlexa is empty as well.

Binary path for a normal vera is /storage/alexa.

I’m not sure if that folder is available for your fw. Try to move line 422 outside the if (ie: to line 425) and see if that is changing. The line should be added under buildCommand function, to see if this is called.

I’m not excluding this fw version is somewhat different and username/password variables are hidden.

There is no /storage in my system. I moved that line outside the if and put othe D(… inside buildCommand function. Set configured to 0 again and restarted the Vera. Now lines in log are the same:

50 01/07/21 14:11:24.287 luup_log:588: VeraAlexa Controller Plug-In starting… <0x2c191680>
50 01/07/21 14:11:24.337 luup_log:588: VeraAlexa[0.9.0@588]:Plugin starting <0x2c191680>
01 01/07/21 14:11:24.339 LuaInterface::CallFunction_Startup-1 device 588 function startupPlugin failed [string “module(“L_VeraAlexa1”, package.seeall)…”]:89: bad argument #3 to ‘format’ (string expected, got nil) <0x2c191680>
01 01/07/21 14:11:24.339 LuImplementation::StartLua running startup code for 588 I_VeraAlexa1.xml failed <0x2c191680>

But the variable configured stays on 0.

Looks like a much bigger problem than I hoped at the begining so I guess I’ll have to use your code as reference and try to do my own version from scratch but don’t know when I’ll have the time for this. But I feel uncomfortable spaming here that much. Thanks for your help. I’ll try to see what I can do myself.

Best regards

There must be something else, since it’s crashing in startup code. but startup code has not string.format, so maybe it’s something inside checkQueue. Code is pretty simple, so it’s definitely something related to your luup engine version.

Acctually it is just where it says it is - “89: bad argument #3 to ‘format’ (string expected, got nil) <0x2c191680>” - 89 is the line number and the line is:

str = string.format(“%s:%s”, str, msg)

So I just added this:
if msg == nil then msg = " (nil msg) " end

And now the log shows this:

50 01/07/21 18:27:46.447 luup_log:588: VeraAlexa Controller Plug-In starting… <0x2c061680>
50 01/07/21 18:27:46.488 luup_log:588: VeraAlexa[0.9.0@588]:Plugin starting <0x2c061680>
50 01/07/21 18:27:46.490 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.491 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.492 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.494 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.496 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.748 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.750 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.793 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.795 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.797 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.798 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.799 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
06 01/07/21 18:27:46.800 Device_Variable::m_szValue_set device: 588 service: urn:micasaverde-com:serviceId:HaDevice1 variable: Configured was: 0 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0x11b08b0/NONE duplicate:0 <0x2c061680>
50 01/07/21 18:27:46.813 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>
50 01/07/21 18:27:46.815 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2c061680>

At least it got somewhere and it doesn’t show error. Problem is there are a lot of logs but not very helpful :slight_smile: At least now the folder /etc/cmh-ludl/VeraAlexa has 1 file in it - alexa_remote_control_plain.sh
Now in variables I have “configured” back to 1 again but still no username and password fields. Reloaded Lua … just in case :slight_smile: And then in log I have a bit different but same useless rows :slight_smile:

50 01/07/21 18:35:18.697 luup_log:588: VeraAlexa Controller Plug-In starting… <0x2b94d680>
50 01/07/21 18:35:18.738 luup_log:588: VeraAlexa[0.9.0@588]:Plugin starting <0x2b94d680>
50 01/07/21 18:35:18.740 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2b94d680>
50 01/07/21 18:35:18.741 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2b94d680>
50 01/07/21 18:35:18.743 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2b94d680>
50 01/07/21 18:35:18.745 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2b94d680>
50 01/07/21 18:35:18.746 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2b94d680>
50 01/07/21 18:35:18.748 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2b94d680>
50 01/07/21 18:35:18.749 luup_log:588: VeraAlexa[0.9.0@588]: (nil msg) <0x2b94d680>

So since you’ve made it based on the number of those rows if something comes up to help me :slight_smile: please share it. Or I’ll continue to try it row by row.

OK, i found some errors and I fixed them. Unfortunately, I moved the repo and some un-tested version was uploaded. I’m sorry.

Since we’re at it, I’ve added a new BinPath variable. You should be able to override the default path now.

So, v 0.91 is on GitHub, give it a try and sorry for the troubles.

Thanks. Much better. Here is what I got on first run of 0.91:

50 01/07/21 21:21:00.128 luup_log:588: VeraAlexa Controller Plug-In starting… <0x2c1a3680>
50 01/07/21 21:21:00.184 luup_log:588: VeraAlexa[0.91@588]:Plugin starting <0x2c1a3680>
50 01/07/21 21:21:00.186 luup_log:588: VeraAlexa0.91@588:OpenLuup: false <0x2c1a3680>
50 01/07/21 21:21:00.187 luup_log:588: VeraAlexa0.91@588:jq: false <0x2c1a3680>
06 01/07/21 21:21:00.208 Device_Variable::m_szValue_set device: 588 service: urn:bochicchio-com:serviceId:VeraAlexa1 variable: BinPath was: EMPTY now: /storage/alexa #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2c1a3680>
50 01/07/21 21:21:00.216 luup_log:588: VeraAlexa0.91@588:setVar(“urn:bochicchio-com:serviceId:VeraAlexa1”,“AnnouncementVolume”,“50”,588) old value “0” <0x2c1a3680>
06 01/07/21 21:21:00.217 Device_Variable::m_szValue_set device: 588 service: urn:bochicchio-com:serviceId:VeraAlexa1 variable: AnnouncementVolume was: 0 now: 50 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2c1a3680>
50 01/07/21 21:21:00.219 luup_log:588: VeraAlexa0.91@588:setVar(“urn:micasaverde-com:serviceId:HaDevice1”,“AnnouncementVolume”,“”,588) old value “50” <0x2c1a3680>
06 01/07/21 21:21:00.219 Device_Variable::m_szValue_set device: 588 service: urn:micasaverde-com:serviceId:HaDevice1 variable: AnnouncementVolume was: 50 now: #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2c1a3680>
50 01/07/21 21:21:00.221 luup_log:588: VeraAlexa[0.91@588]:New version detected: reconfiguration in progress <0x2c1a3680>
50 01/07/21 21:21:00.223 luup_log:588: VeraAlexa0.91@588:setVar(“urn:micasaverde-com:serviceId:HaDevice1”,“Configured”,“0”,588) old value “1” <0x2c1a3680>
06 01/07/21 21:21:00.223 Device_Variable::m_szValue_set device: 588 service: urn:micasaverde-com:serviceId:HaDevice1 variable: Configured was: 1 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0xe6cfc8/NONE duplicate:0 <0x2c1a3680>
50 01/07/21 21:21:00.226 luup_log:588: VeraAlexa0.91@588:setVar(“urn:bochicchio-com:serviceId:VeraAlexa1”,“CurrentVersion”,“0.91”,588) old value “0.9.0” <0x2c1a3680>
06 01/07/21 21:21:00.227 Device_Variable::m_szValue_set device: 588 service: urn:bochicchio-com:serviceId:VeraAlexa1 variable: CurrentVersion was: 0.9.0 now: 0.91 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x2c1a3680>
01 01/07/21 21:21:00.228 GetLuaInterface can’t find device type: 4/0x13125e0 str: Setup in progress <0x2c1a3680>
01 01/07/21 21:21:00.229 luup_variable_get interface 0x1312de8 args 3 <0x2c1a3680>
50 01/07/21 21:21:00.264 luup_log:588: VeraAlexa0.91@588:setVar(“urn:bochicchio-com:serviceId:VeraAlexa1”,“OneTimePassCode”,“”,588) old value “” <0x2c1a3680>
50 01/07/21 21:21:00.282 luup_log:588: VeraAlexa0.91@588:setVar(“urn:micasaverde-com:serviceId:HaDevice1”,“CommFailure”,“0”,588) old value “0” <0x2c1a3680>
50 01/07/21 21:21:00.284 luup_log:588: VeraAlexa0.91@588:setVar(“urn:bochicchio-com:serviceId:VeraAlexa1”,“LatestResponse”,“”,588) old value “” <0x2c1a3680>
50 01/07/21 21:21:00.285 luup_log:588: VeraAlexa0.91@588:Response from Alexa.sh: “” <0x2c1a3680>
01 01/07/21 21:21:00.286 GetLuaInterface can’t find device type: 4/0x13125e0 str: Setup completed <0x2c1a3680>
01 01/07/21 21:21:00.287 luup_variable_get interface 0x1312de8 args 3 <0x2c1a3680>
50 01/07/21 21:21:00.288 luup_log:588: VeraAlexa0.91@588:setVar(“urn:micasaverde-com:serviceId:HaDevice1”,“Configured”,“1”,588) old value “0” <0x2c1a3680>
06 01/07/21 21:21:00.289 Device_Variable::m_szValue_set device: 588 service: urn:micasaverde-com:serviceId:HaDevice1 variable: Configured was: 0 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0xe6cfc8/NONE duplicate:0 <0x2c1a3680>
50 01/07/21 21:21:00.292 luup_log:588: VeraAlexa0.91@588:checkQueue: 0 in queue <0x2c1a3680>
50 01/07/21 21:21:00.294 luup_log:588: VeraAlexa0.91@588:checkQueue: queue is empty <0x2c1a3680>

And here is after I restarted Lua:

50 01/07/21 21:26:34.749 luup_log:588: VeraAlexa Controller Plug-In starting… <0x2b8fd680>
50 01/07/21 21:26:34.792 luup_log:588: VeraAlexa[0.91@588]:Plugin starting <0x2b8fd680>
50 01/07/21 21:26:34.794 luup_log:588: VeraAlexa0.91@588:OpenLuup: false <0x2b8fd680>
50 01/07/21 21:26:34.795 luup_log:588: VeraAlexa0.91@588:jq: false <0x2b8fd680>
01 01/07/21 21:26:34.796 GetLuaInterface can’t find device type: 4/0x13abad0 str: Setup in progress <0x2b8fd680>
01 01/07/21 21:26:34.797 luup_variable_get interface 0x13ac2d8 args 3 <0x2b8fd680>
50 01/07/21 21:26:34.833 luup_log:588: VeraAlexa0.91@588:setVar(“urn:bochicchio-com:serviceId:VeraAlexa1”,“OneTimePassCode”,“”,588) old value “” <0x2b8fd680>
50 01/07/21 21:26:34.869 luup_log:588: VeraAlexa0.91@588:setVar(“urn:micasaverde-com:serviceId:HaDevice1”,“CommFailure”,“0”,588) old value “0” <0x2b8fd680>
50 01/07/21 21:26:34.871 luup_log:588: VeraAlexa0.91@588:setVar(“urn:bochicchio-com:serviceId:VeraAlexa1”,“LatestResponse”,“”,588) old value “” <0x2b8fd680>
50 01/07/21 21:26:34.872 luup_log:588: VeraAlexa0.91@588:Response from Alexa.sh: “” <0x2b8fd680>
01 01/07/21 21:26:34.873 GetLuaInterface can’t find device type: 4/0x13abad0 str: Setup completed <0x2b8fd680>
01 01/07/21 21:26:34.873 luup_variable_get interface 0x13ac2d8 args 3 <0x2b8fd680>
50 01/07/21 21:26:34.875 luup_log:588: VeraAlexa0.91@588:setVar(“urn:micasaverde-com:serviceId:HaDevice1”,“Configured”,“1”,588) old value “1” <0x2b8fd680>
50 01/07/21 21:26:34.877 luup_log:588: VeraAlexa0.91@588:checkQueue: 0 in queue <0x2b8fd680>
50 01/07/21 21:26:34.878 luup_log:588: VeraAlexa0.91@588:checkQueue: queue is empty <0x2b8fd680>

Still no username and password fields but I see them in the status of the device so I guess that shouldn’t big problem. But any idea what is this:

“GetLuaInterface can’t find device type: 4/0x13abad0”

Also should I change BinPath to that directory that I made /etc/cmh-ludl/VeraAlexa or this is another thing?

I tried to install the jq package myself in the shell with this command “opkg --force-depends install jq” but here is what I get:

Unknown package ‘jq’.
Collected errors:

  • opkg_install_cmd: Cannot install package jq.

Any ideas on this?

Yeah, I’ll fix it later.

Yes, it’s your own path.

[quote]
I tried to install the jq package myself in the shell with this command “opkg --force-depends install jq” but here is what I get:

Unknown package ‘jq’.
Collected errors:

  • opkg_install_cmd: Cannot install package jq.

Any ideas on this?[/quote]

It’s only supported on fw 7.32.