Ever since Amazon released the Echo voice controlled speaker/assistant, I and many others have been hoping for it and the Fire TV to receive an update that allows the two to communicate. With the addition of new Echo IFTTT triggers last week, I’ve been able to cobble together a working proof-of-concept that gives you a glimpse of what it would be like if Amazon’s two living room products communicated with one another.
The procedure I’ll be outlining in this post is very much a proof-of-concept and not very practical. That’s why the title of this article does not start with “How to…” like most of my guides. I’ll be laying out exactly how I was able to use the Amazon Echo to launch apps on the Fire TV with voice commands, but the process is missing polish and features that would be necessary for the average person to use this implementation on a daily bases.
Here is an overview of how I was able to launch apps on the Fire TV using the Echo’s voice commands:
IFTTT, which stands for “if this then that“, is a web service that acts as a middleman to facilitate communication between dozens of different devices and services. When Amazon first integrated IFTTT triggers with the Echo, it became possible to perform any number of tasks using the Echo’s voice commands. However, the initial set of triggers, like the To-Do list trigger, lacked the elegance I wanted for custom Echo commands. Saying “Alexa, add launch Minecraft to my to-do list” in order to launch an app felt too clunky.
With last week’s addition of a new IFTTT trigger that fires when you request a song, it became possible to perform tasks with nearly 100% customized voice commands. The command must just begin with “Alexa, start….” Since the Echo will play a song from your Amazon Music Library when you say “Alexa, start [SONG TITLE]”, you can now trigger an IFTTT task by saying something like “Alexa, start vacuuming my floor” by simply uploading an MP3 with the title “Vacuuming My Floor.”
MP3s contain embedding information called ID3 tags which hold details about the song, such as the title, artist, and album name. The Echo uses the information in these ID3 tags to locate the correct song to play. For the proof-of-concept you see in the video above, I created 3 custom MP3s, one each for the Twitch, Flappy Birds, and Minecraft apps installed on my Fire TV. You can download these 3 MP3s here.
In the MP3’s TITLE ID3 tag, I entered the app’s name so that the Echo would, for example, find the Flappy Birds MP3 when I said “Alexa, start Flappy Birds.” When the Echo locates a song it responds with “[SONG TITLE] by [SONG ARTIST]” just before playing the song. I entered “Fire TV” in the MP3’s ARTIST ID3 tag because, if left empty, the Echo responds with “[SONG TITLE] by unknown”, which I didn’t think sounded as good as “[APP TITLE] by Fire TV”. In the MP3’s ALBUM ID3 tag field I entered the app’s package name and launch activity, which I’ll discuss in more detail below. As for the audio in the MP3 itself, it can be anything. Keep in mind that the MP3 will be played by the Echo once. I chose to use this confirmation beep sound effect:
With those 3 MP3’s uploaded to my Amazon Music Library, the Echo would now play them using the voice commands: “Alexa, start Twitch“, “Alexa, start Flappy Birds“, and “Alexa, start Minecraft“.
I then created an IFTTT recipe which appends the ALBUM name of all songs played by the Echo to a Dropbox file. Since I have Dropbox installed on my Mac, that file gets updated everytime the Echo plays a song. The details of the IFTTT recipe are as follows:
Now that there is a file on my Mac that gets updated whenever a song is played by the Echo, I can have my Mac monitor that file and launch the appropriate Fire TV app using the Android Developer Bridge (ADB) whenever the Dropbox file is updated. I used a Launch Daemon (launchd) to monitor the Dropbox file and execute an AppleScript whenever the file was updated. You can download my launchd property list file (plist) here. To use yourself, you’ll need to modify the path
To stop monitoring, simply run the terminal command:
The AppleScript which runs when the Dropbox file is updated is very rudimentary, and is one of the reasons why this procedure is not very practical in its current form. You can download my AppleScript here. The AppleScript executes the ADB shell command
This brings us back to the contents of the custom MP3 file’s ALBUM field. In order to launch an Android/Fire TV app via ADB, you need to know the app’s package name and launch activity. You can determine these two things using Android’s Asset Packaging Tool (appt) command line utility. An APKs package name and launch activity are listed when you run the following command:
For example, for the app Flappy Birds, the package name is
I chose to store the tail end of that command,
There are several caveats which make this procedure impractical in its current form. For starters, the AppleScript should be improved upon by having it control the ADB connection to the Fire TV. As it is now, an ADB connection between the Fire TV and the Mac must always be live for this to work. Additionally, the AppleScript should be updated to not execute shell commands when a real song is played by the Echo. My current proof-of-concept will run ADB shell commands every time the Echo plays a song. The delay between issuing a voice command and having the app launch could probably also be shortened by using a method other than Dropbox to relay instructions to the Mac. Hopefully, by the time I or someone else improves my implementation, Amazon will have released true Echo-to-Fire TV communication. I’d love to hear, in the comments below, what you think of this concept and what type of features you’d like from an Echo controlled Fire TV setup.
Fascinating concept! But for it to be practical for me, I’d want a voice command that’d change my AVRs input to the FireTV before anything else at all can happen. HDMI CEC is mostly unreliable.
I’ve actually got a Logitech Harmony Home Hub, hooked up to a lot of things including lights, audio/visual, etc. I am going to try this mp3 solution and have IFTTT launch preset items that I have on my Logitech Home hub. In theory it should be easy and effective. “Alexa Start SignOff” which will play an mp3 with some end of the night music (or sounds), and trigger the “Good Night” setting on my Harmony Device which dims all the lights to off, and shuts down all my active systems. :)
Using a PC, the Mac Instructions were a bit confusing. I did set up IFTTT to activate the “Goodnight” (shutdown) activity whenever a Echo plays a song, however it would be much better if the rule was song specific. :( I see you resolved that with a Mac, but I haven’t attempted all that with a PC.
How did you do the LaunchD & ApplScript portion of this with a PC? That’s where I’m stuck
Great idea Tom, I need to figure a way around the AVR issue as well. Hats off to both of you. I love the out of the box thinking.
I really hope and believe Amazon will continue to work on delivering a great ecosystem for the home. I have two Fire TVs and the Echo. I’m eagerly awaiting the day when I can tell Alexa (who is now in my bedroom) while I’m listening to a Pandora station “please play this music in the living room as well.” and have the Fire TV act as a audio repeater for the Echo.
It shows where the internet of things can take us and how ECHO can be a hub for such a home network. Lab126 had better be paying attention.
So the concept of Marty Mcfly turning on several tvs by voice command is actually true in 2015! Great Scott!
first my hat is off to you.
second could something like this work with the fire stick
The methods outlined in this post work on both the Fire TV and Fire TV Stick.
Great Job!!! Awesome proof-of-concept that’ll hopefully spur more development…
I have sent this feature request via ECHO feedback option and amazon responded saying that they are working on this feature.
It will be great if more number of people send this feedback request to the echo development team. That will make a point to them.
This is a great setup. I can think of hundreds of other things this could be used for. I am going to use it to turn on my gas fireplace. I have a wemo maker hook up to it.
I attended an Amazon Developer conference this weekend were the focus was on the Echo. Creating and getting apps out there will not be very difficult and I can see a lot of established developers connecting their applications to it.
I would be more interested in communication between echo’s. If my friend has one, I would like to be able to originate a voip conversation. This would be much more useful than telling Fire TV to play a movie. Fire TV has voice search commands already.
With IFTTT doesn’t it take about 15 minutes for the commands to be executed?
If so, what good is IFTTT for this project? To be helpful, it would have to be instant.
Although I do applaud the writer for the cobbled together method!
I don’t have a Mac!
The video at the top of this post is unedited and in real-time. The amount of time shown in the video from when a command is spoken to when the app launches is exactly what it is in the video.
I would rather have a line out capability. Rather with bluetooth in the opposite direction. Using the echo as the source of audio to broadcast via bluetooth to my receiver. Using the FireTV as a lineout of echo would also please me.
Echo is an awesome product! Congratulations AMAZON!
Looking at this it would actually be very easy to do using the Maker Channel.
I can’t think of a way without using the song name workaround you had.
But basically it would look like:
Alexa –> Maker (post, json with song name) –> web server –> adb commands
I have a spare raspberry pi sitting around that would probably be perfect to run a small webserver on that could control this. I might have to try and work this out this weekend and see what I can come up with.
If anyone is interested, I’ve made a more robust version inspired from this article. It skips IFTTT (lower latency), and provides some more advanced functionality (like search and play). Feel free to take a look: https://github.com/timothysoehnlin/AlexaMedia/
Hey Timothy, Im following your tutorial, but Im stuck at “Create Firebase Access”. Can you provide more details? Thanks!
There is a product Blumoo out now it does all this and more..
You could try home assistant, https://home-assistant.io/components/switch.command_line/, and share the switches using https://github.com/auchter/haaska to Alexa.
There is a nice video on how you can connect Home assistant with Alexa https://www.youtube.com/watch?v=zZuwQ9spPkQ
Then you could just say “Turn on Flappy Bird”, instead of going through soundcloud and ifttt.