Giter VIP home page Giter VIP logo

alexa-chromecast-skill-2.0's Introduction

🇪🇸 Español

Alexa Chromecast Skill

Allows Amazon Alexa to control Google Chromecast

This skill supports controlling a single Chromecast or multiple Chromecasts in different rooms. Each Alexa device can be set to control a different room. This is done by matching the room name to your Chromecast device's name. E.g. If your Chromecast is named: "Master Bedroom TV", then set the Alexa room to control to "Master Bedroom"

The following will then pause the Chromecast in the Master Bedroom:

Alexa, ask Chromecast to pause

You can control another room by saying something like:

Alexa, ask the Chromecast to pause in the Media Room

To change the room a particular Alexa device controls you can say:

Alexa, ask the Chromecast to set the room

Here are some example voice commands:

Alexa, tell Chromecast to play

Alexa, tell Chromecast to play songs by Macklemore

Alexa, tell Chromecast to play maroon 5 playlist

Alexa, tell Chromecast to play The Matrix trailer

Alexa, tell Chromecast to set the volume to 5

Alexa, tell Chromecast to stop

Or:

Alexa, ask the Chromecast in the Media Room to stop

Alexa, ask the Chromecast to play in the Media Room

How it works

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.

The Lambda component is in src/lambda, and the local component is in src/local.

Architecture Overview

Both the Chromecast and the Raspberry Pi (or whatever the local notification handler will run on) MUST be on the same network in order for the Chromecast to be discoverable.

Dependencies

Installation requires a UNIX environment with:

  • BASH
  • Python 3.7
  • Pip

Setup and installation

Build the AWS Lambda Function

  1. Create an Amazon Web Services account
  2. 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)

Setup the Alexa Skill

  1. Go to ASK Console and choose "Create Skill"
  2. Select "Custom" and "Provision your own", then click "Create skill". On the template screen just use the "Hello World Skill" template
  3. Click on "Interaction Model" in the left menu, then "JSON Editor"
  4. Copy and paste the content from config/interaction_model.json into the editor, then click "Save Model"
  5. Click on "Endpoint" in the left menu. Enter the Lambda function ARN by the aws-setup.sh. Click "Save Endpoints"
  6. Click on "Invocation" in the left menu. Click on "Build Model"
  7. Click on the "Test" tab. Enter

Install the local application which control the Chromecasts

  1. Install local dependencies with sudo pip3 install -r ./src/local/requirements.txt
  2. Run ./start.sh to start the listener, or ./docker-start.sh to run in an interactive docker session. Or ./docker-start.sh -d to run as a service. The service attempts to AWS SNS using UPNP. If UPNP is disabled in your network you can specify a port. ./start.sh -p 30000 To see other options run ./start.sh -h or ./docker-start.sh -h.

When run you should see something like the following:

2020-07-12 11:10:40,688 - root - INFO - Starting Alexa Chromecast listener...
2020-07-12 11:10:40,688 - local.ChromecastSkill - INFO - Finding Chromecasts...
2020-07-12 11:10:45,696 - pychromecast - INFO - Querying device status
2020-07-12 11:10:45,727 - pychromecast - INFO - Querying device status
2020-07-12 11:10:45,767 - local.ChromecastSkill - INFO - Found Media Room TV
2020-07-12 11:10:45,768 - local.ChromecastSkill - INFO - Found Living Room TV
2020-07-12 11:10:45,769 - local.ChromecastSkill - INFO - 2 Chromecasts found
2020-07-12 11:10:45,809 - botocore.credentials - INFO - Found credentials in environment variables.
2020-07-12 11:10:46,967 - local.SkillSubscriber - INFO - Listening on http://123.123.123.123:30000
2020-07-12 11:10:46,968 - local.SkillSubscriber - INFO - Subscribing for Alexa commands...
2020-07-12 11:10:47,344 - local.SkillSubscriber - INFO - Received subscription confirmation...
2020-07-12 11:10:47,431 - local.SkillSubscriber - INFO - Subscribed.

Finally

  1. Say "Alexa ask Chromecast to play" The skill will take you through any required room setup.

Shell example

./start.sh

Docker

The skill subscriber can be run with docker:

./docker-start.sh - for an interactive session ./docker-start.sh -d - to run as a service

Environment variables

The skill subscriber (local) uses these environment variables:

  • AWS_SNS_TOPIC_ARN - AWS SNS Topic ARN (can be found in the .env file after running aws-setup.sh)
  • 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.

Scripts

aws-setup.sh

Sets up an AWS environment for the Alexa Skill:

  1. Creates an IAM role for Alexa (with permissions for SNS)
  2. Creates an SNS topic to communicate over
  3. Creates an S3 persistent store for persisting the room to Alexa device mapping
  4. Creates a Lambda function

build-lambda-bundle.sh

Creates a lambda-bundle.zip, which can be uploaded to an AWS Lambda function.

aws-update-lambda.sh

Runs build-lambda-bundle and automatically uploads the bundle to AWS Lambda.

FAQ

"No Chromecasts found"

When the local service starts it searches for Chromecasts on the network. If there are no ChromeCasts found, it will exit. To fix this, you must confirm that the Chromecast is on and working, make sure you can access it from your phone, and make sure that everything is on the same network. To debug, a tool to search and list found ChomeCasts is provided at ./search-chromecasts (make sure to make it executable with chmod +x ./search-chromecasts).

Local listener fails to subscribe

If the local listener fails to subscribe (no subscribe messages or an error) then the Chromecasts won't receive commands from Alexa By default the local listener uses UPNP and a dynamic port to establish an external connection, you can override this if required.

  1. Check UPNP is enabled/allowed on your network
  2. If UPNP is not enabled or working try and manually specify a port, and ensure your firewall/router is configured to allow external access to this port e.g. to use port 30000 run ./start.sh -p 30000 or ./docker-start.sh -p 30000
  3. Log into the AWS console and check the SNS topic is setup, and check the Cloud Watch logs for your the lambda function for any errors.

Alexa had an error launching the skill or processing a command

  1. Try redeploying the lambda skill. ./aws-update-lambda.sh
  2. If that didn't work go to the AWS Console and check the CloudWatch logs associated with the lambda function

Alexa accepted the command but it didn't seem to work

  1. Check the local listener output, it should show the received command and any error that was encountered
  2. To check the docker service logs run something like docker logs alexa_chromecast --since=30m, which shows the logs for the last 30 minutes

alexa-chromecast-skill-2.0's People

Contributors

andrewmacheret avatar cristian44137 avatar dependabot[bot] avatar jinxo13 avatar lukechannings avatar pizzaface avatar rafiahmad80 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alexa-chromecast-skill-2.0's Issues

./start.sh Issue

I am using an Ubuntu virtual machine and I did it all until finally reaching the point where i executed: ./start.sh
My Chromecast name is 'Living Room' and This is what i got:
Traceback (most recent call last):
File "./src/local/main.py", line 22, in
chromecast_skill = Skill(chromecast_name=os.getenv('CHROMECAST_NAME', 'Livin g Room'))
File "/home/yanaymiz/alexaskill/alexa/src/local/ChromecastSkill.py", line 11, in init
self.cast = next(cc for cc in chromecasts if cc.device.friendly_name == chro mecast_name)
StopIteration
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/usr/local/lib/python2.7/dist-packages/pychromecast/socket_client.py", l ine 336, in run
File "/usr/lib/python2.7/logging/init.py", line 1636, in debug
File "/usr/lib/python2.7/logging/init.py", line 1541, in basicConfig
<type 'exceptions.TypeError'>: 'NoneType' object is not callable

What should i do?

./start.sh not working

When i run ./start.sh I get

2021-12-17 12:29:59,518 - root - INFO - Starting Alexa Chromecast listener...
2021-12-17 12:29:59,519 - local.ChromecastSkill - INFO - Finding Chromecasts...
2021-12-17 12:30:04,521 - pychromecast - INFO - Querying device status
2021-12-17 12:30:04,537 - local.ChromecastSkill - INFO - Found Dining Room TV
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/tzvi/Documents/Alexa-Chromecast-Skill-2.0/src/local/main.py", line 40, in
chromecast_skill = Skill()
File "/home/tzvi/Documents/Alexa-Chromecast-Skill-2.0/src/local/ChromecastSkill.py", line 133, in init
self.chromecast_controller = ChromecastState()
File "/home/tzvi/Documents/Alexa-Chromecast-Skill-2.0/src/local/ChromecastSkill.py", line 113, in init
self.__set_chromecasts()
File "/home/tzvi/Documents/Alexa-Chromecast-Skill-2.0/src/local/ChromecastSkill.py", line 98, in __set_chromecasts
cc.wait()
File "/usr/local/lib/python3.9/dist-packages/pychromecast/init.py", line 446, in wait
if not self.socket_client.isAlive():
AttributeError: 'SocketClient' object has no attribute 'isAlive'

When i ran
aws-setup.sh
I wasn't asked for credentials, and I thought it was because my computer has it configured from before, is that the issue?

although I doubt it because when I ran that command I got

./aws-setup.sh
Creating AmazonAlexaSkill role.
Creating AlexaChromecastSkillCommands topic.
Creating alexa-user-persistence-tschams.
Creating AlexaChromecastSkill lambda function.
Building Lambda bundle.
Copying files to lambda-build ...
Running pip install ...
Collecting ask-sdk-s3-persistence-adapter==1.0.0
Using cached ask_sdk_s3_persistence_adapter-1.0.0-py2.py3-none-any.whl (6.6 kB)
Collecting boto3==1.14.8
Using cached boto3-1.14.8-py2.py3-none-any.whl (128 kB)
Collecting ask-sdk-core==1.13.0
Using cached ask_sdk_core-1.13.0-py2.py3-none-any.whl (45 kB)
Collecting botocore==1.17.8
Using cached botocore-1.17.8-py2.py3-none-any.whl (6.3 MB)
Collecting requests==2.24.0
Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting ask-sdk-runtime>=1.1.0
Using cached ask_sdk_runtime-1.16.1-py2.py3-none-any.whl (25 kB)
Collecting ask-sdk-model>=1.0.0
Using cached ask_sdk_model-1.33.0-py2.py3-none-any.whl (937 kB)
Collecting python-dateutil
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting s3transfer<0.4.0,>=0.3.0
Using cached s3transfer-0.3.7-py2.py3-none-any.whl (73 kB)
Collecting jmespath<1.0.0,>=0.7.1
Using cached jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting urllib3<1.26,>=1.20
Using cached urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
Collecting docutils<0.16,>=0.10
Using cached docutils-0.15.2-py3-none-any.whl (547 kB)
Collecting chardet<4,>=3.0.2
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna<3,>=2.5
Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting six>=1.10
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, urllib3, python-dateutil, jmespath, docutils, idna, chardet, certifi, botocore, s3transfer, requests, ask-sdk-runtime, ask-sdk-model, boto3, ask-sdk-core, ask-sdk-s3-persistence-adapter
Successfully installed ask-sdk-core-1.13.0 ask-sdk-model-1.33.0 ask-sdk-runtime-1.16.1 ask-sdk-s3-persistence-adapter-1.0.0 boto3-1.14.8 botocore-1.17.8 certifi-2021.10.8 chardet-3.0.4 docutils-0.15.2 idna-2.10 jmespath-0.10.0 python-dateutil-2.8.2 requests-2.24.0 s3transfer-0.3.7 six-1.16.0 urllib3-1.25.11
Zipping files ...
Cleaning up ...
{
"FunctionName": "AlexaChromecastSkill",
"FunctionArn": "arn:aws:lambda:us-east-2:307277980090:function:AlexaChromecastSkill",
"Runtime": "python3.7",
"Role": "arn:aws:iam::307277980090:role/AmazonAlexaSkill",
"Handler": "lambda_function.main.lambda_handler",
"CodeSize": 11824675,
"Description": "",
"Timeout": 3,
"MemorySize": 128,
"LastModified": "2021-12-17T20:37:14.000+0000",
"CodeSha256": "KLysRVqtu5mYCC5gUEwqkgw9H4vUOHBEJn2Q+jZoNJ8=",
"Version": "$LATEST",
"Environment": {
"Variables": {
"AWS_S3_BUCKET": "alexa-user-persistence-tschams",
"AWS_SNS_ARN": "arn:aws:sns:us-east-2:307277980090:AlexaChromecastSkillCommands"
}
},
"TracingConfig": {
"Mode": "PassThrough"
},
"RevisionId": "31459a68-3c32-458d-bb36-bb6697813f3e",
"State": "Active",
"LastUpdateStatus": "InProgress",
"LastUpdateStatusReason": "The function is being created.",
"LastUpdateStatusReasonCode": "Creating",
"Architectures": [
"x86_64"
]
}
{
"Statement": "{"Sid":"1","Effect":"Allow","Principal":{"Service":"alexa-appkit.amazon.com"},"Action":"lambda:invokeFunction","Resource":"arn:aws:lambda:us-east-2:307277980090:function:AlexaChromecastSkill"}"
}
Done!

Next, go to https://developer.amazon.com/edw/home.html#/skills/list and create an Alexa Skill.
Lambda function ARN: arn:aws:lambda:us-east-2:307277980090:function:AlexaChromecastSkill

Then run the local handler.
SNS Topic ARN: arn:aws:sns:us-east-2:307277980090:AlexaChromecastSkillCommands

Failed to automatically forward Port

When trying to Start the RaspberryPi Endpoint the Following Error occurs:

sudo bash start.sh

                    Failed to automatically forward port.
                    Please set port as an environment variable and forward manually.

How should i set the Port.
I can't find any place on the raspberry where i can set the env variable.

Thanks

Where do videos pull from?

I had a fun time getting this to work last night and got to learn about some AWS services which was pretty cool. The control functions are working just fine but I am curious where the play video searches for video files. Is it looking locally for UPNP sources or at something else? Currently I use plex to stream all my videos and hoping it can be integrated but we'll see.

FR: Stream Sykpe call to Chromecast

We are looking into get work a Videocall over TV, but it seems like hell.

There is now Skype Skill for Alexa which is working with Dot and Echo Show. But we have to work with older people and would like to stream this calls to the TV because the TV is much bigger.
There is really nothing well working on the market and it is very strange that Amazon does not support move the VideoCall to FireTV.

So my question is, as you are really experienced with Alexa and Chromecast,

isn't there a way we can stream the Alexa Skype Call (only the video part) from our Echo Show to Chromecast?
What do you think?

Error when i try to run /aws-setup.sh

jonasrafael@Jonass-MacBook-Pro Alexa-Chromecast-Skill-2.0-master 2 % ./aws-setup.sh          
Creating AmazonAlexaSkill role.

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: 2/config/aws-lambda-role-policy.json
jonasrafael@Jonass-MacBook-Pro Alexa-Chromecast-Skill-2.0-master 2 % 

aws-setup.sh crashes on #!/usr/bin/bash -e

On my pi B+ running raspbian, all .sh script immediately crash on the first line with the error

/usr/bin/env: bash -e: No such file or directory

Changing the first line to:
#!/usr/bin/env: bash
set -e
fixes the issue

No chromecast found

Installed as per instructions, and on launching ./start.sh I'm presented with no chromecasts found.

The skill shows in my app on android and responds with everything but does not stream, because it can't find a chromecast?

Skill still working? Multidevice possible?

Hi,
is this skill still working?
I have multiple Chromecast Audio in different rooms, and set up some multiroom-groups in google home as well. When I am at home, I can see all devices/groups in spotify-app and amazon-music-app.
Is this supported as well and how can I configure all devices and multiroom-groups?
Thanks a lot.
Meia

Help for install on Synology NAS with Docker

Hi
first of all, thank you so much for this solution. But i dont figured out how you skill in combination with my Synology Nas DS216+II and my Amazon Echo Plus + Docker Container.

Can you make a simple guide - step by step install on a NAS with docker?

Thank you and sorry for my simple english skills ;)

Netflix

Does this Skill support Netflix casting like a Google Home device would do?

Installing Dependencies

Hi, I am getting stuck on Step 4 installing the local dependencies.

When I enter "sudo pip install -r ./src/local/requirements.txt" I get the following error.

File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-WU06KS/miniupnpc/setup.py", line 20, in run
        subprocess.check_call([os.environ.get('MAKE', 'make')] + EXT)
      File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['make', 'libminiupnpc.a']' returned non-zero exit status 2
    
    ----------------------------------------
Command "/usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-WU06KS/miniupnpc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-mAluUX-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-WU06KS/miniupnpc/

I tried then to install setuptools via "pip install -U setuptools" but I got the following.

Collecting setuptools
  Using cached setuptools-36.4.0-py2.py3-none-any.whl
Installing collected packages: setuptools
  Found existing installation: setuptools 12.2
    Uninstalling setuptools-12.2:
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib64/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/bin/easy_install'

Any idea what might be happening?

Skill works using Alexa Test Simulator (Beta), but not from echo dot

Hi, just like the title says.

I have everything configured as per the video. When I run /start.sh I can see the SNS subscription confirmed and the listener started and I can access the listener from the outside.
When I issue a command using the Alexa Test Simulator (Beta), it works:

If I type "Alexa, ask chromecast to play", then the chromecast plays and I can see "Play command sent to Chromecast." in the terminal.

However, when I speak to the echo dot in my living room, nothing happens.
I have the skill enabled in my Alexa app on my mobile phone.

What am I doing wrong?

[Question] Necessity of MySQL?

Update
I keep getting indentation errors in my AWS Lambda console.


Hi,
Love the concept, I am trying it out right now as I am writing this doubt.

Instead of a raspberry pi, I've set everything on my old spare phone.
This obviously means, I have to be really careful with and optimize my resources.

I wanted to ask you if there is a reason for using MySQL.
What is the need? And can the same thing not be achieved by keeping commands in memory?

Probably assigning each command / skill request a unique ID and resolving it later when the Youtube API replies?

Thanks.

issue with build.sql

Got some error while importing that AUTO_INCREMENT can only be done on keys. I assigned proper primary key to the table.

CREATE TABLE IF NOT EXISTS commands (
ID int(11) NOT NULL PRIMARY KEY,
...
...
ALTER TABLE commands
MODIFY ID int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,AUTO_INCREMENT=149;

Use of AMAZON.LITERAL is deprecated

Amazon has deprecated use of AMAZON.LITERAL and you wont be able to save new or update skills that use it after 02/06/2017. More details here:

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/migrating-to-the-improved-built-in-and-custom-slot-types

I would guess you could probably make use of the new built-in intents they've come out with to replace some of the ones you've defined on your own:

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/built-in-intent-library#video

dbConnect() - NameError: global name 'db' is not defined`

I've got everything setup, however when I run: python raspberry.py my server returns

Found ChromeCast: ['Vegeta', 'Krypton', 'Terran']
Traceback (most recent call last):
    File "raspberry.py", line 147, in <module>
        dbConnect()
    File "raspberry.py", line 111, in dbConnect
            cur = db.cursor()
NameError: global name 'db' is not defined`

This is screenshot of my current raspberry.py, any idea what I'm doing wrong?

(Also has anyone else noticed that Alexa is more responsive (noticing the Chromecast when #/usr/bin/env python is in the code?)

Additional info:


If I commit the name of my database "chromey" to lines 109-112:

    "def dbConnect(chromey):
        #Set's up the connection to run commands
        cur = db.cursor(chromey.db)

it returns:

    Found ChromeCast: ['Krypton', 'Vegeta', 'Terran']
            Traceback (most recent call last):
                File "raspberry.py", line 148, in <module>
                dbConnect()
         TypeError: dbConnect() takes exactly 1 argument (0 given)

In addition, if i commit the database name "chromey" into lines 148:

       #Loops Continuously to get new commands.
            while True:
                dbConnect(chromey)
                time.sleep(2)

It returns this error:

       Found ChromeCast: ['Krypton', 'Vegeta', 'Terran']
       Traceback (most recent call last):
                    File "raspberry.py", line 148, in <module>
                      dbConnect(chromey)
       NameError: name 'chromey' is not defined

Python3:


If I specify python3 raspberry.py it returns this:

       File "raspberry.py", line 143
            cur.execute("DELETE FROM commands WHERE id=" + str(idOfQuert))
                                                                                                               ^
       TabError: inconsistent use of tabs and spaces in indentation

Any ideas? Perhaps it's the dbConnect?

Files not found

Apologies if I'm using the site features wrong by logging an issue, but it looks like I'm missing a very basic first step on this as the initial step errors out most lines. I set up an alexa to kodi install earlier and thought this would be a nice second challenge, but this one may be over my current expertise. Current issue: http://imgur.com/a/NtEBX

Let me know if you have thoughts on how to get around this; the steps seem to make enough sense but it's not asking me for input of aws keys or anything. Not sure what I'm missing. Thanks!

install

Would anyone be willing to help me install please ive tried for 3 days and im getting no where

Thank you

Casting results only in blue Cast icon on TV display

After all installation and setup, the cast worked perfectly for most of the videos through alexa. But when i killed the start.sh using Cnrl+C and tried running start.sh again, it start giving lots of python errors in some lines in many of the files. When i googled those errors, i was asked in one of the forum to upgrade youtube-dl package to the newest one. I did that.

Afterwards, when i asked alexa to play something on chromecast, Alexa finds the video and on my command prompt, i see the youtube url for video and audio showing up. There is absolutely no error message. My TV chromecast also tried to load it. There is a blue bar goes from left to right but shows a blue chromecast icon in the middle. And this is where it gets stuck. The video/ audio not playing anymore.

I can play video on my TV chromecast using my phone and table just fine.

My OS is raspbian, on raspberry pi 3.

Please let me know, how to fix it.

Some help with the Alexa skill please?

Hi, I think i'm most of the way there with getting this running on my Synology NAS, here is the output of start.sh:

2020-08-26 19:35:57,855 - root - INFO - Starting Alexa Chromecast listener...
2020-08-26 19:35:57,909 - local.ChromecastSkill - INFO - Finding Chromecasts...
2020-08-26 19:36:02,940 - pychromecast - INFO - Querying device status
2020-08-26 19:36:03,020 - local.ChromecastSkill - INFO - Found ChromecastLounge
2020-08-26 19:36:03,154 - local.ChromecastSkill - INFO - 1 Chromecasts found
2020-08-26 19:36:03,170 - local.ChromecastSkill - DEBUG - Received: protocol_version: CASTV2_1_0
source_id: "f8996ece-a3fd-483b-ac73-c77299780bd5"
destination_id: "sender-0"
namespace: "urn:x-cast:com.google.youtube.mdx"
payload_type: STRING
payload_utf8: "{"type":"mdxSessionStatus","data":{"screenId":"5mgnrg6lb54ai0kat2h3cpktm","deviceId":"ef689480-200a-45ee-a57a-618f67a47115"}}"
{'type': 'mdxSessionStatus', 'data': {'screenId': '5mgnrg6lb54ai0kat2h3cpktm', 'deviceId': 'ef689480-200a-45ee-a57a-618f67a47115'}}
2020-08-26 19:36:03,644 - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2020-08-26 19:36:05,481 - local.SkillSubscriber - INFO - Listening on http://:55012
2020-08-26 19:36:05,495 - local.SkillSubscriber - INFO - Subscribing for Alexa commands...
2020-08-26 19:36:05,921 - local.SkillSubscriber - INFO - Received subscription confirmation...
2020-08-26 19:36:06,037 - local.SkillSubscriber - INFO - Subscribed.

Note that I removed my IP from the logs above.

The problem is Alexa doesn't understand the commands and simply says "hmm, i don't know that". I feel like I should be adding the skill to the devices in my home somehow, but not sure how to do that? I'm not seeing any Lambda logs or local listener outputs when I talk to my Echo device so that what is leading me to think I need to have it learn the skill somehow?

Instruction suggestions

In going through the skill creation a lot of errors were thrown that weren't mention in the instructions. Specifically consider adding:
-Instructions on custom slot type - had to dig around commits to see YouTube needed a custom slot
-Movie didn't have any custom slot file like YouTube did, I had to make one up to get through prompts

Proper instructions please

This step in particular:

Go to developer.amazon.com and create a Skill mapped to the Lambda function ARN, intentSchemas and sample utterances are in config/.

Could you please elaborate? I don't want to spend my evening backwards engineering the code to figure out how to use it. I appreciate the hard work, but without proper instructions this likely won't go very far.

YouTube Music / Spotify

Hey There!

Amazing skill.

A google home however can cast YouTube Music.

This is different to regular YouTube. It’s Google’s new music service to replace Google Play Music.

Do you think you could enhance your skill to slow playing of music?

“Alexa ask chromecast to play songs by Twenty One Pilots” for example

Or

“Alexa ask chromecast to play EDM music”

And then it casts music from YouTube Music?

(I suppose some people may want Spotify instead but I personally use YouTube Music, plus, you already have some YouTube code worked out)

Thank you so much!

Lambda Function Issue

I'm trying to install this skill for 3 days and I'm just getting errors and fixing them but now i'm stuck on this

When I'm running aws-setup.sh

it says

Creating AmazonAlexaSkill role.
Creating AlexaChromecastSkillCommands topic.
Creating AlexaChromecastSkill lambda function.
/usr/bin/env: bash -e: No such file or directory

I don't know what is the problem here

Error when creating Bucket, Bucket name already used.

When running aws-setup.sh I get the following error:

An error occurred (BucketAlreadyExists) when calling the CreateBucket operation: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.

main.py will not run, regardless of environment variables

I've been trying for an hour now, but main.py absolutely refuses to run regardless of what I do.

I ran aws-setup.sh, everything went fine save for a small issue with the lambda compile and having to add a sleep before running the lambda command. Once it was compiled this eventually ran without issue, and correctly set up AWS.

I then created the skill, though I had to delete the MOVIE definitions because it threw errors relating to them not existing. I think it's due to there not being MOVIE in customSlotTypes.txt.

I then added AWS_SNS_TOPIC_ARN and CHROMECAST_NAME to the environment variables as described. My chromecast is called "Kitchen", so this is what the variable is set to, and is what was used during aws-setup.sh

When trying to run main.py, I get the following error;

Traceback (most recent call last): File "./src/local/main.py", line 22, in <module> chromecast_skill = Skill(chromecast_name=os.getenv('CHROMECAST_NAME', 'Living Room')) File "/home/scotty/Source/AlexaChromecast/Alexa-Chromecast-Skill-2.0-master/src/local/ChromecastSkill.py", line 10, in __init__ self.cast = next(cc for cc in chromecasts if cc.device.friendly_name == chromecast_name) StopIteration

I tried changing 'Living Room' inside main.py to 'Kitchen' to see if that would help, and got the following error;

Traceback (most recent call last): File "./src/local/main.py", line 23, in <module> Subscriber({'chromecast': chromecast_skill}, PORT) File "/home/scotty/Source/AlexaChromecast/Alexa-Chromecast-Skill-2.0-master/src/local/SkillSubscriber.py", line 56, in __init__ endpoint_url = 'http://{}:{}'.format(self.get_external_ip(), port) File "/home/scotty/Source/AlexaChromecast/Alexa-Chromecast-Skill-2.0-master/src/local/SkillSubscriber.py", line 72, in get_external_ip return get('https://api.ipify.org').text File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 69, in get return request('get', url, params=params, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 50, in request response = session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 370, in send timeout=timeout File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 544, in urlopen body=body, headers=headers) File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 344, in _make_request self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 314, in _raise_timeout if 'timed out' in str(err) or 'did not complete (read)' in str(err): # Python 2.6 TypeError: __str__ returned non-string (type Error)

Any advice?
Thanks

UnicodeDecodeError when running aws-setup.sh

When running aws-setup.sh following Error occurs:

Creating AmazonAlexaSkill role.

Traceback (most recent call last):
  File "/usr/local/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/usr/local/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 56, in main
    return driver.main()
  File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 227, in main
    err.write(six.text_type(e))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 39: ordinal not in range(128)

I configured AWS for region eu-central-1 and json as output format.
Any solutions or workarounds ?

New skill json

Skill config seems to be not updated, please advise new config

Certain videos don't work

Certain youtube videos don't work. Not 100% sure what might be causing it, but here is an example:

"Alexa Tell Chromecast to Play Single Ladies"

This references the following youtube video:
https://www.youtube.com/watch?v=4m1EFMoRFvY

I can see that the skill spawns the following:
/usr/bin/python2 /usr/sbin/youtube-dl -g --no-check-certificate -- 4m1EFMoRFvY

After that process is complete, I see the following python exception:

ERROR: Signature extraction failed: Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/youtube_dl/extractor/youtube.py", line 1035, in _decrypt_signature
    video_id, player_url, s
   File "/usr/lib/python2.7/site-packages/youtube_dl/extractor/youtube.py", line 927, in _extract_signature_function
     raise ExtractorError('Cannot identify player %r' % player_url)
 ExtractorError: Cannot identify player u'/yts/jsbin/player-vflN55NZo/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl
  (caused by ExtractorError(u"Cannot identify player u'/yts/jsbin/player-vflN55NZo/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see

I did try doing a pip2 --update youtube_dl to the latest version -- 2017.07.30.1, however that version does spawn a chromecast video playback instance, but nothing actually plays (including videos that previously played properly).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.