Quote:
Originally Posted by enigma9o7
https://blog.ubuntu.com/2017/05/16/d...r-raspberry-pi
Could "Open http://alexa.local:3000 in a web browser on a local device or a device on the same network" mean not on the device you installed it on? Regardless I tried opening it from my phone and didn't do anything different.
Could there be some reason it won't work on PC but does on RPi? I'm using bodhi 5 which is ubuntu 18 based...
|
I realize this is an old post, but I saw you post about this in several places/others post that they were stuck at the same step and wanted to help/provide more information for anyone in the future who might come across this via Google. You're most welcome future people, lol.
You didn't do anything wrong - the developers of this "Alexa for Virtual Device/Raspberry PI" (DataArt) just
wrote terrible directions/poor coding.
Their code/app/snap package is supposed to setup a local host address on your device ("alexa.local") but for whatever reason this fails to happen, at least it did for you and it did for me (my system is MX Linux 19.3, based on Debian 10 [Buster]). In order to fix this, I edited a line of code in one configuration file in the snap package to replace "alexa.local" with "localhost" and then everything worked fine. However, Snap packages/the files that make a snap package are read-only/you're not supposed to be able to easily modify a snap package. In order to do so, you must first unmount the snap package, then you "unsquash" the .snap package (it's a compressed file", then modify the configuration file and update "alexa.local" to "localhost", then recompile/"resquash" the .snap package, reinstall your updated Alexa snap package, start the Alexa snap package service, then start the alexa app. It sounds hard but it's really not and only takes a moment. If you get lost,
here is a helpful website that breaks down how to modify a snap package and then reinstall it.
Code:
#see where your alexa snap file is mounted
mount |grep snap
#stop the alexa snap package
sudo snap stop alexa
#unmount the alexa snap package
sudo umount /snap/alexa/2
#unsquash the alexa .snap package to a temporary folder
sudo unsquashfs -d /home/<your username>/tempalexa /var/lib/snapd/snaps/alexa_2.snap
#edit the "local.alexa" parameter to "localhost"
<name of your text editing program> /home/<your username>//tempalexa/bin/alexa_params.py
Once inside this file, you should see:
Code:
#!/usr/bin/env python3
import os
LOCAL_HOST="alexa.local"
LOCAL_PORT=3000
BASE_URL = "http://" + LOCAL_HOST + ":" + str(LOCAL_PORT) + "/"
DEFAULT_VOICE_THRESHOLD = 0.25
DEFAULT_PRODUCT_ID = ""
DEFAULT_CLIEND_ID = ""
DEFAULT_DEVICE_SERIAL = ""
DEFAULT_CLIENT_SECRET = ""
ALEXA_CREDENTIALS_FILE = os.getenv("SNAP_USER_DATA", ".") + "/alexa_credentials"
Update the LOCAL_HOST="alexa.local" line to instead say LOCAL_HOST="localhost". Save the file and close it.
Code:
# re-squash the files/folders in your "tempalexa" folder into a new .snap package file
sudo mksquashfs /home/<your username>/tempalexa/ alexa_2.snap
#copy the updated .snap package back to where it lives
sudo cp alexa_2.snap /var/lib/snapd/snaps/alexa_2.snap
#re-mount the snap package
sudo mount -t squashfs -o ro,nodev,relatime,x-gdu.hide /var/lib/snapd/snaps/alexa_2.snap /snap/alexa/2
#start the alexa snap service again
sudo snap start alexa
#and finally, run the alexa snap application. (this is the code you will run in your terminal whenever you want to talk to Alexa on your machine
alexa.alexa-run
From there you should be able to authorize your Alexa virtual device with the Amazon server.
The next roadblock/fun part that broke my machine was the snap pulseaudio installation prerequisite. Granted, I attempted this on a desktop PC and not an actual raspberry pi, but I already had Alsa and Pulse audio running just fine on my machine. Installing the snap pulseaudio package totally broke my sound. But after uninstalling the snap pulseaudio package, and then reinstalling regular pulse audio and restarting it, I was good to go - Alexa works/I can talk to her.
However, after alllll of that fun - I can't say it's a very well-written application for interacting with Alexa
It's no comparable to the "Alexa for PC" Windows Store app on Windows 10 by any means... many of Alexa's more useful functions are not supported (playing music, communications, etc.) and the coding for alexa listening to you is terribly written - half the time she will cut you off before you've finished speaking and then gives an error saying it couldn't understand you, in broken English: "Cancel 2.5s due to the low level". Adjusting microphone levels helps, but not well for me anyway. I have to scream super loud for it to work. It's not fantastic.
But there you go! Hopefully someone finds this helpful.