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

No dramas, hopefully it’ll be an Amazon supported API function at some point.

Sorry

On your Vera
/storage/alexa

But as the god man says…

C

1 Like

Ah that explains why I didnt know about it, it’s hidden to WinSCP unless you search for it.

It is

A preceding period in a file name hides that file in most *nix systems

Slightly surprised you managed to get your cookie done as that is also hidden :wink:

C

I renamed it after I uploaded it and then wondered where the heck it had gone. :grin:

1 Like

:smiley:

Learning curve!

C

1 Like

Couldn’t make it work :frowning_face:. Already tried the following -

  • used Dec 18 Github version
  • used latest Github version (6 days ago)
  • edited username, password, default echo in the variables tab of the device (which i device named as Alexa TTS)
  • edited device number at the end of the luup code
  • used the luup code with and without GroupZones
  • copied the cookies.txt of pitangui.amazon.com via google chrome’s cookie.txt in a windows 10 pc which i transfered to the /storage/alexa folder as .alexa.cookie via winscp
  • tried pitangui.amazon.com and alexa.amazon.com as alexa host

It is noticeable that the .alexa.cookie file is being deleted automatically after every try of the luup code. I can see the folder /storage/alexa but it only has 2 files - .alexa.login and alexa_remote_control_plain.sh plus the .alexa.cookie file every time i copy it.

Probably caused by incorrect alexa and amazon host address as i am using it in the Philippines. I access my alexa device via the amazon app in android and alexa.amazon.com in windows browser. Sharing my experience in case anyone can help

alexa app - settings - about

will give you host name

1 Like

thanks.

i got alexa.amazon.com as the alexa app host name in the android app.

on windows, i get alexa.amazon.com as the host name when i login using the address alexa.amazon.com but i get pitangui.amazon.com when i login using the address pitangui.amazon.com.

anyway, i already tried both in the device settings as the alexa host and couldn’t make it work. atleast now i know that i’m probably already using the correct alexa host address.

update- i was also able to login using alexa.amazon.com.au and alexa.amazon.com.uk but seems to be redirected to alexa.amazon.com and the app shows alexa.amazon.com as the host name. so probably my alexa host is already correct using alexa.amazon.com, will continue trouble shooting next few days…

sounds like you should use the default settings.

did you delete all cookies befor logging in?

1 Like

yup, i deleted cookies before logging in. maybe i’m doing something wrong via google chrome so i will try the suggested firefox next and update here for others if it works. thanks again

also try just amazon.com

1 Like

What are you settings for DefaultEcho and etc. How are you testing the TTS?

1 Like

i’m using these codes in the “test luup code” under “develop apps”. “Everywhere” is my speaker group with about 7 alexa devices, but i also tried without. 307 is the device # of the device i created after the luup files uploading. my default echo is named “Foyer”

  • luup.call_action(“urn:dlna-org:serviceId:DLNAMediaController1”, “Say”, {Text=“Hello from Vera Alexa”, Volume=50, GroupZones=“Everywhere”, Repeat = 3}, 307)
  • luup.call_action(“urn:dlna-org:serviceId:DLNAMediaController1”, “Say”, {Text=“Hello from Vera Alexa”, Volume=50, Repeat = 1}, 307)

don’t use everywhere it does not work
use the name of one of your echo devices

also when you log in to get cookie, do it from pitangui.amazon.com

2 Likes

It worked! i used alexa.amazon.com. seems the problem was caused by the chrome browser and its cookies.txt export extension. i opened to compare the exported files now - it has different formats and the one from firefox is longer

Many thanks ElCid, Pabla and ofcourse, the source of this happiness therealdb!

Also sharing that it’s working on the echo, echo dot, echo show 5&8. but, as already suggested initially, not working on bose home speaker 500 with alexa enabled in case there are other curious users.

This is great! upgrade from chime sounds to voice messages!

2 Likes

Thanks for reporting. I will update the docs soon to specify the current limitations.

I will also add more logs to the next version and try to get unsuccessful logins.

I have been using the code for a couple of weeks now, and have added verbal alerts to the alarm system as well now. I did notice that:
with Debug set to 1 my log shows repeated calls to CheckQueue, within a few microseconds and with the number increasing at each repeat, until eventually they all clear away. I am not sure why, maybe the calls are overlappping due to the time taken in issuing the execute command, but I have commented out the 5s call_delay - on the basis that if the queue is empty, nothing can be added into it without going through AddtoQueue or callTTS, so no need to re-call the handler. This seems to work and does not fill up the log file.
The function now looks like this:

function checkQueue(device)
local device = tonumber(device)

if ttsQueue[device] == nil then ttsQueue[device] = {} end
D("checkQueue: %1 - %2 in queue", device, #ttsQueue[device])

-- is queue now empty?
if #ttsQueue[device] == 0 then
	-- D("checkQueue: %1 no more items in queue, new check in 5 secs", device)
    	--luup.call_delay("checkQueue", 5, device)
else

	D("checkQueue: %1 play next", device)
	-- get the next one
	sayTTS(device, ttsQueue[device][1])

		-- remove from queue
		table.remove(ttsQueue[device], 1)
end
return true

end

Regards
Octo

Yes, that makes sense. I will upload a fixed version version soon. Thanks for your suggestion.

1 Like