Using Alexa with the Renesas IoT Sandbox

This tutorial will connect Alexa to the Renesas IoT Sandbox then show you how to create a workflow to ask Alexa to get sensor data such as the current temperature.


  • Completion of the Smart Garage and Smart Chef tutorial.
  • A Smart Chef project and its activation email from the project.
  • An Amazon Developer account (
  • An Echo, Echo Dot, or Tap to use with Alexa.
  • (Optional) A smartphone with the Amazon Alexa app.

Step 1: Create a Skill on your Amazon account

Log into your Amazon Developer account. Note that the link to log in is Click on “Alexa” from your dashboard.


Click “Getting Started” under the Alexa Skills kit:


Click “Add new skill”


You are now on the Skill Information page. For skill type, click “Custom Interaction Model.” For name, put “Alexa IoT Sandbox.” Finally, for invocation name, put “medium one.” Under global directives, leave Audio Player at “no.”


Click next. Copy and paste the following into “Intent Schema”:

  "intents": [
      "intent": "SensorStatusIntent",
      "slots": [
          "name": "Sensor_Selection",
          "type": "Sensor_Options"


Next, click on “Add Slot Type.” A box will open up. For the name, enter “Sensor_Options.” For the values, copy and paste the following:



Click “Save.” Copy and paste the following under “Sample Utterances:”

SensorStatusIntent What is the current {Sensor_Selection}
SensorStatusIntent What is my current {Sensor_Selection}
SensorStatusIntent What is current {Sensor_Selection}

Click on the save button. It will take a few seconds to build the model. Leave this page open for now, we’ll come back to it in the next step.


Step 2: Create an Alexa Stream

Log into the Renesas IoT Sandbox. Open your Smart Chef project. As a reminder, the Smart Chef project is from the guide here. In this step, you will be creating a stream for all of the Alexa data. 

Click on “Config→ Data Streams.” Scroll to the bottom and click “Create a new stream.” Name it “alexa_requests.”  Click “Save Data Stream.”


Step 3: Linking Alexa and IoT Sandbox

For this step, you will need to switch between the Amazon Developer configuration page and the IoT Sandbox OAUTH Clients Page. On the IoT Sandbox, click “Manage OAuth Clients.” Click “Add New,” and see the following page open. Give it a name and a login message. The login message will come up later on the OAuth page. 

Under Permissions, leave Stream Access permission then click on the plus sign to the right. Check both the read and write permissions, and choose alexa_requests as the stream. This gives the Alexa Skill permission to send data to this stream.  Leave this for now and switch to your Amazon Developer page.

Leave this for now and switch to your Amazon Developer page.We are assuming that you have not navigated away from anything on this page since Step 1. Click on the “Configuration” tab.

Specify “HTTPS” under Service Endpoint Type. Then select North America. In the box that comes up after clicking North America, paste: “”


Click on the “Yes” button for account linking.


Paste “ Authorization URL at the top, and “ down where it says Access Token URI. Make sure “Auth Code Grant” is selected.

Take note of the two URLs in the blue box.


Copy and paste these URLs back in the IoT Sandbox. You will need to use the plus button to add the second URL. Click Save when you are done.


This appears on the next page. Take note of the Client ID in the blue box, and the Client Secret in the green box. Copy and paste these into the blue and green boxes on the Amazon Developer page:


You do not need to put anything for Domain List and Scope. For privacy policy, paste
“”. Then click Save.


Finally, click on SSL Certificate on the sidebar. Select the middle option, then click save.


Step 4: Link your account

Go on the Alexa App on your phone or the desktop version liked here. Make sure you are logged into your Amazon Account and you have already configured your echo device. This guide shows how to link using mobile, but the app and the website look very similar. Navigate to skills.


Click on Your Skills on the upper righthand corner.


Navigate to the skill you created. We named ours “Alexa IoT Sandbox V1.”


Click “Link Account.” If you ever want to link to a new user, you’ll have to disable the skill then re-enable it to unlink.


Enter the username and password of the user “device” that you received the login info for in the activation email in this project.  (Do not use the password listed below; use the one from your email.)

You should see this on the next page, with your skill name:



Go to your Amazon Developer account. Click on the “Test” tab. Go to “Service Simulator” and type in “What is my current temperature?,” then click the ask button. You should see “The response is invalid.” This is good; we haven’t created our workflows yet!


Go onto the IoT Sandbox. Confirm that there is an event in the alexa_requests stream from the timestamp that you sent the request from Amazon. To do this, go to Data Viewer -> Data Streams and click on ‘alexa_requests.’ You should see one event like the photo below.


Step 5: Create Workflows

Go to your workflow studio. Create a new workflow named “Request Sensor Data with Alexa.” Under Tags and Triggers, under alexa_requests, drag Go to modules and drag Base Python under Foundation.  Drag this onto the screen and connect in1 to the green box. Double click on the foundation box and replace the code in that workflow with the following:


import Alexa
import Analytics

def build_response(title, output):
    return {
        'version': '1.0',
        'sessionAttributes': {},
        'response' : {
            'outputSpeech': {
                'type': 'PlainText',
                'text': output
            'card': {
                'type': 'Simple',
                'title': 'SessionSpeechlet - ' + title,
                'content': 'SessionSpeechlet - ' + output
            'reprompt': {
                'outputSpeech': {
                    'type': 'PlainText',
                    'text': ""
            'shouldEndSession': True

event = IONode.get_event()
request = event['request']
uuid_marker = event.get("uuid", "")
if request['type'] == 'IntentRequest':
    if request['intent']['name'] == 'SensorStatusIntent':
        sensor_data = request['intent']['slots']['Sensor_Selection']['value']
        if sensor_data in ['temperature', 'humidity']:
            tag_name = "processed." + sensor_data
            val = Analytics.last_n_values(tag_name,1)
            if val:
                response_txt = "The most recent " + sensor_data + " is " + str(val[0][tag_name]) 
                response_txt = "I could not find any recent " + sensor_data + " values"
            response_json = build_response(request['intent']['name'], response_txt)
            Alexa.response(uuid_marker, response_json) 


Click Save and Activate. Your workflow should look like this:


Go back to the Test tab on the Amazon developers website. Type in “What is my current temperature.” You should see JSON come up in the response section:


Step 6: Talk to Alexa

Now, you’re ready to ask Alexa to get sensor data. Say “Echo, ask Medium One to get my current temperature.” She should come back with the data from your sensor. Congratulations, you’ve successfully connected up your Echo to the IoT Sandbox! Now you can modify workflows to respond to different Alexa commands.