Alexa Announce Feature - Text to Speach via Alexa now a possability?

alexa
Tags: #<Tag:0x00007f480911f870>

#184

i didnt even know that it used cookies untill i read about that here.
i think that could be fileright related.

i saved the sh file inside the home dir from the user that runs the file.
so the rights for that dir and subdirs belong to the user.

you run as pi inside the homeassistant dir from hasbian. which i am certain that is owned by homeassistant.
i think that will always give trouble.

try starting it as homeassistant, or moving the file to /home/pi/


#185

I did chmod 777 rights for the files i also tried as sudo command. I did now test on a clean raspberry install . What python do you have installed? I also tried to do as the Homeassistant user with these file on /home/homeassistant/.homeassistant.
Can you comfirm what settings you have ? I didnt understand the PATH instruction should i just add after the line or just replace it?
This is my settings.
#LANGUAGE=“de-DE”
LANGUAGE=“en-GB”
#LANGUAGE=“en-US”

AMAZON=‘amazon.de
#AMAZON=‘amazon.co.uk
#AMAZON=‘amazon.com

ALEXA=‘layla.amazon.de
#ALEXA=‘alexa.amazon.co.uk
#ALEXA=‘layla.amazon.co.uk
#ALEXA=‘pitangui.amazon.com


#186

i never touched anything in the sections below where it says:nothing to configure below here.

i got this settings:


EMAIL='my email'
PASSWORD='my amazon pw'

LANGUAGE="de-DE"
#LANGUAGE="en-US"

AMAZON='amazon.de'
#AMAZON='amazon.com'

ALEXA='layla.amazon.de'
#ALEXA='pitangui.amazon.com'

# cURL binary
CURL='/usr/bin/curl'

# cURL options
#  -k : if your cURL cannot verify CA certificates, you'll have to trust any
#  --compressed : if your cURL was compiled with libz you may use compression
#  --http1.1 : cURL defaults to HTTP/2 on HTTPS connections if available
OPTS='--compressed --http1.1'
#OPTS='-k --compressed --http1.1'

# browser identity
BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0'

below that i see:

TMP="/tmp"
COOKIE="${TMP}/.alexa.cookie"
DEVLIST="${TMP}/.alexa.devicelist.json"

i should expect to find a dir called tmp in the same dir as my shl file.
but there it isnt.
i dont know where the cookie is stored, but it works :wink:

edit:
found it i didnt think right. its not a subdir from the place where the file is but its in the root /tmp
but i guess you could create a dir anywhere and set it there when you make sure the filerights are right.


#187

It would be the tmp of your system … unless you change it in the sh file… /var/tmp I think by default


#188

The Cookie and Devlist file is in the \TMP . But still no sound comes out.


#189

same user that logs in to amazon, as that is logged on to the echo?


#190

Yes i even get the info . Does it work for you if you change to UK lang?
[email protected]:~/.homeassistant $ ./alexa_remote_control.sh -a
the following devices exist in your account:
Echodot
This Device


#191

i dont know.
it must be the same language as you use on the dot.
and if i start changing that i am asking for trouble (at least with my wife :wink: )

you try weather, did you try speak?


#192

Yes

[email protected]:/home/homeassistant/.homeassistant $ ./alexa_remote_control.sh -d “Echodot” -e speak:This_is_a_test_longgggggggggggggggggggggggggggggggggggggggggggg_test
cookie does not exist. logging in …
device list does not exist. downloading …
sending cmd:speak:This_is_a_test_longgggggggggggggggggggggggggggggggggggggggggggg_test to dev:Echodot type:XXXXXXXXXX serial:XXXXXXXXX customerid:XXXXXXX
Sequence command: Alexa.Speak


#193

I would change the tmp directory to alexa_temp inside your HAconfig folder and after saving the .alexa.cookie there chown it as homeassistant:homeassistant If that’s your HA username

Somewhere in the beginning of this thread someone else suggested it and there are more detailed instructions about it


#194

not in my case. but i have no trouble :wink:

@JLeandroFreitas is there anything in the history from the alexa app?


#195

No History :frowning: And i try even tried on another machine with raspbian same there. Can it be python related?


#196

did you make sure you got the right email address and password in your shl file and also thought about capitals?

edit: it seems like it doesnt connect

edit2: it is an shl file so there is no python involved


#197

Yes it connect because i see the serial and all the information from my Echodot.

[email protected]:~/.homeassistant $ ./alexa_remote_control.sh -a
the following devices exist in your account:
Echodot
This Device


#198

hmm, right.
routines in your alexa app do work?


#199

I dont use routines it that a requirement? I just use Hue stuff.


#200

How did you solve this?


#201

this is about routines. so try to create 1 that gives the weather on a certain time.
if you can do so and that workes, it should work with this also.
if you have trouble creating and using routines, that could be your problem.


#202

bradshaw had a problem with multiple users. but you dont have that problem.


#203

Your output is very similar to mine. In your case you are getting your device list, which means your credentials and cookies and such are working fine. I troubleshooted by first adding logging to the CURL command.

I changed the beginning of line 534, adding `"–trace-ascii -" to the CURL command.
${CURL} --trace-ascii - ${OPTS} -s -b ${COOKIE} -A "${BROWSER} ....etc

Once you do this, run the script from the command line, and you’ll see the raw request/reply message for the speak command. I could see it was making the request and getting a HTTP 400 (Bad Request) reply. In my case, the customerId for the device didn’t match my customerId. If you want to verify that, look at the data sent from the CURL command. Part of the data will have “customerId”:“XXXXXXXXXX”. That value should match the same customerId that is outputted from this page https://alexa.amazon.com/api/bootstrap (after signin).