I copied the two files .alexa_cookie and .alexa_devicelist.json in anothe folder, so when it expires i just do a copy and i have alexa runnin again…
Hmm, so I was doing that to avoid the deleted cookie from /tmp. But that only seemed to help if the cookie was deleted. For example, yesterday my cookie expired and was deleted. I copied my cookie.txt (last cookie I had), back into the correct location, renamed it to .alexa.cookie, and it was removed again. It seemed to me as if it had expired, Got a new cookie and it worked fine.
Just to clarify, are you saying that you are able to reuse those two files indefinetly?
Yes, just tried…
No I understand that if your cookie is good you can override it, but if your cookie expires, I dont think you can just copy a copy of the old expired cookie into the right place and be good, right? I will say I’m not a cookie expert (other than I do like a good chocolate chip cookie), haha.
Since now all is working… i’ll let you know if what you think will happen or not…
I’ve forked the latest alexa_wrapper.sh and alexa_remote_control.sh from Fabrizio Branca
Here is mine:
https://github.com/raidolo/ha-alexa-tts
Changes:
- Added -lastalexa in the alexa_wrapper.sh, now you can use a configuration like this in HA and then use the notify.last_alexa service in your notifications (thanks @ptdalen for the idea)
notify:
- platform: command_line
name: 'last alexa'
command: "/config/ha-alexa-tts/alexa_wrapper.sh -lastalexa"
-
Modified the location of the alexa cookies in the alexa-remote-control.sh script, now the cookies go in the HA config dir (configurable as needed if you use docker or not)
-
Alexa secrets go in HA_CONFIG_DIR/secrets.yaml as “alexa_email” and “alexa_password”.
-
Added the Alexa endpoints for Italian
What worked for me.
I’m on a Mac running .homeassistant
Downloaded the scripts (alexa_remote_control.sh and alexa_wrapper.sh), made them executable.
Edited the PATH in alexa_remote_control.sh
Edited the TMP directories to be explicitly the correct paths:
TMP="/tmp"
COOKIE="/tmp/.alexa.cookie"
DEVLIST="/tmp/.alexa.devicelist.json"
Checked and updated/installed the locations for SED, AWK, CURL and JQ as needed with ‘which SED’, etc
Checked and updated the location for the secrets.yaml file.
Updated the contents of the secrets.yaml file.
Edited the alexa_remote_control.sh file to fix a SED -r error with -E where needed to get round a Mac problem with SED.
Grabbed the cookie using firefox, chrome didn’t work for me.
renamed to /tmp/.alexa.cookie
removed the old login rm /tmp/.alexa.login
changed permissions on the cookie file chmod 777 /tmp/.alexa.cookie
ran the cli command with success! ./alexa_remote_control.sh -a
Good luck!
Today my cookie expired again Re-using the other cookie file did not work. I had to use Firefox to repeat the process and get a new file. I’ve got it down so I didn’t take too long. I was wondering how you were faring. Seems interesting that it was exactly 2 weeks ago that I have the same problem.
I just restarted Raspberry yesterday and after this reset i still have the cookies up and running…
Don’t know what to advice you about it.
No worries, just checking to see if others were having to refresh thier cookie every 14 days.
When I generated the cookie using firefox I selected the checkbox for “stay logged in” and I also have 2 factor authentication set up. When I entered the 6 digit code I also selected “dont ask again”
I just started playing around with this. It seems like it would be easier than exporting cookies from browser with mixed results. Haven’t got it working yet since I have to coordinate with Docker.
https://www.codementor.io/slavko/controlling-amazon-echo-dot-with-shell-a-bit-of-fun-mz6xxz92n
i would love to automate my cookie retrieving, but i dont see how that is done in that project.
i see a link to a js lib, but i wouldnt even know how to start with that.
and i believe the project you linked is nodered, which i am also not using.
i would love it if someone found a python or shell way to collect the cookie.
It’s not node-red.
I just copied the alexa-node-cookie-helper directory into my ha-alexa-tts folder, then cd into it, then:
npm install
node ./get-cookies-txt.js
The script does the rest.
ah, oke thanks. i did understand that wrong then.
ill try that.
hmm, i cant get it to work.
it keeps saying: cannot find module ‘cookie’
You have to do
npm install from the directory where package.json is and it will install the dependencies
oke thanks ill try again.
i got errors on that at first as well and needed to install some stuff, maybe i did mess up afterwards.
What about something like this?
no luck for me.
i tried to change everything to alexa.de but it doesnt want to do the automatic and when it tries to use the proxy i get redirected to amazon.com
i tried to change the .com inside proxy.js but that doesnt work either.
Do you have some more clear docs about how to use it? I tried but without clear docs it’s quite impossible at least for me to use this to get cookies…