Allows Amazon Alexa to control Google Chromecast
Alexa, tell chromecast to pause
Alexa, tell chromecast to play
Alexa, tell chromecast to play MKBHD
Alexa, tell chromecast to play The Big Lebowski trailer
Alexa, tell chromecast to set the volume to 5
Alexa, tell chromecast to stop
Installation requires a UNIX environment with:
- BASH
- Python 2.7
- PIP
- Create an Amazon Web Services account
- Run aws-setup.sh to create a Role, Lambda Function, and SNS Topic. (It will run
aws configure
, so have an key id and access key ready) - Go to developer.amazon.com and create a Skill mapped to the Lambda function ARN, intentSchemas and sample utterances are in
config/
. - Run src/local/main.py with the AWS_SNS_TOPIC_ARN and CHROMECAST_NAME environment variables.
- Ask Alexa to tell Chromecast to do something.
AWS_SNS_TOPIC_ARN=something CHROMECAST_NAME=Living\ Room ./src/local/main.py
The skill subscriber can be run with docker:
docker run --network="host" -it -e 'AWS_ACCESS_KEY_ID=...' -e 'AWS_SECRET_ACCESS_KEY=...' -e 'AWS_DEFAULT_REGION=...' -e 'AWS_SNS_TOPIC_ARN=...' lukechannings/alexa-skill-chromecast
The skill subscriber (local) uses these environment variables:
-
AWS_SNS_TOPIC_ARN - AWS SNS Topic ARN (can be found in the
.env
file after runningaws-setup.sh
) -
CHROMECAST_NAME - Friendly name of the Chromecast to send commands to. (Defaults to 'Living Room')
-
PORT - (Optional) Externally accessible port to expose the SNS handler on.
-
AWS_ACCESS_KEY_ID - AWS User Access Key
-
AWS_SECRET_ACCESS_KEY - AWS Secret Access Key
-
AWS_DEFAULT_REGION - AWS Lambda and SNS Region (e.g. eu-west-1)
If you have run aws configure
, you will not need to set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, or AWS_DEFAULT_REGION.
Alexa skills run in the cloud, but this skill needs to be on your local network to control the Chromecast. This skill implements a hybrid approach: the command is handled by Alexa on AWS, which sends a notification to your local server.
Alexa -> AWS Lambda -> AWS SNS (Simple Notification Service) -> Local server
The Lambda component is in src/lambda
, and the local component is in src/local
.
Sets up an AWS environment for the Alexa Skil:
- Creates an IAM role for Alexa (with permissions for SNS)
- Creates an SNS topic to communicate over
- Creates a Lambda function
Creates a lambda-bundle.zip, which can be uploaded to an AWS Lambda function.
Runs build-lambda-bundle and automatically uploads the bundle to AWS Lambda.