Kodi Community Forum
Release Kanzi: Amazon Alexa skill for Kodi - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: Release Kanzi: Amazon Alexa skill for Kodi (/showthread.php?tid=254502)



RE: Amazon Echo skill for Kodi - jingai - 2017-08-31

I'm not sure, but I'd probably try deleting the venv and recreating it first.


RE: Amazon Echo skill for Kodi - simon_rb - 2017-08-31

(2017-08-31, 00:57)jingai Wrote: I'm not sure, but I'd probably try deleting the venv and recreating it first.

I'm currently trying it on another pi Wink


RE: Amazon Echo skill for Kodi - simon_rb - 2017-08-31

Halted at the same point on another pi

Code:
Requirement already satisfied: docutils>=0.12 in /usr/local/lib/python2.7/dist-packages (from zappa)
Collecting lambda-packages==0.16.1 (from zappa)
  Downloading lambda_packages-0.16.1.tar.gz (59.2MB)
    99% |████████████████████████████████| 59.1MB 167kB/s eta 0:00:01Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 821, in unpack_url
    hashes=hashes
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 659, in unpack_http_url
    hashes)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/utils/hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 571, in written_chunks
    for chunk in chunks:
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/utils/ui.py", line 139, in iter
    for x in it:
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 560, in resp_read
    decode_content=False):
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/response.py", line 314, in read
    data = self._fp.read(amt)
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/cachecontrol/filewrapper.py", line 63, in read
    self._close()
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/cachecontrol/filewrapper.py", line 50, in _close
    self.__callback(self.__buf.getvalue())
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/cachecontrol/controller.py", line 275, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/cachecontrol/serialize.py", line 55, in dumps
    "body": _b64_encode_bytes(body),
  File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/cachecontrol/serialize.py", line 12, in _b64_encode_bytes
    return base64.b64encode(b).decode("ascii")
MemoryError
(venv) pi@raspberrypi:~/kodi-alexa $

Update:- Turns out its a PIP issue. Use pip install --no-cache-dir zappa instead


RE: Amazon Echo skill for Kodi - jingai - 2017-08-31

I think you're running out of memory. You should try it on a desktop or laptop computer.


RE: Amazon Echo skill for Kodi - simon_rb - 2017-08-31

(2017-08-31, 02:27)jingai Wrote: I think you're running out of memory. You should try it on a desktop or laptop computer.

New error in log. (CloudWatch)

Code:
No module named pytz: ImportError
Traceback (most recent call last):
File "/var/task/handler.py", line 505, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 239, in lambda_handler
handler = cls()
File "/var/task/handler.py", line 131, in __init__
self.app_module = importlib.import_module(self.settings.APP_MODULE)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/var/task/alexa.py", line 6, in <module>
import pytz
ImportError: No module named pytz

END RequestId: cbdced2b-8de5-11e7-858f-27eec54c21cc



RE: Amazon Echo skill for Kodi - jingai - 2017-08-31

pytz is in the requirements. Are you absolutely certain you executed pip install -r requirements.txt from within the venv?


RE: Amazon Echo skill for Kodi - sparky0820 - 2017-08-31

(2017-07-13, 05:05)mngsparks Wrote: I just finished going through this awesome guide but keep getting the following error when Asking Alexa to do anything in the living room:
"There was a problem with the requested skill's response"

It also fails when trying to do it with the service simulator with the following:
"There was an error calling the remote endpoint, which returned HTTP 500 : Internal Server Error"

Please help. Thanks in advance.

I'm really sorry to bring this up again, but I followed the guide to a tee and I am getting the HTTP 500 error. The invocation name works just fine, but when I try any of the commands I get the internal error when I test on the website or a "There was a problem with the requested skill's response" if I ask Alexa. Please help as I've spent hours on this with nothing to show for it. Thanks in advance.


RE: Amazon Echo skill for Kodi - sanjonny - 2017-08-31

Back in March, I got this working great on 4 of my devices. I went to try and update today and found that basically I have to start over because I was not using zappa, so I went thru the entire process. Luckily I learned a lot last time so I have some suggestions to improve the readme. I also found a few errors and points of clarity that would really help somebody starting out, but there is a bigger problem.

In the current guide, there are links to the intents and the utterances. When trying to open the link for the intents, it opens fine, but the link for utterances gives a 404 error. I tried it over and over again.

This is in the part of the guide that contains
Code:
On the next page, you'll have to paste the contents of the IntentSchema.json file into the "Intent Schema" field, and paste the contents of the SampleUtterances.txt or SampleUtterances.german.txt file in the "Sample Utterances" field. Generate and save your Custom Slots first before pasting the Intents and Utterances to avoid errors when attempting to save.

So i pasted the stuff from intents into the file after doing the custom slots....BTW the guide is incorrect. You cannot save just the slots, you still have to do everything to get the page to save (stupid AWS). At least they made it a bit better, but you cannot save just the slots, it will not save with blank intents or blank utterances. Anyway, I did the slots, copied the intents and then could not open the sampleutterances.txt link because of the 404 error. So I went to the git directory and in the directory on the git copied to my computer and tried to use those utterances and they DO NOT WORK! The ones utterances.en.txt will result in errors whether removing the initial code tag section or not. Same with samples that are in the main directory.

I have not gone further in getting all my devices in the current skill, till I get the utternances figured out, but so happy that you guys put that in there! I knew it could be figured out and look forward to doing that once I get the utternances solved. Also note, it is currently working with the new intents and the old, edited utterances, just missing several lines I had to edit out to get it to save. Will post back with more info and please fix that link when you get a chance!

What i ended up doing since I could not find those, is loading old values for the utterances, which since the intents were different would almost save, but I had to delete everything with {genre} tag since that is not the same as the new tag. I am going to poke around the git some more to see if I can find the file that is currently giving the 4o4 error, but that needs to be fixed and I suggest removing the current WRONG utterances from the git library because that will drive people going thru this the first time completely nuts! when trying to use those.

There is also problems with the upgrading.md file, but I have not gotten to play with that yet, till I find the right utternaces. Please let me know if I am missing something obvious, but I think this is a link problem on github currently and I will post back the other issues when I get a better chance to document them.


RE: Amazon Echo skill for Kodi - sanjonny - 2017-08-31

Referring back to my earlier message, I saw the file in speech_assets that had the same title as what is in the readme and copied that info to the utterances and it seems to work properly, so I think that is the right file? If so, it just needs the link fixed in the readme. I was able to get the multiple devices working easily after that so hopefully that is the correct file.

In the upgrading.md file, there needs to be a few clarifications. The aws says to check that your virtual session is activated. HOW? Remember, people might not look at this stuff for oh say 6 or 7 months and things might have changed. If I stopped time here today and came back in 6 months, I don't think I would have any idea how to check if my virtual environment is enabled/activated (cause I don't even know how to check it now, even though I know it is because I just used it) but it would be a good idea to tell how to check it and have a link back to the readme section that covers how to set it up if it is not enabled/activated. Also it says browse to the application directory. I would note that it is default kodi-alexa for those that changed nothing, because again, several months down the road, we forget....

Thanks so much for all your good work. It seems to work much faster now!


RE: Amazon Echo skill for Kodi - sanjonny - 2017-08-31

Okay, another hiccup/question. For the multi kodi models, it works great. but for two of my units, they need different invocation names, like the way it used to work, where i had 2 different skills setup with changes to the configuration file (I think) For example, with this current setup, since it is by linking device id to kodi instance, that does not work for 2 of my kodi players, because I used the same dot to control both kodi devices. The way this was handled in the past, is that I had 2 skills with 2 different usernames (I think) so I could ask kodi to pause the living room and ask kodi to pause the kitchen.

I don't think the current method allows me to use different commands on the same dot (yet) so how do I have different skills....it seems that when you run the deploy or update w8ty zappa, it will create the same role name (kodi-alexa-dev-ZappaLambdaExecutionRole). So is there a way to use this setup to call the different devices? I understand I might have to duplicate the skills like before or whatever, but I can't seem to figure out how to get the proper links for each kodi instance.

My other kodi devices are tied to different dots, so that the multiple method works great, but I don't get how to do the duplicate everything (if needed) using zappa.

Again, thanks in advance for all your help and hard work!


RE: Amazon Echo skill for Kodi - jingai - 2017-08-31

(2017-08-31, 08:20)sparky0820 Wrote: I'm really sorry to bring this up again, but I followed the guide to a tee and I am getting the HTTP 500 error. The invocation name works just fine, but when I try any of the commands I get the internal error when I test on the website or a "There was a problem with the requested skill's response" if I ask Alexa. Please help as I've spent hours on this with nothing to show for it. Thanks in advance.

Need to see the skill logs to know what's going on.


RE: Amazon Echo skill for Kodi - jingai - 2017-08-31

(2017-08-31, 08:50)sanjonny Wrote: In the current guide, there are links to the intents and the utterances. When trying to open the link for the intents, it opens fine, but the link for utterances gives a 404 error. I tried it over and over again.

That file was recently renamed and I forgot to update it in the README to reflect that. I've fixed this.

(2017-08-31, 08:50)sanjonny Wrote: So i pasted the stuff from intents into the file after doing the custom slots....BTW the guide is incorrect. You cannot save just the slots, you still have to do everything to get the page to save (stupid AWS). At least they made it a bit better, but you cannot save just the slots, it will not save with blank intents or blank utterances.

The README isn't telling you to save the skill model after each slot -- it's telling you to save just each slot. In the Slot editor, there is a button to save the Slot contents just underneath it.

(2017-08-31, 08:50)sanjonny Wrote: In the upgrading.md file, there needs to be a few clarifications. The aws says to check that your virtual session is activated. HOW? Remember, people might not look at this stuff for oh say 6 or 7 months and things might have changed. If I stopped time here today and came back in 6 months, I don't think I would have any idea how to check if my virtual environment is enabled/activated (cause I don't even know how to check it now, even though I know it is because I just used it) but it would be a good idea to tell how to check it and have a link back to the readme section that covers how to set it up if it is not enabled/activated.

The upgrading instructions refer you to re-read the README, as things may have also changed there. I understand that time has passed and you're looking for a refresher, but the steps for upgrading the skill are very close to the steps for an initial installation -- there would be a lot of duplication if we were as detailed in UPGRADING as we are in the README, so you should do as the instructions say and refer back to the README for the details.

(2017-08-31, 08:50)sanjonny Wrote: Okay, another hiccup/question. For the multi kodi models, it works great. but for two of my units, they need different invocation names, like the way it used to work, where i had 2 different skills setup with changes to the configuration file (I think) For example, with this current setup, since it is by linking device id to kodi instance, that does not work for 2 of my kodi players, because I used the same dot to control both kodi devices. The way this was handled in the past, is that I had 2 skills with 2 different usernames (I think) so I could ask kodi to pause the living room and ask kodi to pause the kitchen.

I don't think the current method allows me to use different commands on the same dot (yet)

Correct. It is a one-to-one mapping. There is one way around it that doesn't involve deploying a second copy of the skill, however: if you create another Amazon account and put both accounts into a Household, each account will present with a different Device ID. Then you can "Alexa, switch account to foo" to control one set, and "Alexa, switch account to bar" to control the other. For this, each Amazon account will also need the skill model set up on the developer site, but you can share the same skill code deployment and distinguish them by the Device IDs.

Another benefit of doing it this way is that the skill invocation name doesn't have to change; so, for both accounts, it could be simply, "Alexa, ask Kodi to ..."

(2017-08-31, 08:50)sanjonny Wrote: so how do I have different skills....it seems that when you run the deploy or update w8ty zappa, it will create the same role name (kodi-alexa-dev-ZappaLambdaExecutionRole). So is there a way to use this setup to call the different devices? I understand I might have to duplicate the skills like before or whatever, but I can't seem to figure out how to get the proper links for each kodi instance.

I believe it goes by the directory name. You'll need two copies of the skill code on your local computer anyway because their kodi.config files will be different.


RE: Amazon Echo skill for Kodi - simon_rb - 2017-08-31

jingai!!!!! Its running!

I changed two things and not sure which it was that fixed it. I firstly deleted the AWS side of it. Then followed this guide which is the Windows Version on a trusty Windows XP machine!

https://www.howtogeek.com/249336/how-to-control-your-kodi-media-center-with-an-amazon-echo/

as soanjonny has asked I would like to add multiple kodi installs and I have read the documentation however this is my setup.

I have one Echo Dot for the time being. I have an Amazon Fire TV 2 running Kodi 17.4 in the Living Room and a Sony Android TV running Kodi 17.4 in the Living Room. I plan to add the Alexa compatible fire sticks in other rooms as they have the older sticks and can't play HVEC files.

Anyways.. They all share the same library which is handy and would like to control the two in the living room by which ever names which I haven't thought of yet.

How do I add them to the config file? I see this at the bottom

# living room dot
[amzn1.ask.device.XXX]
address = living-room-kodi

however is that more for multiple dots..

How can I have my one dot control my two kodis that are in the living room?

Thanks for your help so far!


RE: Amazon Echo skill for Kodi - jingai - 2017-08-31

(2017-08-31, 14:15)simon_rb Wrote: I have one Echo Dot for the time being. I have an Amazon Fire TV 2 running Kodi 17.4 in the Living Room and a Sony Android TV running Kodi 17.4 in the Living Room. I plan to add the Alexa compatible fire sticks in other rooms as they have the older sticks and can't play HVEC files.

Anyways.. They all share the same library which is handy and would like to control the two in the living room by which ever names which I haven't thought of yet.

How do I add them to the config file? I see this at the bottom

# living room dot
[amzn1.ask.device.XXX]
address = living-room-kodi

however is that more for multiple dots..

How can I have my one dot control my two kodis that are in the living room?

Thanks for your help so far!

Read my response to @sanjonny -- the skill can map one echo device to one Kodi installation. If you need one-to-many, you need to have separate copies of the skill (with different invocation names) or use another Amazon account in a Household.

edit: An Amazon Fire TV is also an Alexa device, btw, if using the voice remote is an option for you to distinguish them. The Fire TV will show in the logs with a unique Device ID that you can put into the config file.


RE: Amazon Echo skill for Kodi - sparky0820 - 2017-08-31

(2017-08-31, 13:40)jingai Wrote:
(2017-08-31, 08:20)sparky0820 Wrote: I'm really sorry to bring this up again, but I followed the guide to a tee and I am getting the HTTP 500 error. The invocation name works just fine, but when I try any of the commands I get the internal error when I test on the website or a "There was a problem with the requested skill's response" if I ask Alexa. Please help as I've spent hours on this with nothing to show for it. Thanks in advance.

Need to see the skill logs to know what's going on.

I'm very new to this. Where do I find the skill logs?