Hey Alexa, Play Me A Movie!
About the project
An Amazon Echo, Netflix and Google Cast integration with a little bit of Android magic and IFTTT help.
Project info
Difficulty: Moderate
Platforms: Amazon Alexa, Android, IFTTT
Estimated time: 1 hour
License: MIT license (MIT)
Items used in this project
Hardware components
Story
In this project I will explore how we can play a movie from Alexa.
This time I wanted to create something useful for somebody else than me, so I thought about my kids.
Since every now and then I see them juggling remotes and navigating menus to watch a movie or the latest Stampy video (yes, we also ask them to lower the volume to zero or max 1 when doing so, if you know what I mean), then I wanted to have an easy way of doing so. And hey, there can be an Alexa skill for that.
Here is the plan:
- Use an IFTTT recipe as the trigger when we say the phrase "play me a movie"
- IFTTT then sends a pushbullet notification to an Android phone or tablet
- The Tasker app detects this, opens Netflix and casts a movie to a ChromeCast attached to the TV
What hardware is needed:
- an Amazon Echo
- an Android phone or tablet
- a Chromecast
- a TV with an HDMI input
Let's get going and build this.
The IFTTT recipe
You can find the public recipe here. You will need the Alexa and the Pushbullet channels for this.
Here's the recipe:
IFTTT links Alexa and the phoneThe Android setup
In your Android phone or tablet, you'll need these apps installed:
1- NETFLIX
Open the Netflix app and login in your account. That's it.
2- TASKER AND AUTOINPUT
Heads up: Tasker is far from easy to setup, but I think it totally compensates this complexity with the power it offers.
Neither Tasker not Autoinput are free, however they offer a 7 day trial. More than enough time for trying this out before a long term commitment. Don't worry, after that it's going to be less than 10 bucks for the combo.
Once both apps are installed, continue to the following section.
Configuring Tasker
In Tasker we need to create a task and a profile.
The Tasker task will be in charge of automating the taps a person will need to do in order to open the Netflix app, select a Chromecast to cast to, and select the movie to play.
The Tasker profile will be the trigger that will start the Tasker task, and hence, start casting the movie to the TV.
Since there is a profile to task dependency, we'll start creating the task.
1- CREATE THE TASKER TASK
Let's create the task. This will be a rather complex task that will contain many steps (or actions, in Tasker speak).
1a- ACTION 1: open Netflix
- open Tasker and create a new task called "Netflix"
- add an action -> app -> launch app -> Netflix
- add an action -> task -> wait -> make it wait for 2 or 3 seconds, or more if you have a slow phone. I have a Nexus 5 and one second seems more than enough
1b- ACTION 2: Google cast to TV
- add an action -> plugin -> autoinput -> action
- tap on the modify Configuration (the pen at the far right)
- tap on Easy Setup -> this adds a notification in the notification bar and waits there for further instructions
- open Netflix
- drag down the Android notification bar and hit the AutoInput Selecting Field -> ADD button
- now AutoInput (Tasker) is waiting for you to tell it what to do
- tap on the Netflix CAST icon -> this tells AutoInput that you want it to tap on it when the task gets triggered
- select Accept in the Tasker notification that comes down from your notification bar
- select Tasker in your list of open apps
- select the first option in the popup that shows up
- select Action to perform: Click
- tap on the checkmark at the top right corner to accept the new autoInput action
- this brings you back to Tasker -> hit on the back button to save your new action
This action aims at automating the opening of the cast menu. Once the menu is open, you need to tell Tasker to select the Chromecast you want to stream to.
So now, repeat all the steps above to create the click on the Chromecast you want to cast your movie to.
Note: the way Tasker saves your newly created task is by you hitting on the back button, so don't forget to do it! This mistake set me back around half an hour of work. Not cool.
1c- ACTION 3: Play a movie
- add an action -> plugin -> autoinput -> action
- tap on the modify Configuration (the pen at the far right)
- tap on Easy Setup
- open Netflix
- drag down the Android notifications bar and hit the AutoInput Selecting Field -> ADD button
- now AutoInput is waiting for you to tell it what to do
- tap on the first movie you see
- select Accept in the Tasker notification that comes down from your notification bar
- select Tasker in your list of open apps
- select the first option in the popup menu that shows up
- select Action to perform: Click
- tap on the checkmark at the top right corner
- this brings you back to the Tasker action -> hit on the back button to save your new action
2- CREATE THE TASKER PROFILE
The Tasker profile is the missing link of all this. The Tasker profile will detect the reception of the Pushbullet notification and trigger the Netflix task we created in the previous section. Open Tasker and:
- create a new Profile
- select Event -> UI -> notification
- tap on the owner application icon (a rocket?) and select Pushbullet
- hit back to save the profile
Here is how all this looks in Tasker:
; ; 1 / 3 • Tasker profileImprovements
This was my first try on playing a movie from the Amazon Echo.
Future plans may include:
- telling the Amazon Echo what movie or show to play
- detecting if the pushbullet notification is coming from the Amazon Echo
Source material
I will list here the places where I read stuff while creating this project:
Conclusion
You can now say "Alexa, trigger play me a movie" and few seconds after a movie will start playing in your TV.
Enjoy,
Gustavo.
Help
If you require professional help with your projects, don't hesitate to write me a line about your needs at gusgonnet@gmail.com. Thank you!
Leave your feedback...