Runs Echo Speaks Server locally on Fire TV

Echo Speaks is a great app for HE voice notifications for those of us who have echo devices. The app requires a nodejs web server to login in with Amazon. You have options of either deploying the server on Heroku or hosting locally on an always-on computer. I prefer not to run an app that manages my Amazon login security on the cloud. While most others run the local server on a Raspberry PI, I happen to have a FireTV device instead, and I got it to run the server. I learned a lot from this forum, so I hope my experience can help others set up the Echo Speak Server on the FireTV device.

I have a FireTV Stick 4K, but it will mostly work on other FireTV devices. At a high level, there are three steps involved:

  1. Install Termux and Termux:Boot
  2. Install Node.js in Termux
  3. Install and Configure echo-speaks-server

Here are the details:

0. Prerequisite
The FireTV device should have about 500M free space. The total installation used 380MB but making sure that you still have some space left. You may want to remove some unused apps to make space for this.

1. Install Termux and Termux:Boot
There are many different ways to install Termux. You can directly sideload them, but most people use F-Droid, and here are the steps I followed.

  1. Install the Downloader: You can follow the link to on web and deliver to FireTV, or search the app on FireTV and install.
  2. Enable the installation of unknown source: On FireTV, go to Settings -> My FireTV -> Developer Options -> Apps from Unknown Sources -> Turn On
  3. Enable Downloader to install: under the above Developer Options, select Install unknown apps -> Downloader -> Turn On
  4. Install F-Droid: open the Downloader app and give it the needed permission, enter the URL, https://f-droid.org/F-Droid.apk, to download and install F-Droid.
  5. Install Termux and Termux:Boot: Open F-Droid and search for "termux" and install, then search "termux boot" and install it, launch the Termux:Boot once to enable it.
  6. Optionally, you can install sshd to access Termux from remote terminal. Please folow the Termux Remote Access wiki to install.

2. Install Node.js in Termux
This is very straightforward running the pkg installer:

pkg upgrade
pkg install nodejs

Once installed, run npm update

npm install npm -g

Finally, fix the shebang for npm script. Otherwise it won't work for Termux:Boot later.

termux-fix-shebang $(which npm)

Check the first line of npm should look like this:

head -1 $(which npm)
#!/data/data/com.termux/files/usr/bin/env node

3. Install and Configure echo-speaks-server

  1. First we need to install git
    pkg install git
    
  2. Then follow the instructions by tonesto7:
    [RELEASE] Echo Speaks v3 + Actions - Developers / Code Share - Hubitat
    If you encounter cookie error like below
    Error: Cannot find module 'cookie'
    
    You can fix it by running below command and run npm start again.
    npm uninstall cookie-parser
    npm start
    
  3. Upon successful start, you'll see a line like below where you can find the IP address and port.
    ** Echo Speaks Config Service (v2.6.0) is Running at (IP: 192.168.0.113 | Port: 8091) | ProcessId: 11256 **
    
    You can then open a web browser on any computer or mobile phone connected to the same network and point to http://192.168.0.113:8091/ (change it to your IP address). You should see the Echo Speaks Server webpage.
  4. Making sure the server will restart when the FireTV reboots or recover from lost power. Also, the server process won't be killed by FireTV when running in the background. We use Termux:Boot for this task by adding a file, say echospeaks.rc, in the ~/.termux/boot directory.
    mkdir -p ~/.termux/boot
    touch ~/.termux/boot/echospeaks.rc
    chmod +x ~/.termux/boot/echospeaks.rc
    nano ~/.termux/boot/echospeaks.rc # You can use other editor instead of nano
    
    Add blow content in the file:
    #!/data/data/com.termux/files/usr/bin/sh
    termux-wake-lock
    cd $HOME/apps/echo-speaks-server/
    nohup npm start >/dev/null 2>&1 &
    
    Restart the FireTV and check to make sure you can still access the server URL at the end of the previous step.

5. Follow the instruction to install HE drivers and apps and use the local server
[RELEASE] Echo Speaks v3 + Actions - Developers / Code Share - Hubitat

9 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.