question

newuser-5e1e3e1b-007d-42da-b023-2bbf12a51b2a avatar image
newuser-5e1e3e1b-007d-42da-b023-2bbf12a51b2a asked ·

Adding adafruitIO libraries to AWS Lambda

Hi,

i am very new in the Alexa skill development area, i and i apologies if this question has been asked before, but i cant seem to find the right answer to my problem. Basically i want alexa to read a value from Adafruit IO. I have the python script working on my PC and i want to port it over to AWS lambda, but i when i run my script, alexa doesnt seem to respond. I followed the following steps from the website

https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html

after doing that, it looks something like this.

The base code is taken from this website. I can get this skill to work.

https://medium.com/crowdbotics/how-to-build-a-custom-amazon-alexa-skill-step-by-step-my-favorite-chess-player-dcc0edae53fb

and the Adafruit IO script is as bellow. This script also works on my PC when i did my "pip-install"

# Import library and create instance of REST client.
from Adafruit_IO import Client
aio = Client('XXXX', 'XXXX')

# Get an array of all data from feed 'Test'
data = aio.data('test')

# Print out all the results.
for d in data:
    print('{0}'.format(d.value))

Essentially, my main aim is to query alexa for the status of the Adafruit IO. Once i added the first line

from Adafruit_IO import Client

the code stops working. Every time i trigger the skill, i get

"There was a problem with the requested skill's response"

i'm not sure what is going on I really appreciate you guys helping out.

Thanks in advance

alexa skills kitlambdapython
captureaws.jpg (170.8 KiB)
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jenn@amazon avatar image
Jenn@amazon answered ·

Sounds like an issue with the Lambda Function. Look at the CloudWatch logs, any errors will get printed to the logs for easier troubleshooting.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-5e1e3e1b-007d-42da-b023-2bbf12a51b2a avatar image
newuser-5e1e3e1b-007d-42da-b023-2bbf12a51b2a answered ·

Hi,

Thanks for the reply, i actually figured it out =) i realised i needed to import urllib to get it to work. it works just fine now!

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.