Lambda Config - gscooke/AlexaNissanLeaf GitHub Wiki

Lambda Final Configuration

Now everything just needs fully wired up, some permissions need set and we need to get the final values.

Lambda Config

Return to your Lambda function, you should now see that there are two triggers added (Alexa Skills Kit and CloudWatch Events), if you don't then something has gone wrong with their configuration.

Scroll down the page and add the Environment variables as described in the Readme, at this point, you won't know your scheduleEventTargetId or the scheduledEventFunctionArn.

Further down the page, set the Basic settings Timeout value to 1 minute. Nissan services can be incredibly slow.

Click Save at the top of the page.

Permissions Config

Return to the AWS console and search for and go to IAM

Select Roles from the left hand menu and select the name of your Role

Click 'Attach Policy' and search for AWS Lambda Full Access. Attach the policy.

Get Final Config Values

Your function should now be finished except for one missing parameter, scheduleEventTargetId

Go to your alexa skills page and return to the Test page, you should be able to enter text into the Service Simulator. Type 'to log my rules' and click 'Ask' below. If all goes well, you should see a service request, and shortly afterwards a service response. The response should contain outputSpeech like this:

"version": "1.0", "response": { "outputSpeech": { "text": "Your Cloud Watch rules have been logged.", "type": "PlainText" },

If not, something else has gone wrong with the configuration.

If you do get those values, go back into CloudWatch, click Logs on the left menu and then click on the Log Group that matches your function.

Open the latest log stream, and you should see an event which has a recent time, a long value and then something like { Targets: [ { Id: .... If so, click that row and in there, you can fetch the Id that you need to use for your scheduleEventTargetId parameter in your Lambda function.

Wrap Up

That should be it. I'm writing quite a bit of this from memory so there might be steps missing or config that's not needed. You can use the Alexa test functions to try out different features, and you can also interact through your Echo dot.

To do that final element, you'll need to add the skill to your Echo in the usual way.